зеркало из https://github.com/nextcloud/desktop.git
Allocate new unsigned char buffer for processed line in heap, fixing crash
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Родитель
4d359bdb2a
Коммит
49a9f7f263
|
@ -343,9 +343,10 @@
|
|||
|
||||
if (firstSeparatorIndex.location == NSNotFound) {
|
||||
NSLog(@"No separator found. Creating new buffer qith space for null terminator.");
|
||||
unsigned char newBuffer[inBufferLength + 1];
|
||||
memcpy(&newBuffer, buffer, inBufferLength);
|
||||
buffer = &newBuffer[0];
|
||||
|
||||
unsigned char *newBuffer = malloc(sizeof(unsigned char) * (inBufferLength + 1));
|
||||
memcpy(newBuffer, buffer, inBufferLength);
|
||||
buffer = newBuffer;
|
||||
nullTerminatorIndex = inBufferLength;
|
||||
} else {
|
||||
nullTerminatorIndex = firstSeparatorIndex.location;
|
||||
|
|
Загрузка…
Ссылка в новой задаче