mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Avoid variable-length arrays in C.
This commit is contained in:
1 parent
2f16e3f526
commit
8ec5f0ca3c
1 file changed
+4
-2
@@ -47,11 +47,13 @@ NSString *temporaryFilename(NSString *base)
|
||||
{
|
||||
NSString *template = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.XXXXXXXXXX", base]];
|
||||
const char *fsrepr = [template fileSystemRepresentation];
|
||||
char buffer[strlen(fsrepr)+1];
|
||||
char *buffer = (char *)malloc(strlen(fsrepr) + 1);
|
||||
strcpy(buffer, fsrepr);
|
||||
|
||||
// mkstemp() can't be used, beause it returns a file descriptor, and XAR API requires a filename
|
||||
return stringWithFileSystemRepresentation(mktemp(buffer));
|
||||
NSString *ret = stringWithFileSystemRepresentation(mktemp(buffer));
|
||||
free(buffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void _hashOfBuffer(unsigned char *hash, const char* buffer, ssize_t bufferLength)
|
||||
|
||||
Reference in new issue
Block a user