Skip to content

Commit

Permalink
presence_xml: fix possible buffer overflow
Browse files Browse the repository at this point in the history
Fixes Coverity CID #40877
  • Loading branch information
razvancrainea committed Jul 22, 2020
1 parent 5a094bf commit f38dec2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/presence_xml/notify_body.c
Expand Up @@ -941,6 +941,7 @@ str* get_final_notify_body( subs_t *subs, str* notify_body, xmlNodePtr rule_node
char* deviceID = NULL;
char* content = NULL;
char all_name[20];
int namelen;

strcpy(all_name, "all-");

Expand Down Expand Up @@ -980,7 +981,12 @@ str* get_final_notify_body( subs_t *subs, str* notify_body, xmlNodePtr rule_node
continue;

LM_DBG("transf_node->name:%s\n",node->name);
namelen = strlen((char *)node->name + 8);

if (namelen >= 15) {
LM_ERR("node name too large (%d) [%s]\n", namelen, (char *)node->name + 8);
continue;
}
strcpy((char*)name ,(char*)(node->name + 8));
strcpy(all_name+4, name);

Expand Down

0 comments on commit f38dec2

Please sign in to comment.