From: Justin Pettit Date: Fri, 8 Oct 2010 06:51:02 +0000 (-0700) Subject: ovs-openflowd: Don't segfault when no controllers specified X-Git-Tag: v1.1.0~1029 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=c5cd8b2ef14fa258f57ac5046ca3e85d97cd7650;p=sliver-openvswitch.git ovs-openflowd: Don't segfault when no controllers specified If no controllers are specified on the command-line, ovs-openflowd adds a couple of its own. The code that accounts for the controllers correctly allocated space for them, but used the command-line count to determine how many to set. This led to a segfault when later code tried to dereference them. Reported-by: Derek Cormier --- diff --git a/AUTHORS b/AUTHORS index 3d9ddd336..3364fa2b8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -39,6 +39,7 @@ Brad Hall brad@nicira.com Brandon Heller brandonh@stanford.edu Bryan Fulton bryan@nicira.com Cedric Hobbs cedric@nicira.com +Derek Cormier derek.cormier@lab.ntt.co.jp Ghanem Bahri bahri.ghanem@gmail.com Henrik Amren henrik@nicira.com Jad Naous jnaous@gmail.com diff --git a/utilities/ovs-openflowd.c b/utilities/ovs-openflowd.c index 945b11d05..45333fd14 100644 --- a/utilities/ovs-openflowd.c +++ b/utilities/ovs-openflowd.c @@ -457,11 +457,9 @@ parse_options(int argc, char *argv[], struct ofsettings *s) /* Set up controllers. */ s->n_controllers = controllers.n; s->controllers = xmalloc(s->n_controllers * sizeof *s->controllers); - if (argc > 1) { - for (i = 0; i < s->n_controllers; i++) { - s->controllers[i] = controller_opts; - s->controllers[i].target = controllers.names[i]; - } + for (i = 0; i < s->n_controllers; i++) { + s->controllers[i] = controller_opts; + s->controllers[i].target = controllers.names[i]; } /* Sanity check. */