Skip to content

Commit eeb331c

Browse files
committed
presence: fix winfo XML overflow on long URIs
1 parent bd32a79 commit eeb331c

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

modules/presence/notify.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,7 +2336,6 @@ str* create_winfo_xml(watcher_t* watchers, char* version,
23362336
xmlDocPtr doc = NULL;
23372337
xmlNodePtr root_node = NULL, node = NULL;
23382338
xmlNodePtr w_list_node = NULL;
2339-
char content[200];
23402339
str *body= NULL;
23412340
char* buffer= NULL;
23422341
watcher_t* w;
@@ -2397,15 +2396,13 @@ str* create_winfo_xml(watcher_t* watchers, char* version,
23972396
w= watchers->next;
23982397
while(w)
23992398
{
2400-
strncpy( content,w->uri.s, w->uri.len);
2401-
content[ w->uri.len ]='\0';
2402-
node = xmlNewChild(w_list_node, NULL, BAD_CAST "watcher",
2403-
BAD_CAST content) ;
2399+
node = xmlNewChild(w_list_node, NULL, BAD_CAST "watcher", NULL) ;
24042400
if( node ==NULL)
24052401
{
24062402
LM_ERR("while adding child\n");
24072403
goto error;
24082404
}
2405+
xmlNodeSetContentLen(node, BAD_CAST w->uri.s, w->uri.len);
24092406
if(xmlNewProp(node, BAD_CAST "id", BAD_CAST w->id.s)== NULL)
24102407
{
24112408
LM_ERR("while adding new attribute\n");

0 commit comments

Comments
 (0)