From f840833723e3f9be668b2ee633671c726f06bd3c Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 24 Feb 2020 15:09:37 +0000 Subject: Low level cache: Squash use of uninitialised value. Coverity issue: CID 1419828: Memory - corruptions (UNINIT) >>> Using uninitialized value "output_length". --- content/llcache.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/content/llcache.c b/content/llcache.c index 9c74fbd6e..2eb471d54 100644 --- a/content/llcache.c +++ b/content/llcache.c @@ -1364,7 +1364,6 @@ llcache_serialise_metadata(llcache_object *object, /* SSL certificates */ for (hloop = 0; hloop < cert_chain_depth; hloop++) { - size_t output_length; nsuerror res; /* Certificate error code */ @@ -1381,7 +1380,7 @@ llcache_serialise_metadata(llcache_object *object, /* DER certificate data in base64 encoding */ if (object->chain->certs[hloop].der != NULL) { - output_length = datasize; + size_t output_length = datasize; res = nsu_base64_encode( object->chain->certs[hloop].der, object->chain->certs[hloop].der_length, @@ -1397,8 +1396,8 @@ llcache_serialise_metadata(llcache_object *object, use++; /* allow for null */ if (use > datasize) goto overflow; - *(op + output_length) = 0; op += use; + *(op - 1) = 0; datasize -= use; } -- cgit v1.2.3