summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorArlo Breault <arlolra@gmail.com>2013-05-13 12:32:01 -0700
committerNick Mathewson <nickm@torproject.org>2013-05-14 12:23:17 -0400
commit88a780d8990622bfc0faa3b5299d0c21012f2c41 (patch)
tree975a900f1b34c55dccf532db4319d17c67557685 /src/or/control.c
parent196155657d83be747b32819ad841c041bc2d9dfc (diff)
downloadtor-88a780d8990622bfc0faa3b5299d0c21012f2c41.tar.gz
tor-88a780d8990622bfc0faa3b5299d0c21012f2c41.zip
Check the return value of memchr().
For quality-of-implementation in munge_extrainfo_into_routerinfo(). See #8791
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 48782682c7..75f7af99a4 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -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;
}