From: Ethan Jackson Date: Fri, 8 Oct 2010 22:15:26 +0000 (+0000) Subject: lib: ofp-parse segfaults if required argument isn't specified X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce5452cf78f96b924a11d02ad57b6b046b1e123a;p=openvswitch lib: ofp-parse segfaults if required argument isn't specified Running ovs-ofctl add-flow br0 "in_port=3 actions=resubmit" would segfault instead of reporting an error. --- diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index 7a888801..e6af0362 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -40,6 +40,10 @@ str_to_u32(const char *str) char *tail; uint32_t value; + if (!str) { + ovs_fatal(0, "missing required numeric argument"); + } + errno = 0; value = strtoul(str, &tail, 0); if (errno == EINVAL || errno == ERANGE || *tail) {