Permalink
Browse files

fixes case where the data member of string would be invalid when tryi…

…ng to copy bytes into it
  • Loading branch information...
1 parent fe3a709 commit 2114feda29f479feaa56d459e6dc2e7b3c750198 @jeremytregunna jeremytregunna committed May 18, 2012
Showing with 1 addition and 0 deletions.
  1. +1 −0 wee/str.c
View
1 wee/str.c
@@ -29,6 +29,7 @@
str_t* str_new(char* string, size_t length)
{
str_t* str = (str_t*)obj_new_with_size(sizeof(*str));
+ str->data = malloc(length);
memcpy(str->data, string, length);
str->length = length;
return str;

0 comments on commit 2114fed

Please sign in to comment.