Mercurial > code
changeset 10:da47652b60c5
Fix security issue
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 07 Sep 2011 20:31:41 +0200 |
parents | bf25ed2cf42a |
children | 7360d752183e |
files | array.c |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/array.c Wed Sep 07 20:14:45 2011 +0200 +++ b/array.c Wed Sep 07 20:31:41 2011 +0200 @@ -64,7 +64,7 @@ if (array_grow(arr) < 0) return -1; - memmove(&arr->data[SIZE(1)], arr->data, SIZE(arr->length++)); + memmove(&arr->data[arr->unit], &arr->data[0], SIZE(arr->length++)); memcpy(&arr->data[0], data, arr->unit); return 0; @@ -246,7 +246,7 @@ SIZE(arr->bsize)))) return -1; - arr->size += arr->bsize; + arr->size += SIZE(arr->bsize); } else return ((arr->size / arr->unit) <= arr->length) ? -1 : 0;