msgpack: silence uninitialized msg_pack_object warning
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 9 Mar 2021 21:23:37 +0000 (16:23 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 9 Mar 2021 21:25:28 +0000 (16:25 -0500)
Present in the upstream msgpack code. I couldn't find a problematic use,
but this will silence Coverity and is cleaner.

Nothing should access 'via' when the type of a msg_pack_object is NIL.

Coverity report:

1448708 Uninitialized scalar variable

The variable will contain an arbitrary value left from earlier
computations.

In template_callback_root: Use of an uninitialized variable (CWE-457)

Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I4fe63b0279ca7c3f4c34ee8762ec724a731894c5

src/vendor/msgpack/unpack.c

index b390f58684661249545c64764a37ab337165a691..6b10f05b15859bf34a70db2aa744e08ba25248c2 100644 (file)
@@ -50,7 +50,7 @@ static int template_execute(
 
 static inline msgpack_object template_callback_root(unpack_user* u)
 {
-    msgpack_object o;
+    msgpack_object o = {};
     MSGPACK_UNUSED(u);
     o.type = MSGPACK_OBJECT_NIL;
     return o;
This page took 0.033256 seconds and 4 git commands to generate.