changeset 25557:fbcb4088d923

Make sure that the chat room name is NUL-terminated when it is truncated or exactly 128 chars. This came out of the veracode analysis.
author Daniel Atallah <daniel.atallah@gmail.com>
date Sat, 02 May 2009 19:21:11 +0000
parents 0d7f02640e2b
children d8ce4de7137f
files libpurple/protocols/oscar/family_oservice.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/family_oservice.c	Sat May 02 17:43:14 2009 +0000
+++ b/libpurple/protocols/oscar/family_oservice.c	Sat May 02 19:21:11 2009 +0000
@@ -151,7 +151,8 @@
 
 	memset(&csi, 0, sizeof(csi));
 	csi.exchange = exchange;
-	strncpy(csi.name, roomname, sizeof(csi.name));
+	strncpy(csi.name, roomname, sizeof(csi.name) - 1);
+	csi.name[sizeof(csi.name) - 1] = '\0';
 	csi.instance = instance;
 
 	/*