Mercurial > pidgin.yaz
changeset 30625:24ed54cf50b9
jabber: Don't use a static array when it might not be sufficient.
JabberData:cid may come from the network, in which case the one I changed
here would result in truncation.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Thu, 17 Jun 2010 01:45:44 +0000 |
parents | 0c41b5c08cdc |
children | fcc36743697c |
files | libpurple/protocols/jabber/data.c |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/data.c Thu Jun 17 01:30:06 2010 +0000 +++ b/libpurple/protocols/jabber/data.c Thu Jun 17 01:45:44 2010 +0000 @@ -43,7 +43,7 @@ { JabberData *data; gchar *checksum; - gchar cid[256]; + gchar cid[256]; /* "Big enough" for a SHA1 hex hash value */ g_return_val_if_fail(rawdata != NULL, NULL); g_return_val_if_fail(size > 0, NULL); @@ -191,15 +191,17 @@ jabber_data_get_xhtml_im(const JabberData *data, const gchar *alt) { xmlnode *img; - char src[128]; + char *src; g_return_val_if_fail(data != NULL, NULL); g_return_val_if_fail(alt != NULL, NULL); img = xmlnode_new("img"); xmlnode_set_attrib(img, "alt", alt); - g_snprintf(src, sizeof(src), "cid:%s", data->cid); + + src = g_strconcat("cid:", data->cid, NULL); xmlnode_set_attrib(img, "src", src); + g_free(src); return img; }