From 1f04073e7c5de434a3489ffbb5148454a5b4dc5a Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 18 May 2022 16:08:12 +0200 Subject: [PATCH] Fix possible overflow on lineWritten Signed-off-by: Claudio Cambra --- .../OwnCloudFinderSync/FinderSyncExt/LocalSocketClient.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/LocalSocketClient.m b/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/LocalSocketClient.m index fb3c376383c7..37c39cc7b24c 100644 --- a/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/LocalSocketClient.m +++ b/shell_integration/MacOSX/OwnCloudFinderSync/FinderSyncExt/LocalSocketClient.m @@ -207,9 +207,9 @@ - (void)writeToSocket NSLog(@"About to write %li bytes from outbuffer to socket.", [self.outBuffer length]); long bytesWritten = write(self.sock, [self.outBuffer bytes], [self.outBuffer length]); - char lineWritten[4096]; + char lineWritten[[self.outBuffer length]]; memcpy(lineWritten, [self.outBuffer bytes], [self.outBuffer length]); - NSLog(@"Wrote %li bytes to socket. Line was: '%@'", bytesWritten, [NSString stringWithUTF8String:lineWritten]); + NSLog(@"Wrote %li bytes to socket. Line written was: '%@'", bytesWritten, [NSString stringWithUTF8String:lineWritten]); if(bytesWritten == 0) { // 0 means we reached "end of file" and thus the socket was closed. So let's restart it