0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

Fix off-by-one in linenoise SERVER-3394

This commit is contained in:
Mathias Stearn 2011-09-07 12:24:32 -04:00
parent f9d784faf0
commit ff418fdac2

View File

@ -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--;