changeset 31786:a48d58e0512b

Bounds check an OSCAR normalization. (EFF)
author Ethan Blanton <elb@pidgin.im>
date Thu, 11 Aug 2011 16:17:29 +0000
parents 0d94c49f9545
children 32ced32caca7
files libpurple/protocols/oscar/oscar.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/oscar.c	Thu Aug 11 16:13:15 2011 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Thu Aug 11 16:17:29 2011 +0000
@@ -5651,7 +5651,10 @@
 
 	tmp1 = g_utf8_strdown(buf, -1);
 	tmp2 = g_utf8_normalize(tmp1, -1, G_NORMALIZE_DEFAULT);
-	strcpy(buf, tmp2);
+	if (strlen(tmp2) > sizeof(buf) - 1) {
+		purple_debug_error("oscar", "normalized string exceeds buffer length!\n");
+	}
+	g_strlcpy(buf, tmp2, sizeof(buf));
 	g_free(tmp2);
 	g_free(tmp1);