(emem_store): limit how much we allocate (from Olaf Kirch)

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11512 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
2002-10-21 15:36:23 +00:00
parent cf87a976ce
commit 5ee773037f

View File

@@ -61,8 +61,10 @@ emem_store(krb5_storage *sp, const void *data, size_t size)
if(size > s->base + s->size - s->ptr){
void *base;
size_t sz, off;
sz = 2 * (size + (s->ptr - s->base)); /* XXX */
off = s->ptr - s->base;
sz = off + size;
if (sz < 4096)
sz *= 2;
base = realloc(s->base, sz);
if(base == NULL)
return 0;