Permalink
Browse files

Fix off-by-one in linenoise SERVER-3394

  • Loading branch information...
RedBeard0531 committed Sep 7, 2011
1 parent f9d784f commit ff418fdac2591664a9bb1fe76be854483b136e1c
Showing with 1 addition and 1 deletion.
  1. +1 −1 third_party/linenoise/linenoise.cpp
@@ -281,7 +281,7 @@ static void refreshLine(int fd, const char *prompt, char *buf, size_t len, size_
if (scanDirection) {
int unmatched = scanDirection;
int i;
- for(i = pos + scanDirection; i >= 0 && i <= (int)len; i += scanDirection){
+ for(i = pos + scanDirection; i >= 0 && i < (int)len; i += scanDirection){
/* TODO: the right thing when inside a string */
if (strchr("}])", buf[i]))
unmatched--;

0 comments on commit ff418fd

Please sign in to comment.