[ovs-dev] [PATCH 05/11] ovs-ofctl: Fix possible null pointer.

William Tu u9012063 at gmail.com
Sat Oct 28 17:31:52 UTC 2017


Clang reports possible null pointer of optarg as argument to strtoul.
Fix it by adding ovs_assert check.

Signed-off-by: William Tu <u9012063 at gmail.com>
---
 utilities/ovs-ofctl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 5b7f1b02104f..05c5995fa775 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -262,6 +262,7 @@ parse_options(int argc, char *argv[])
 
         switch (c) {
         case 't':
+            ovs_assert(optarg);
             timeout = strtoul(optarg, NULL, 10);
             if (timeout <= 0) {
                 ovs_fatal(0, "value %s on -t or --timeout is not at least 1",
-- 
2.7.4



More information about the dev mailing list