Module: kamailio Branch: master Commit: 89642d3cddd90ba3e3f6d310e239492634fa6405 URL: https://github.com/kamailio/kamailio/commit/89642d3cddd90ba3e3f6d310e239492634fa6405
Author: Daniel-Constantin Mierla <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: 2015-04-23T16:24:39+02:00 permissions: store src ip in zero terminated string for trusted table - it is printed as string via rpc, resulting in invalid chars in the output - reported by Emmanuel Schmidbauer, GH#137 --- Modified: modules/permissions/hash.c --- Diff: https://github.com/kamailio/kamailio/commit/89642d3cddd90ba3e3f6d310e239492634fa6405.diff Patch: https://github.com/kamailio/kamailio/commit/89642d3cddd90ba3e3f6d310e239492634fa6405.patch --- diff --git a/modules/permissions/hash.c b/modules/permissions/hash.c index 200e2c1..7b11ebd 100644 --- a/modules/permissions/hash.c +++ b/modules/permissions/hash.c @@ -155,7 +155,7 @@ int hash_table_insert(struct trusted_list** table, char* src_ip, } np->src_ip.len = strlen(src_ip); - np->src_ip.s = (char *) shm_malloc(np->src_ip.len); + np->src_ip.s = (char *) shm_malloc(np->src_ip.len+1); if (np->src_ip.s == NULL) { LM_CRIT("cannot allocate shm memory for src_ip string\n"); @@ -164,6 +164,7 @@ int hash_table_insert(struct trusted_list** table, char* src_ip, } (void) strncpy(np->src_ip.s, src_ip, np->src_ip.len); + np->src_ip.s[np->src_ip.len] = 0; if (pattern) { np->pattern = (char *) shm_malloc(strlen(pattern)+1); _______________________________________________ sr-dev mailing list [email protected] http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
