From: Prateek Thakur Date: Fri, 5 Aug 2016 09:08:13 +0000 (+0530) Subject: ecore_con_local: Add NULL termination X-Git-Tag: accepted/tizen/common/20160826.142838~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=171a558b1b7699dc5bcfbaff6de552dbc01668ae;p=platform%2Fupstream%2Fefl.git ecore_con_local: Add NULL termination Copying from string 'buf' of length 4095 to '&socket_unix.sun_path[0]' may form a non-terminated C string of size 108. So added null termination. Change-Id: Icdd2cd4eaf213852196cf551ee7d3ef5a252f8ee Signed-off-by: Prateek Thakur --- diff --git a/src/lib/ecore_con/ecore_con_local.c b/src/lib/ecore_con/ecore_con_local.c old mode 100644 new mode 100755 index dc81334..cadd551 --- a/src/lib/ecore_con/ecore_con_local.c +++ b/src/lib/ecore_con/ecore_con_local.c @@ -259,7 +259,8 @@ ecore_con_local_connect(Ecore_Con_Server *obj, } else { - strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); + strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path) - 1); + socket_unix.sun_path[sizeof(socket_unix.sun_path) - 1] = '\0'; socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix); } @@ -419,7 +420,8 @@ start: else { abstract_socket = EINA_FALSE; - strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); + strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path) - 1); + socket_unix.sun_path[sizeof(socket_unix.sun_path) - 1] = '\0'; socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix); }