From fa48714dd86d4bf2c3c1f0210cca3e7875771e92 Mon Sep 17 00:00:00 2001 From: Arto Bendiken Date: Tue, 14 Oct 2014 21:14:45 +0000 Subject: [PATCH] Fixed a NUL-termination bug in SOCKET-BIND and SOCKET-CONNECT. The backslash in '\0' got lost on the way to the generated C file (build/ext/sockets.c). There may be more of these issues elsewhere in the code base. This resolves CIDs 66405 and 66413 (Buffer not null terminated). --- contrib/sockets/sockets.lisp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/sockets/sockets.lisp b/contrib/sockets/sockets.lisp index 9c360d555..9202122ab 100755 --- a/contrib/sockets/sockets.lisp +++ b/contrib/sockets/sockets.lisp @@ -845,7 +845,7 @@ also known as unix-domain sockets.")) ##endif sockaddr.sun_family = #2; strncpy(sockaddr.sun_path,#1,sizeof(sockaddr.sun_path)); - sockaddr.sun_path[sizeof(sockaddr.sun_path)-1] = '\0'; + sockaddr.sun_path[sizeof(sockaddr.sun_path)-1] = 0; ecl_disable_interrupts(); output = bind(#0,(struct sockaddr*)&sockaddr, sizeof(struct sockaddr_un)); @@ -895,7 +895,7 @@ also known as unix-domain sockets.")) ##endif sockaddr.sun_family = #1; strncpy(sockaddr.sun_path,#2,sizeof(sockaddr.sun_path)); - sockaddr.sun_path[sizeof(sockaddr.sun_path)-1] = '\0'; + sockaddr.sun_path[sizeof(sockaddr.sun_path)-1] = 0; ecl_disable_interrupts(); output = connect(#0,(struct sockaddr*)&sockaddr, sizeof(struct sockaddr_un));