2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

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.
This commit is contained in:
Ethan Jackson
2010-10-08 22:15:26 +00:00
parent c31abb566d
commit ce5452cf78

View File

@@ -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) {