dovecot-2.2: test-json-parser: Don't access memory out of bounds.
dovecot at dovecot.org
dovecot at dovecot.org
Sun Feb 24 11:58:58 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/573682b34a76
changeset: 15908:573682b34a76
user: Timo Sirainen <tss at iki.fi>
date: Sun Feb 24 11:55:07 2013 +0200
description:
test-json-parser: Don't access memory out of bounds.
diffstat:
src/lib/test-json-parser.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (19 lines):
diff -r db0ada89b81a -r 573682b34a76 src/lib/test-json-parser.c
--- a/src/lib/test-json-parser.c Sun Feb 24 11:54:00 2013 +0200
+++ b/src/lib/test-json-parser.c Sun Feb 24 11:55:07 2013 +0200
@@ -128,11 +128,13 @@
test_istream_set_size(input, i);
for (;;) {
- if (json_output[pos].type == (enum json_type)TYPE_SKIP) {
+ if (pos < N_ELEMENTS(json_output) &&
+ json_output[pos].type == (enum json_type)TYPE_SKIP) {
json_parse_skip_next(parser);
pos++;
continue;
- } else if (json_output[pos].type != (enum json_type)TYPE_STREAM) {
+ } else if (pos == N_ELEMENTS(json_output) ||
+ json_output[pos].type != (enum json_type)TYPE_STREAM) {
ret = json_parse_next(parser, &type, &value);
} else {
ret = jsoninput != NULL ? 1 :
More information about the dovecot-cvs
mailing list