changeset 21021:bc34e9806879

another patch from Andrew Gaul, funny how it's been exactly a year since Mark proposed the solution: Invalid strstr call in yahoo_packet_read. Use g_strstr_len because string is not NUL terminated. Same issue as: https://sourceforge.net/tracker/?func=detail&atid=300235&aid=1580769&group_id=235
author Ka-Hing Cheung <khc@hxbc.us>
date Mon, 29 Oct 2007 04:41:10 +0000
parents f710e48fbe1b
children 9f0e2db39bc5
files libpurple/protocols/yahoo/yahoo_packet.c
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo_packet.c	Fri Oct 26 05:24:14 2007 +0000
+++ b/libpurple/protocols/yahoo/yahoo_packet.c	Mon Oct 29 04:41:10 2007 +0000
@@ -174,8 +174,7 @@
 		}
 
 		if (accept) {
-			/* TODO: strstr() should not be used here because data isn't NULL terminated */
-			delimiter = (const guchar *)strstr((char *)&data[pos], "\xc0\x80");
+			delimiter = (const guchar *)g_strstr_len((const char *)&data[pos], len - pos, "\xc0\x80");
 			if (delimiter == NULL)
 			{
 				/* Malformed packet! (It doesn't end in 0xc0 0x80) */