summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2020-02-24 15:09:37 +0000
committerMichael Drake <michael.drake@codethink.co.uk>2020-02-24 15:37:20 +0000
commitf840833723e3f9be668b2ee633671c726f06bd3c (patch)
tree2e2b156259c53e7dbca3a921eb6ef8a4916cabb9
parent133e00edbeca192baad67ebaa9a9356ae5788051 (diff)
downloadnetsurf-f840833723e3f9be668b2ee633671c726f06bd3c.tar.gz
netsurf-f840833723e3f9be668b2ee633671c726f06bd3c.tar.bz2
Low level cache: Squash use of uninitialised value.
Coverity issue: CID 1419828: Memory - corruptions (UNINIT) >>> Using uninitialized value "output_length".
-rw-r--r--content/llcache.c5
1 files 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;
}