vswitch: Don't pass null pointer to stat().
authorBen Pfaff <blp@nicira.com>
Mon, 6 Jul 2009 23:20:46 +0000 (16:20 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 6 Jul 2009 23:35:04 +0000 (16:35 -0700)
If no CA certificate is defined then cacert_file is null.  The kernel
kindly tolerates this but we should not do it anyhow.

Found with valgrind.

vswitchd/bridge.c

index b222152dba4271dbb963f17da4c78eff09b639b2..cadefeebb54cb9bce4b1f4c4032a87c621d1f169 100644 (file)
@@ -345,7 +345,7 @@ bridge_configure_ssl(void)
      * the old certificate will still be trusted until vSwitch is
      * restarted.  We may want to address this in vconn's SSL library. */
     if (config_string_change("ssl.ca-cert", &cacert_file)
-            || (stat(cacert_file, &s) && errno == ENOENT)) {
+        || (cacert_file && stat(cacert_file, &s) && errno == ENOENT)) {
         vconn_ssl_set_ca_cert_file(cacert_file,
                                    cfg_get_bool(0, "ssl.bootstrap-ca-cert"));
     }