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).
This commit is contained in:
Arto Bendiken 2014-10-14 21:14:45 +00:00
parent 633c3a5f63
commit fa48714dd8

View file

@ -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));