Skip to content

Commit 3fd0397

Browse files
committed
libvncclient: bail out if unix socket name would overflow
Closes #291
1 parent 3304e13 commit 3fd0397

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: libvncclient/sockets.c

+4
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,10 @@ ConnectClientToUnixSock(const char *sockFile)
461461
int sock;
462462
struct sockaddr_un addr;
463463
addr.sun_family = AF_UNIX;
464+
if(strlen(sockFile) + 1 > sizeof(addr.sun_path)) {
465+
rfbClientErr("ConnectToUnixSock: socket file name too long\n");
466+
return -1;
467+
}
464468
strcpy(addr.sun_path, sockFile);
465469

466470
sock = socket(AF_UNIX, SOCK_STREAM, 0);

0 commit comments

Comments
 (0)