You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
python-dmidecode/SOURCES/0008-fix-src-dmidecodemodul...

38 lines
1.3 KiB

From 8ae11992db2a5b338c4d28e44174f57c37f020e8 Mon Sep 17 00:00:00 2001
From: Coiby Xu <coiby.xu@gmail.com>
Date: Tue, 15 Jun 2021 11:09:33 +0800
Subject: [PATCH 8/8] fix "src/dmidecodemodule.c:828:9
warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL opt where
non-null expected"
Fix the following error found by covscan,
Error: GCC_ANALYZER_WARNING (CWE-688): [#def20]
python-dmidecode-3.12.2/src/dmidecodemodule.c:828:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL opt where non-null expected
/usr/include/python3.9/Python.h:30: included_from: Included from here.
python-dmidecode-3.12.2/src/dmidecodemodule.c:42: included_from: Included from here.
/usr/include/string.h:61:14: note: argument 1 of memset must be non-null
Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
---
src/dmidecodemodule.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/dmidecodemodule.c b/src/dmidecodemodule.c
index b73811e..44ef7aa 100644
--- a/src/dmidecodemodule.c
+++ b/src/dmidecodemodule.c
@@ -825,6 +825,9 @@ initdmidecodemod(void)
xmlXPathInit();
opt = (options *) malloc(sizeof(options)+2);
+ if (opt == NULL)
+ MODINITERROR;
+
memset(opt, 0, sizeof(options)+2);
init(opt);
#ifdef IS_PY3K
--
2.31.1