diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-03-07 16:06:03 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-03-16 14:42:56 -0400 |
commit | 12d428aaff6d90cadeaca12367f4e14fa673e51c (patch) | |
tree | 76bad78a4ab24ec854a042c1b21e37432029acf2 /src/or/consdiff.c | |
parent | dd92579b63fa012bcbe081ab66ff40d6a036b765 (diff) | |
download | tor-12d428aaff6d90cadeaca12367f4e14fa673e51c.tar.gz tor-12d428aaff6d90cadeaca12367f4e14fa673e51c.zip |
Prop140: Fix a crash bug.
Found while fuzzing: this could occur if we tried to copy a
nonexistent "line 0" while applying a diff.
Diffstat (limited to 'src/or/consdiff.c')
-rw-r--r-- | src/or/consdiff.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/or/consdiff.c b/src/or/consdiff.c index 16933deb89..c33bad1940 100644 --- a/src/or/consdiff.c +++ b/src/or/consdiff.c @@ -742,7 +742,7 @@ apply_ed_diff(const smartlist_t *cons1, const smartlist_t *diff, } /* Add unchanged lines. */ - for (; j > end; --j) { + for (; j && j > end; --j) { const char *cons_line = smartlist_get(cons1, j-1); smartlist_add(cons2, tor_strdup(cons_line)); } |