changeset 9739:35f22ba01bd7

[gaim-migrate @ 10603] bug fix. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 11 Aug 2004 18:05:10 +0000
parents d9e8d420e9fe
children 2bb5e2cd64bd
files src/protocols/msn/slp.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/slp.c	Wed Aug 11 00:20:28 2004 +0000
+++ b/src/protocols/msn/slp.c	Wed Aug 11 18:05:10 2004 +0000
@@ -645,8 +645,12 @@
 			if ((c = strchr(status, '\r')) || (c = strchr(status, '\n')) ||
 				(c = strchr(status, '\0')))
 			{
-				strncpy(temp, status, c - status);
-				temp[c - status] = '\0';
+				size_t offset =  c - status;
+				if (offset >= sizeof(temp))
+					offset = sizeof(temp) - 1;
+		      
+				strncpy(temp, status, offset);
+				temp[offset] = '\0';
 			}
 
 			gaim_debug_error("msn", "Received non-OK result: %s\n", temp);