|
@@ -163,6 +163,12 @@ int db_bind_mod(const str* mod, db_func_t* mydbf)
|
|
LM_CRIT("null dbf parameter\n");
|
|
LM_CRIT("null dbf parameter\n");
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /* for safety we initialize mydbf with 0 (this will cause
|
|
|
|
+ * a segfault immediately if someone tries to call a function
|
|
|
|
+ * from it without checking the return code from bind_dbmod */
|
|
|
|
+ memset((void*)mydbf, 0, sizeof(db_func_t));
|
|
|
|
+
|
|
if (mod->len > MAX_URL_LENGTH)
|
|
if (mod->len > MAX_URL_LENGTH)
|
|
{
|
|
{
|
|
LM_ERR("SQL URL too long\n");
|
|
LM_ERR("SQL URL too long\n");
|
|
@@ -178,11 +184,6 @@ int db_bind_mod(const str* mod, db_func_t* mydbf)
|
|
memcpy(name+3, mod->s, mod->len);
|
|
memcpy(name+3, mod->s, mod->len);
|
|
name[mod->len+3] = 0;
|
|
name[mod->len+3] = 0;
|
|
|
|
|
|
- /* for safety we initialize mydbf with 0 (this will cause
|
|
|
|
- * a segfault immediately if someone tries to call a function
|
|
|
|
- * from it without checking the return code from bind_dbmod */
|
|
|
|
- memset((void*)mydbf, 0, sizeof(db_func_t));
|
|
|
|
-
|
|
|
|
p = strchr(name, ':');
|
|
p = strchr(name, ':');
|
|
if (p) {
|
|
if (p) {
|
|
len = p - name;
|
|
len = p - name;
|