gui: linux: fix the string buffer overflow better
authorFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 7 Nov 2012 16:36:12 +0000 (17:36 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 7 Nov 2012 16:36:27 +0000 (17:36 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
gui/linux-gtk/src/ipc.c

index aecf42b..bceecaa 100644 (file)
@@ -605,7 +605,7 @@ gui_itoa(int i, char *buf)
 
   if (snprintf(buf, sizeof(tmp), "%hd", i)) {
     /* This shitty string needs to be converted to UTF-8 */
-    strcpy(tmp, g_locale_to_utf8(buf, -1, NULL, NULL, NULL));
+    snprintf(tmp, sizeof(tmp), "%s", g_locale_to_utf8(buf, -1, NULL, NULL, NULL));
     strcpy(buf, tmp);
     return 1;
     //return ret;