Check the return value of memchr().

For quality-of-implementation in munge_extrainfo_into_routerinfo().
See #8791
This commit is contained in:
Arlo Breault
2013-05-13 12:32:01 -07:00
committed by Nick Mathewson
parent 196155657d
commit 88a780d899
+2 -1
View File
@@ -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;
}