Module: kamailio Branch: master Commit: 2cebd46f8f2dc3f87c9cfd2054976e347aa75ace URL: https://github.com/kamailio/kamailio/commit/2cebd46f8f2dc3f87c9cfd2054976e34...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2022-09-01T10:53:54+02:00
dialog: remove strlen() checks when setting a variable
- assumed key->s and val->s are 0-terminated, which may not be the case
---
Modified: src/modules/dialog/dlg_var.c
---
Diff: https://github.com/kamailio/kamailio/commit/2cebd46f8f2dc3f87c9cfd2054976e34... Patch: https://github.com/kamailio/kamailio/commit/2cebd46f8f2dc3f87c9cfd2054976e34...
---
diff --git a/src/modules/dialog/dlg_var.c b/src/modules/dialog/dlg_var.c index 6c4da06742..ef73c022d0 100644 --- a/src/modules/dialog/dlg_var.c +++ b/src/modules/dialog/dlg_var.c @@ -352,7 +352,7 @@ int get_dlg_variable_uintval(struct dlg_cell *dlg, str *key, unsigned int *uval) int set_dlg_variable(struct dlg_cell *dlg, str *key, str *val) { int ret = -1; - if( !dlg || !key || key->len > strlen(key->s) || (val && val->len > strlen(val->s))) + if( !dlg || !key || !key->s || key->len<=0 ) { LM_ERR("BUG - bad parameters\n"); return -1;