]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
varlink: initialize Varlink with 0
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 16 May 2019 03:35:10 +0000 (12:35 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 16 May 2019 16:51:33 +0000 (18:51 +0200)
Closes oss-fuzz#14688.

src/shared/varlink.c
test/fuzz/fuzz-varlink/oss-fuzz-14688 [new file with mode: 0644]

index 5c5f5077f9b85c97f90cabeed57373155a31ef05..7719a7d0214eca39afb6d8dca72159a703baa6be 100644 (file)
@@ -246,7 +246,8 @@ static int varlink_new(Varlink **ret) {
 
         assert(ret);
 
-        v = new(Varlink, 1);
+        /* Here use new0 as the below structured initializer is nested. */
+        v = new0(Varlink, 1);
         if (!v)
                 return -ENOMEM;
 
diff --git a/test/fuzz/fuzz-varlink/oss-fuzz-14688 b/test/fuzz/fuzz-varlink/oss-fuzz-14688
new file mode 100644 (file)
index 0000000..9d615db
--- /dev/null
@@ -0,0 +1 @@
+                                                                                                      {"method":"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       "}\0                                                                       
\ No newline at end of file