Check for NULL as input to extrainfo_parse_entry_from_string()

We hope this will make the clangalyzer less worried about this function.

Closes ticket 21496.
This commit is contained in:
Nick Mathewson 2017-03-06 11:31:11 -05:00
parent 0a54e5d148
commit 5203cd2f11
2 changed files with 7 additions and 0 deletions

4
changes/bug21496 Normal file
View File

@ -0,0 +1,4 @@
o Minor features (safety):
- Add an explict check to extrainfo_parse_entry_from_string() for NULL
inputs. We don't believe this can actually happen, but it may help
silence a warning from the Clang analyzer. Closes ticket 21496.

View File

@ -2030,6 +2030,9 @@ extrainfo_parse_entry_from_string(const char *s, const char *end,
* parse that's covered by the hash. */
int can_dl_again = 0;
if (BUG(s == NULL))
return NULL;
if (!end) {
end = s + strlen(s);
}