Skip to content
Permalink
Browse files Browse the repository at this point in the history
Merge pull request #27 from kcwu/fix-strgrow
Fix potential heap buffer corruption due to Strgrow
  • Loading branch information
tats committed Sep 2, 2016
2 parents e79a099 + c95a43d commit d43527c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Str.c
Expand Up @@ -232,8 +232,8 @@ Strgrow(Str x)
{
char *old = x->ptr;
int newlen;
newlen = x->length * 6 / 5;
if (newlen == x->length)
newlen = x->area_size * 6 / 5;
if (newlen == x->area_size)
newlen += 2;
x->ptr = GC_MALLOC_ATOMIC(newlen);
x->area_size = newlen;
Expand Down

0 comments on commit d43527c

Please sign in to comment.