ovs-vsctl: Check "key" is valid before dereferencing in get_external_id().
authorJustin Pettit <jpettit@nicira.com>
Tue, 22 Feb 2011 01:19:18 +0000 (17:19 -0800)
committerJustin Pettit <jpettit@nicira.com>
Tue, 22 Feb 2011 18:14:53 +0000 (10:14 -0800)
Coverity #10716

utilities/ovs-vsctl.c

index 31c485bab7afc9ccf6b540c9f65eff41cf828c72..9fca1c8e3bdad67817cf1c258d9ac450e8d982e9 100644 (file)
@@ -1403,7 +1403,7 @@ get_external_id(char **keys, char **values, size_t n,
         if (!key && !strncmp(keys[i], prefix, prefix_len)) {
             svec_add_nocopy(&svec, xasprintf("%s=%s",
                                              keys[i] + prefix_len, values[i]));
-        } else if (key_matches(keys[i], prefix, prefix_len, key)) {
+        } else if (key && key_matches(keys[i], prefix, prefix_len, key)) {
             svec_add(&svec, values[i]);
             break;
         }