Module: kamailio
Branch: master
Commit: 6c15b875c9763013afc1aafc1ae06c96c4e2c698
URL:
https://github.com/kamailio/kamailio/commit/6c15b875c9763013afc1aafc1ae06c9…
Author: Victor Seva <vseva(a)sipwise.com>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2022-04-15T11:29:53+02:00
pv_headers: fix build warning
pvh_func.c:392:35: warning: division 'sizeof (char *) / sizeof (char)'
pvh_func.c:407:66: warning: division 'sizeof (char *) / sizeof (char)'
---
Modified: src/modules/pv_headers/pvh_func.c
---
Diff:
https://github.com/kamailio/kamailio/commit/6c15b875c9763013afc1aafc1ae06c9…
Patch:
https://github.com/kamailio/kamailio/commit/6c15b875c9763013afc1aafc1ae06c9…
---
diff --git a/src/modules/pv_headers/pvh_func.c b/src/modules/pv_headers/pvh_func.c
index 4ca72d217d..c2a3f98e41 100644
--- a/src/modules/pv_headers/pvh_func.c
+++ b/src/modules/pv_headers/pvh_func.c
@@ -389,8 +389,7 @@ int pvh_remove_header_param(struct sip_msg *msg, int idx, str *hname,
str *eleme
char *token;
char *result = (char*)pkg_malloc(elements->len - toRemove->len);
char *t = (char*)pkg_malloc(elements->len);
- int maxSize = sizeof(elements->s)/sizeof(char);
- maxSize = maxSize < elements->len?elements->len:maxSize;
+ int maxSize = elements->len;
if (result == NULL || t == NULL)
{
@@ -404,7 +403,7 @@ int pvh_remove_header_param(struct sip_msg *msg, int idx, str *hname,
str *eleme
token = strtok_r(t, ", ", &next_token);
while(token)
{
- int notTarget = strncmp(token, toRemove->s, sizeof(toRemove->s)/sizeof(char));
+ int notTarget = strncmp(token, toRemove->s, toRemove->len);
if (notTarget)
{
int n = snprintf(result + offset, maxSize - offset, "%s", token);