Fixed a NUL-termination bug in SOCKET-BIND and SOCKET-CONNECT.
authorArto Bendiken <arto@bendiken.net>
Tue, 14 Oct 2014 21:14:45 +0000 (21:14 +0000)
committerArto Bendiken <arto@bendiken.net>
Tue, 14 Oct 2014 21:39:58 +0000 (21:39 +0000)
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

index 9c360d5..9202122 100755 (executable)
@@ -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));