summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-12-08 15:14:00 -0500
committerEliot Horowitz <eliot@10gen.com>2009-12-08 15:14:00 -0500
commit3b6ad7094099ccc25697ceb403f20df88bd4f180 (patch)
treea51682fdbf1eda91693ea6aadb6537ebf63ce500 /shell
parent6c1f48d46f608358245263106a0f91eaca433aef (diff)
downloadmongo-3b6ad7094099ccc25697ceb403f20df88bd4f180.tar.gz
fail faster on crappy input
Diffstat (limited to 'shell')
-rw-r--r--shell/dbshell.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/shell/dbshell.cpp b/shell/dbshell.cpp
index 93d5828a5d0..6f5df237176 100644
--- a/shell/dbshell.cpp
+++ b/shell/dbshell.cpp
@@ -178,9 +178,9 @@ bool isBalanced( string code ){
}
continue;
case '{': brackets++; break;
- case '}': brackets--; break;
+ case '}': if ( brackets <= 0 ) return true; brackets--; break;
case '(': parens++; break;
- case ')': parens--; break;
+ case ')': if ( parens <= 0 ) return true; parens--; break;
case '"':
i++;
while ( i < code.size() && code[i] != '"' ) i++;