diff options
author | Ben Straub <bs@github.com> | 2014-02-05 13:15:57 -0800 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2014-02-05 13:15:57 -0800 |
commit | 0de2c4e3a3cb63a2af66c464585d0e9ae273ddee (patch) | |
tree | 8a2420a6151343d5092b46a22806bad4f9b28de8 /src/util.h | |
parent | 010cec3ac26ab8445cc8401fb312f60168916bda (diff) | |
parent | 629ba7f1059bdc149718570a8b2ac043c044d781 (diff) | |
download | libgit2-0de2c4e3a3cb63a2af66c464585d0e9ae273ddee.tar.gz |
Merge remote-tracking branch 'libgit2/development' into bs/more-reflog-stuff
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util.h b/src/util.h index f9de909e9..e378786d9 100644 --- a/src/util.h +++ b/src/util.h @@ -8,6 +8,7 @@ #define INCLUDE_util_h__ #include "common.h" +#include "strnlen.h" #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) #define bitsizeof(x) (CHAR_BIT * sizeof(x)) @@ -50,8 +51,7 @@ GIT_INLINE(char *) git__strndup(const char *str, size_t n) size_t length = 0; char *ptr; - while (length < n && str[length]) - ++length; + length = p_strnlen(str, n); ptr = (char*)git__malloc(length + 1); |