Kaynağa Gözat

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
Nick Mathewson 15 yıl önce
ebeveyn
işleme
be9d72303e
1 değiştirilmiş dosya ile 2 ekleme ve 1 silme
  1. 2 1
      src/common/memarea.c

+ 2 - 1
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;
 }