diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-02-19 22:05:49 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-02-19 22:05:49 +0000 |
commit | 749735215bd8283fe6b45d8bcf286b33618089a9 (patch) | |
tree | 9c905d2d351d10fef6c9d324668fb5edbf4f4f70 /src/common/container.c | |
parent | 23e4c849c962392df5d54adf9eae97d3681860d5 (diff) | |
download | tor-749735215bd8283fe6b45d8bcf286b33618089a9.tar.gz tor-749735215bd8283fe6b45d8bcf286b33618089a9.zip |
r18208@catbus: nickm | 2008-02-19 17:02:30 -0500
Add some checks in torgzip.c to make sure we never overflow size_t there. Also make sure we do not realloc(list,0) in container.c. Backport candidate.
svn:r13587
Diffstat (limited to 'src/common/container.c')
-rw-r--r-- | src/common/container.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/container.c b/src/common/container.c index 5ac16bdb1b..6bd8df689d 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -66,6 +66,8 @@ smartlist_set_capacity(smartlist_t *sl, int n) { if (n < sl->num_used) n = sl->num_used; + if (n < 1) + n = 1; if (sl->capacity != n) { sl->capacity = n; sl->list = tor_realloc(sl->list, sizeof(void*)*sl->capacity); |