mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Check the return value of memchr().
For quality-of-implementation in munge_extrainfo_into_routerinfo(). See #8791
This commit is contained in:
committed by
Nick Mathewson
parent
196155657d
commit
88a780d899
+2
-1
@@ -1572,7 +1572,8 @@ munge_extrainfo_into_routerinfo(const char *ri_body,
|
||||
if (!(cp = tor_memstr(ei_body, ei_len, kwd)))
|
||||
continue;
|
||||
++cp;
|
||||
eol = memchr(cp, '\n', ei_len - (cp-ei_body));
|
||||
if (!(eol = memchr(cp, '\n', ei_len - (cp-ei_body))))
|
||||
continue;
|
||||
memcpy(outp, cp, eol-cp+1);
|
||||
outp += eol-cp+1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user