changeset 5315:b1c430fbf9d5

[gaim-migrate @ 5687] Message bodies without a trailing newline will now be parsed for key: value pairs without segfaults and buffer overruns. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 06 May 2003 08:53:52 +0000
parents 1f901484599d
children d5690ed70085
files src/protocols/msn/msg.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/msg.c	Tue May 06 05:48:03 2003 +0000
+++ b/src/protocols/msn/msg.c	Tue May 06 08:53:52 2003 +0000
@@ -25,7 +25,7 @@
 #define GET_NEXT(tmp) \
 	while (*(tmp) && *(tmp) != ' ' && *(tmp) != '\r') \
 		(tmp)++; \
-	*(tmp)++ = '\0'; \
+	if (*(tmp) != '\0') *(tmp)++ = '\0'; \
 	if (*(tmp) == '\n') *(tmp)++; \
 	while (*(tmp) && *(tmp) == ' ') \
 		(tmp)++
@@ -33,7 +33,7 @@
 #define GET_NEXT_LINE(tmp) \
 	while (*(tmp) && *(tmp) != '\r') \
 		(tmp)++; \
-	*(tmp)++ = '\0'; \
+	if (*(tmp) != '\0') *(tmp)++ = '\0'; \
 	if (*(tmp) == '\n') *(tmp)++
 
 /*
@@ -501,7 +501,7 @@
 
 	table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
 
-	while (*s != '\r') {
+	while (*s != '\r' && *s != '\0') {
 		char *key, *value;
 
 		key = s;