Permalink
Browse files

Fix an off-by-one memory allocation issue.

  • Loading branch information...
1 parent dbcc9be commit 2b006dda35d2d76fcb7649e6915dcd9db543fe82 @Manfred Manfred committed Mar 8, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 app/utils/CLI.m
View
2 app/utils/CLI.m
@@ -90,7 +90,7 @@ - (id) execute:(NSArray *)arguments elevated:(BOOL)elevated {
if ([self isAuthorized]) {
if ([arguments count] > 0) {
index = 0;
- argumentsAsCArray = NSAllocateCollectable(sizeof(char*)*[arguments count], 0);
+ argumentsAsCArray = NSAllocateCollectable(sizeof(char*)*([arguments count]+1), 0);
while(index < [arguments count]) {
argumentsAsCArray[index++] = (char*)[[arguments objectAtIndex:index] UTF8String];
}

0 comments on commit 2b006dd

Please sign in to comment.