diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-03-07 11:08:18 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-03-16 14:38:28 -0400 |
commit | 06017f35e8c9bd821ee10ceb79476e6f5cd1f5d4 (patch) | |
tree | b481760611c0e0959bb8c7f5b0862f091b5e9e52 /src/or/consdiff.c | |
parent | 97620cf18ff510deec07cd98b46cfa7a3f859900 (diff) | |
download | tor-06017f35e8c9bd821ee10ceb79476e6f5cd1f5d4.tar.gz tor-06017f35e8c9bd821ee10ceb79476e6f5cd1f5d4.zip |
Fix some logging on failed apply_ed_diff
Diffstat (limited to 'src/or/consdiff.c')
-rw-r--r-- | src/or/consdiff.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/or/consdiff.c b/src/or/consdiff.c index 65e15f79ee..a340cfd8f8 100644 --- a/src/or/consdiff.c +++ b/src/or/consdiff.c @@ -670,15 +670,15 @@ apply_ed_diff(smartlist_t *cons1, smartlist_t *diff) if (*endptr1 == ',') { end = (int)strtol(endptr1+1, &endptr2, 10); if (endptr2 == endptr1+1) { - goto error_cleanup; log_warn(LD_CONSDIFF, "Could not apply consensus diff because " "an ed command was missing a range end line number."); + goto error_cleanup; } /* Incoherent range. */ if (end <= start) { - goto error_cleanup; log_warn(LD_CONSDIFF, "Could not apply consensus diff because " "an invalid range was found in an ed command."); + goto error_cleanup; } /* We'll take <n1> as <n1>,<n1> for simplicity. */ @@ -693,6 +693,12 @@ apply_ed_diff(smartlist_t *cons1, smartlist_t *diff) goto error_cleanup; } + if (*endptr2 == '\0') { + log_warn(LD_CONSDIFF, "Could not apply consensus diff because " + "a line with no ed command was found"); + goto error_cleanup; + } + if (*(endptr2+1) != '\0') { log_warn(LD_CONSDIFF, "Could not apply consensus diff because " "an ed command longer than one char was found."); |