diff options
| author | Vicent Martà <vicent@github.com> | 2013-08-09 15:30:50 -0700 |
|---|---|---|
| committer | Vicent Martà <vicent@github.com> | 2013-08-09 15:30:50 -0700 |
| commit | a25519acc106acf6e1f376c81a078c78778015ed (patch) | |
| tree | 521b63ad899f1fc1d8bad559750b8b3620a18e97 /src/win32/mingw-compat.h | |
| parent | d1be9e4ca18caa37c69afb988994a99cd137a3b8 (diff) | |
| parent | a1f69452a22689ca2eede7669e79a3e7ab849cdd (diff) | |
| download | libgit2-a25519acc106acf6e1f376c81a078c78778015ed.tar.gz | |
Merge pull request #1770 from ethomson/index_fuzz
Fixes to safely reading the index
Diffstat (limited to 'src/win32/mingw-compat.h')
| -rw-r--r-- | src/win32/mingw-compat.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/win32/mingw-compat.h b/src/win32/mingw-compat.h index 7b97b48db..97b1cb71b 100644 --- a/src/win32/mingw-compat.h +++ b/src/win32/mingw-compat.h @@ -19,6 +19,11 @@ # define S_IFLNK _S_IFLNK # define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK) +GIT_INLINE(size_t) p_strnlen(const char *s, size_t maxlen) { + const char *end = memchr(s, 0, maxlen); + return end ? (end - s) : maxlen; +} + #endif #endif /* INCLUDE_mingw_compat__ */ |
