Skip to content

Commit

Permalink
Merge pull request #4571 from nextcloud/backport/4562/stable-3.5
Browse files Browse the repository at this point in the history
[stable-3.5] Fix crash caused by overflow in FinderSyncExtension
  • Loading branch information
claucambra authored May 23, 2022
2 parents 45a57e8 + d12d4a8 commit 6805228
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6805228

Please sign in to comment.