Skip to content

Commit

Permalink
unix-socket: Check minimal length of socket path
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Friesse <[email protected]>
  • Loading branch information
jfriesse committed Mar 2, 2022
1 parent e1d5914 commit c879b39
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions qdevices/unix-socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ unix_socket_server_create(const char *path, int non_blocking, int backlog)
int s;
struct sockaddr_un sun;

if (strlen(path) >= sizeof(sun.sun_path)) {
if (strlen(path) >= sizeof(sun.sun_path) || strlen(path) == 0) {
errno = ENAMETOOLONG;
return (-1);
}
Expand Down Expand Up @@ -91,7 +91,7 @@ unix_socket_client_create(const char *path, int non_blocking)
int s;
struct sockaddr_un sun;

if (strlen(path) >= sizeof(sun.sun_path)) {
if (strlen(path) >= sizeof(sun.sun_path) || strlen(path) == 0) {
errno = ENAMETOOLONG;
return (-1);
}
Expand Down

0 comments on commit c879b39

Please sign in to comment.