Quiet Clang static analyzer.

This commit is contained in:
Jake Petroules committed 2014-06-29 01:19:03 -04:00
1 parent 964587274c
commit 70046f6e07
1 file changed
+4 -2
+4 -2
View File
@@ -47,8 +47,10 @@ NSString *temporaryFilename(NSString *base)
{
NSString *template = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.XXXXXXXXXX", base]];
const char *fsrepr = [template fileSystemRepresentation];
char *buffer = (char *)malloc(strlen(fsrepr) + 1);
strcpy(buffer, fsrepr);
const size_t buffer_len = strlen(fsrepr) + 1;
char *buffer = (char *)malloc(buffer_len);
strlcpy(buffer, fsrepr, buffer_len);
// mkstemp() can't be used, beause it returns a file descriptor, and XAR API requires a filename
NSString *ret = stringWithFileSystemRepresentation(mktemp(buffer));