mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
fix from lark: make memarea_strndup() work even at the end of a mmap chunk. Bug was harmless for now, I think.
svn:r19094
This commit is contained in:
@@ -237,7 +237,7 @@ memarea_strndup(memarea_t *area, const char *s, size_t n)
|
||||
size_t ln;
|
||||
char *result;
|
||||
const char *cp, *end = s+n;
|
||||
for (cp = s; *cp && cp < end; ++cp)
|
||||
for (cp = s; cp < end && *cp; ++cp)
|
||||
;
|
||||
/* cp now points to s+n, or to the 0 in the string. */
|
||||
ln = cp-s;
|
||||
|
||||
Reference in New Issue
Block a user