--- a/libpurple/protocols/oscar/odc.c Sun Apr 14 12:50:54 2013 -0700
+++ b/libpurple/protocols/oscar/odc.c Sun Apr 14 13:01:27 2013 -0700
@@ -266,7 +266,6 @@
* problems while parsing the binary data section then we stop
* parsing it, and the local user will see broken image icons.
- /* TODO: Use a length argument when looking for the <binary> tag! */
binary_start = purple_strcasestr(msg, "<binary>");
if (binary_start == NULL)
@@ -278,7 +277,6 @@
/* The embedded binary markup has a mimimum length of 29 bytes */
- /* TODO: Use a length argument when looking for the <data> tag! */
while ((tmp + 29 <= dataend) &&
purple_markup_find_tag("data", tmp, &start, &tmp, &attributes))
@@ -463,6 +461,10 @@
if (bs->offset < bs->len)
/* Waiting for more data to arrive */
+ /* TODO: Instead of null-terminating this, it would be better if we just + respected the length of the buffer when parsing it. But it doesn't + really matter and this is easy. */ + bs->data[bs->len] = '\0'; /* We have a complete ODC/OFT frame! Handle it and continue reading */
@@ -612,7 +614,7 @@
/* We have payload data! Switch to the ODC watcher to read it. */
- frame->payload.data = g_new(guint8, frame->payload.len);
+ frame->payload.data = g_new(guint8, frame->payload.len + 1); frame->payload.offset = 0;
purple_input_remove(conn->watcher_incoming);