Mercurial > pidgin
comparison libpurple/xmlnode.c @ 28726:f6f35d5960e9
Use g_strndup() for great justice.
| author | Paul Aurich <paul@darkrain42.org> |
|---|---|
| date | Tue, 01 Dec 2009 02:54:22 +0000 |
| parents | f1437342cc0e |
| children | 981374c7308b |
comparison
equal
deleted
inserted
replaced
| 28719:51d82a66e247 | 28726:f6f35d5960e9 |
|---|---|
| 586 for(i=0; i < nb_attributes * 5; i+=5) { | 586 for(i=0; i < nb_attributes * 5; i+=5) { |
| 587 const char *name = (const char *)attributes[i]; | 587 const char *name = (const char *)attributes[i]; |
| 588 const char *prefix = (const char *)attributes[i+1]; | 588 const char *prefix = (const char *)attributes[i+1]; |
| 589 char *txt; | 589 char *txt; |
| 590 int attrib_len = attributes[i+4] - attributes[i+3]; | 590 int attrib_len = attributes[i+4] - attributes[i+3]; |
| 591 char *attrib = g_malloc(attrib_len + 1); | 591 char *attrib = g_strndup(attributes[i+3], attrib_len); |
| 592 memcpy(attrib, attributes[i+3], attrib_len); | |
| 593 attrib[attrib_len] = '\0'; | |
| 594 txt = attrib; | 592 txt = attrib; |
| 595 attrib = purple_unescape_html(txt); | 593 attrib = purple_unescape_html(txt); |
| 596 g_free(txt); | 594 g_free(txt); |
| 597 xmlnode_set_attrib_full(node, name, NULL, prefix, attrib); | 595 xmlnode_set_attrib_full(node, name, NULL, prefix, attrib); |
| 598 g_free(attrib); | 596 g_free(attrib); |
