Actually do that memarea_strndup fix right. Not only must you not examine unmapped ram, but you also must not copy it. From lark.

svn:r19095
This commit is contained in:
Nick Mathewson 2009-03-21 16:01:52 +00:00
parent 0fa01654b9
commit be9d72303e

View File

@ -241,7 +241,8 @@ memarea_strndup(memarea_t *area, const char *s, size_t n)
;
/* cp now points to s+n, or to the 0 in the string. */
ln = cp-s;
result = memarea_memdup(area, s, ln+1);
result = memarea_alloc(area, ln+1);
memcpy(result, s, ln);
result[ln]='\0';
return result;
}