summaryrefslogtreecommitdiff
path: root/src/common/memarea.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-03-21 16:01:52 +0000
committerNick Mathewson <nickm@torproject.org>2009-03-21 16:01:52 +0000
commitbe9d72303ecd594574d42faeacb293ba0ce2420b (patch)
tree640c0236c540fb442279dbc08d9e2447f1a0cf0b /src/common/memarea.c
parent0fa01654b9553598fd3263cdec9849bd8ea2a4a8 (diff)
downloadtor-be9d72303ecd594574d42faeacb293ba0ce2420b.tar.gz
tor-be9d72303ecd594574d42faeacb293ba0ce2420b.zip
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
Diffstat (limited to 'src/common/memarea.c')
-rw-r--r--src/common/memarea.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/memarea.c b/src/common/memarea.c
index 7eb54821b9..6e0bda0c8a 100644
--- a/src/common/memarea.c
+++ b/src/common/memarea.c
@@ -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;
}