summaryrefslogtreecommitdiff
path: root/src/pool.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2013-05-29 16:03:30 -0500
committerEdward Thomson <ethomson@microsoft.com>2013-05-29 16:26:25 -0500
commit2d160ef782c812bd7d68413a00a62f46585725d0 (patch)
treec771fbfe1bc5a8a6dc47c0f14b5e94936b7bbcde /src/pool.c
parent17776314c8d161d78917e5fb2805d78a3c8c3599 (diff)
downloadlibgit2-2d160ef782c812bd7d68413a00a62f46585725d0.tar.gz
allow (ignore) bare slash in gitignore
Diffstat (limited to 'src/pool.c')
-rw-r--r--src/pool.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pool.c b/src/pool.c
index b3cd49665..d484769e9 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -194,6 +194,11 @@ char *git_pool_strndup(git_pool *pool, const char *str, size_t n)
assert(pool && str && pool->item_size == sizeof(char));
+ if (n + 1 == 0) {
+ giterr_set_oom();
+ return NULL;
+ }
+
if ((ptr = git_pool_malloc(pool, (uint32_t)(n + 1))) != NULL) {
memcpy(ptr, str, n);
*(((char *)ptr) + n) = '\0';