Skip to content

Commit

Permalink
Merge pull request erikdoe#132 from madsolar8582/fixbufferboundaries
Browse files Browse the repository at this point in the history
Fix for clang static analyzer issue CWE-119
  • Loading branch information
erikdoe committed May 11, 2015
2 parents 3413267 + 90ac2e9 commit da6dc18
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/OCMock/NSInvocation+OCMAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,8 @@ - (NSString *)cStringDescriptionAtIndex:(NSInteger)anInt
char *cStringPtr;

[self getArgument:&cStringPtr atIndex:anInt];
strncpy(buffer, cStringPtr, 100);
strcpy(buffer + 100, "...");
strlcpy(buffer, cStringPtr, sizeof(buffer));
strlcpy(buffer + 100, "...", (sizeof(buffer) - 100));
return [NSString stringWithFormat:@"\"%s\"", buffer];
}

Expand Down

0 comments on commit da6dc18

Please sign in to comment.