Module: sip-router
Branch: master
Commit: 106ab4610b48140a5a5e99a520b53a12bd0a2478
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=106ab46…
Author: Miklos Tirpak <miklos(a)iptel.org>
Committer: Miklos Tirpak <miklos(a)iptel.org>
Date: Tue Jan 4 11:28:53 2011 +0100
cfg framework: crash when adding a new group instance
A log message trying to print a NULL variable name caused
a crash when a new group instance was added before forking
without any variable.
---
cfg/cfg_struct.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/cfg/cfg_struct.c b/cfg/cfg_struct.c
index 1cf1848..6e93379 100644
--- a/cfg/cfg_struct.c
+++ b/cfg/cfg_struct.c
@@ -876,10 +876,19 @@ int new_add_var(str *group_name, unsigned int group_id, str
*var_name,
cfg_add_var_t *add_var = NULL, **add_var_p;
int len;
- LOG(L_DBG, "DEBUG: new_add_var(): declaring a new variable instance
%.*s[%u].%.*s\n",
+ if (type && (!var_name || !val)) {
+ LOG(L_ERR, "ERROR: new_add_var(): Missing variable/value specification\n");
+ goto error;
+ }
+ if (type)
+ LOG(L_DBG, "DEBUG: new_add_var(): declaring a new variable instance
%.*s[%u].%.*s\n",
group_name->len, group_name->s,
group_id,
var_name->len, var_name->s);
+ else
+ LOG(L_DBG, "DEBUG: new_add_var(): declaring a new group instance
%.*s[%u]\n",
+ group_name->len, group_name->s,
+ group_id);
if (cfg_shmized) {
LOG(L_ERR, "ERROR: new_add_var(): too late, the configuration has already been
shmized\n");