changeset 9823:54377b120d19

[gaim-migrate @ 10694] This is supposed to fix an MSN thing. I think it's from SUSE. If this is wrong, then someone that knows something about MSN should probably do something about it. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 22 Aug 2004 17:31:37 +0000
parents 524cd6d1496e
children 94910b9520cf
files src/protocols/msn/object.c
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/object.c	Sun Aug 22 17:25:59 2004 +0000
+++ b/src/protocols/msn/object.c	Sun Aug 22 17:31:37 2004 +0000
@@ -35,11 +35,18 @@
 	if ((tag = strstr(str, id "=\"")) != NULL) \
 	{ \
 		char buf[16]; \
+		size_t offset; \
 		tag += strlen(id "=\""); \
 		c = strchr(tag, '"'); \
-		strncpy(buf, tag, c - tag); \
-		buf[c - tag] = '\0'; \
-		obj->field = atoi(buf); \
+		if (c != NULL) \
+		{ \
+			memset(buf, 0, sizeof(buf)); \
+			offset = c - tag; \
+			if (offset >= sizeof(buf)) \
+				offset = sizeof(buf) - 1; \
+			strncpy(buf, tag, offset); \
+			obj->field = atoi(buf); \
+		} \
 	}
 
 static GList *local_objs;