Skip to content
Permalink
Browse files Browse the repository at this point in the history
libvncclient: bail out if unix socket name would overflow
Closes #291
  • Loading branch information
bk138 committed Apr 6, 2019
1 parent 3304e13 commit 3fd0397
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libvncclient/sockets.c
Expand Up @@ -461,6 +461,10 @@ ConnectClientToUnixSock(const char *sockFile)
int sock;
struct sockaddr_un addr;
addr.sun_family = AF_UNIX;
if(strlen(sockFile) + 1 > sizeof(addr.sun_path)) {
rfbClientErr("ConnectToUnixSock: socket file name too long\n");
return -1;
}
strcpy(addr.sun_path, sockFile);

sock = socket(AF_UNIX, SOCK_STREAM, 0);
Expand Down

0 comments on commit 3fd0397

Please sign in to comment.