Module: sip-router
Branch: master
Commit: 8e400e86fe48202b05dd4e439a208945bb233353
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8e400e8…
Author: Timo Reimann <timo.reimann(a)1und1.de>
Committer: Timo Reimann <timo.reimann(a)1und1.de>
Date: Mon Aug 29 18:09:51 2011 +0200
modules_k/dialog: Show error message and return from function
prematurely if trying to remove a non-existing dialog variable.
- Fixes a segfaulting bug.
---
modules_k/dialog/dlg_var.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/modules_k/dialog/dlg_var.c b/modules_k/dialog/dlg_var.c
index 6483233..51ce8eb 100644
--- a/modules_k/dialog/dlg_var.c
+++ b/modules_k/dialog/dlg_var.c
@@ -149,9 +149,14 @@ int set_dlg_variable_unsafe(struct dlg_cell *dlg, str *key, str *val,
int new)
}
}
- /* not found -> simply add a new one */
+ /* not found: */
- /* insert at the beginning of the list */
+ if (!var) {
+ LM_ERR("dialog variable <%.*s> does not exist in variable list\n",
key->len, key->s);
+ return -1;
+ }
+
+ /* insert a new one at the beginning of the list */
var->next = *var_list;
*var_list = var;