From d0837ee5f58393a5d6586a78062aa7ca62de0737 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Wed, 27 Nov 2013 14:27:00 +0900 Subject: [PATCH] ecore_con: fix non initialized use of buf with strncpy. This fix CID 1039723. --- src/lib/ecore_con/ecore_con_socks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/ecore_con/ecore_con_socks.c b/src/lib/ecore_con/ecore_con_socks.c index 8ea64a9..d4adfdc 100644 --- a/src/lib/ecore_con/ecore_con_socks.c +++ b/src/lib/ecore_con/ecore_con_socks.c @@ -578,8 +578,8 @@ ecore_con_socks_init(void) socks = getenv("ECORE_CON_SOCKS_V5"); v5 = EINA_TRUE; } - if ((!socks) || (!socks[0]) || (strlen(socks) > 512)) return; - strncpy(buf, socks, sizeof(buf)); + if ((!socks) || (!socks[0]) || (strlen(socks) + 1 > 512)) return; + memcpy(buf, socks, strlen(socks) + 1); h = strchr(buf, '@'); /* username */ if (h && (h - buf > 0)) *h++ = 0, u = buf; -- 2.7.4