From: Ben Pfaff Date: Tue, 7 Apr 2009 18:07:34 +0000 (-0700) Subject: cfg: Always null-terminate the cfg array. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=764c94a4d7786ccba8fcf41cac8c7ffbc261393d;p=openvswitch cfg: Always null-terminate the cfg array. Some functions depend on the cfg array being null-terminated, so be sure to make it so when modifying the array. cfg_add_entry() still doesn't sort the array, but it should. --- diff --git a/lib/cfg.c b/lib/cfg.c index 203880d2..8d9a4d09 100644 --- a/lib/cfg.c +++ b/lib/cfg.c @@ -500,6 +500,7 @@ cfg_add_entry(const char *entry_, ...) FORMAT_KEY(entry_, entry); svec_add_nocopy(&cfg, entry); + svec_terminate(&cfg); dirty = true; } @@ -510,6 +511,7 @@ cfg_del_entry(const char *entry_, ...) FORMAT_KEY(entry_, entry); svec_del(&cfg, entry); + svec_terminate(&cfg); free(entry); dirty = true; }