[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Check for NULL as input to extrainfo_parse_entry_from_string()
commit 5203cd2f11a1419db57d067d2713c2118787d0c3
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Mon Mar 6 11:31:11 2017 -0500
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.
---
changes/bug21496 | 4 ++++
src/or/routerparse.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/changes/bug21496 b/changes/bug21496
new file mode 100644
index 0000000..24ac85a
--- /dev/null
+++ b/changes/bug21496
@@ -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.
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 0336c03..c4f3295 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -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);
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits