[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r19095: {tor} Actually do that memarea_strndup fix right. Not only must yo (tor/trunk/src/common)
Author: nickm
Date: 2009-03-21 12:01:52 -0400 (Sat, 21 Mar 2009)
New Revision: 19095
Modified:
tor/trunk/src/common/memarea.c
Log:
Actually do that memarea_strndup fix right. Not only must you not examine unmapped ram, but you also must not copy it. From lark.
Modified: tor/trunk/src/common/memarea.c
===================================================================
--- tor/trunk/src/common/memarea.c 2009-03-21 11:52:53 UTC (rev 19094)
+++ tor/trunk/src/common/memarea.c 2009-03-21 16:01:52 UTC (rev 19095)
@@ -241,7 +241,8 @@
;
/* 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;
}