From 764c94a4d7786ccba8fcf41cac8c7ffbc261393d Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 7 Apr 2009 11:07:34 -0700 Subject: [PATCH] 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. --- lib/cfg.c | 2 ++ 1 file changed, 2 insertions(+) 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; } -- 2.30.2