[ovs-dev] [coverity 13/14] ovs-vsctl: Check "key" is valid before dereferencing in get_external_id().

Justin Pettit jpettit at nicira.com
Tue Feb 22 01:44:56 UTC 2011


Coverity #10716
---
 utilities/ovs-vsctl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index 3a93ef3..efc298a 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -1405,7 +1405,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;
         }
-- 
1.7.1





More information about the dev mailing list