Skip to content

Commit ccff8cc

Browse files
authored
Merge pull request #762 from libgit2/cmn/strndup-strnlen
Use strnlen in the strndup allocator
2 parents c171a2a + d39d5c7 commit ccff8cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/rugged/rugged_allocator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static char *rugged_gstrndup(const char *str, size_t n, const char *file, int li
2828
size_t len;
2929
char *newstr;
3030

31-
len = strlen(str);
31+
len = strnlen(str, n);
3232
if (len < n)
3333
n = len;
3434

0 commit comments

Comments
 (0)