Module: kamailio Branch: master Commit: 25daa0445ebc611cda3e47fd34aefc74494550d7 URL: https://github.com/kamailio/kamailio/commit/25daa0445ebc611cda3e47fd34aefc74...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2025-05-27T08:59:16+02:00
pv_headers: set value after checking if src is set
---
Modified: src/modules/pv_headers/pvh_str.c
---
Diff: https://github.com/kamailio/kamailio/commit/25daa0445ebc611cda3e47fd34aefc74... Patch: https://github.com/kamailio/kamailio/commit/25daa0445ebc611cda3e47fd34aefc74...
---
diff --git a/src/modules/pv_headers/pvh_str.c b/src/modules/pv_headers/pvh_str.c index 28908a37069..1916f93e002 100644 --- a/src/modules/pv_headers/pvh_str.c +++ b/src/modules/pv_headers/pvh_str.c @@ -50,11 +50,12 @@ int pvh_str_free(str *s)
int pvh_str_copy(str *dst, str *src, unsigned int max_size) { - unsigned int src_len = src->len + 1 >= max_size ? max_size - 1 : src->len; + unsigned int src_len = 0;
if(src == NULL || dst == NULL || src->len <= 0) return -1;
+ src_len = src->len + 1 >= max_size ? max_size - 1 : src->len; memset(dst->s, 0, dst->len); memcpy(dst->s, src->s, src_len); dst->s[src_len] = '\0';