common: Avoid undefined behavior.
authorJustus Winter <justus@g10code.com>
Thu, 19 Nov 2015 15:13:55 +0000 (16:13 +0100)
committerJustus Winter <justus@g10code.com>
Thu, 19 Nov 2015 15:13:55 +0000 (16:13 +0100)
* common/iobuf.c (iobuf_esopen): Initialize 'len' as 'file_es_filter'
will make use of it.
--
Found using the Clang Static Analyzer.

Signed-off-by: Justus Winter <justus@g10code.com>
common/iobuf.c

index 12affcb..d49de96 100644 (file)
@@ -1391,7 +1391,7 @@ iobuf_esopen (estream_t estream, const char *mode, int keep_open)
 {
   iobuf_t a;
   file_es_filter_ctx_t *fcx;
-  size_t len;
+  size_t len = 0;
 
   a = iobuf_alloc (strchr (mode, 'w') ? IOBUF_OUTPUT : IOBUF_INPUT,
                   IOBUF_BUFFER_SIZE);