summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-05-29 14:50:24 -0700
committerRussell Belfer <rb@github.com>2013-05-29 14:50:24 -0700
commit0c01f93e8c89a16b3531e4fb32384fe90bf4c548 (patch)
treec771fbfe1bc5a8a6dc47c0f14b5e94936b7bbcde /src
parent17776314c8d161d78917e5fb2805d78a3c8c3599 (diff)
parent2d160ef782c812bd7d68413a00a62f46585725d0 (diff)
downloadlibgit2-0c01f93e8c89a16b3531e4fb32384fe90bf4c548.tar.gz
Merge pull request #1619 from ethomson/gitignore_slash
allow (ignore) bare slash in gitignore
Diffstat (limited to 'src')
-rw-r--r--src/attr_file.c3
-rw-r--r--src/pool.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/src/attr_file.c b/src/attr_file.c
index 85cd87624..d059cfec7 100644
--- a/src/attr_file.c
+++ b/src/attr_file.c
@@ -397,7 +397,8 @@ int git_attr_fnmatch__parse(
*base = scan;
- spec->length = scan - pattern;
+ if ((spec->length = scan - pattern) == 0)
+ return GIT_ENOTFOUND;
if (pattern[spec->length - 1] == '/') {
spec->length--;
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';