Check string-length of bind-socket in Scheme.
This commit is contained in:
parent
925ca7b349
commit
a2eb80d3fe
|
@ -199,13 +199,17 @@
|
|||
(error "bind-socket: socket-address expected ~s" name))
|
||||
(else
|
||||
(let ((family (socket:family sock)))
|
||||
(if (not (= family (socket-address:family name)))
|
||||
(error
|
||||
"bind-socket: trying to bind incompatible address to socket ~s"
|
||||
name)
|
||||
(%bind (socket->fdes sock)
|
||||
family
|
||||
(socket-address:address name)))))))
|
||||
(cond ((not (= family (socket-address:family name)))
|
||||
(error
|
||||
"bind-socket: trying to bind incompatible address to socket ~s"
|
||||
name))
|
||||
((and (= family address-family/unix)
|
||||
(> (string-length name) 107))
|
||||
(error "bind-socket: path too long" name))
|
||||
(else
|
||||
%bind (socket->fdes sock)
|
||||
family
|
||||
(socket-address:address name)))))))
|
||||
|
||||
(import-os-error-syscall %bind (sockfd family name) "scheme_bind")
|
||||
|
||||
|
|
|
@ -45,8 +45,7 @@ s48_value scheme_bind(s48_value sock, s48_value family, s48_value scheme_name)
|
|||
memset(&name, 0, sizeof(name));
|
||||
|
||||
name.sun_family=AF_UNIX;
|
||||
if (scheme_length>=(108-1)) /* save space for \0 */
|
||||
return(-1); // TODO: check this in scheme !
|
||||
|
||||
strncpy(name.sun_path,
|
||||
s48_extract_string(scheme_name),
|
||||
scheme_length); /* copy to c string */
|
||||
|
|
Loading…
Reference in New Issue