Commit 88a780d8 authored by Arlo Breault's avatar Arlo Breault Committed by Nick Mathewson
Browse files

Check the return value of memchr().

For quality-of-implementation in munge_extrainfo_into_routerinfo().
See #8791
parent 19615565
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;
  }