diff options
| author | Edward Thomson <ethomson@microsoft.com> | 2013-05-29 16:03:30 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@microsoft.com> | 2013-05-29 16:26:25 -0500 |
| commit | 2d160ef782c812bd7d68413a00a62f46585725d0 (patch) | |
| tree | c771fbfe1bc5a8a6dc47c0f14b5e94936b7bbcde /src | |
| parent | 17776314c8d161d78917e5fb2805d78a3c8c3599 (diff) | |
| download | libgit2-2d160ef782c812bd7d68413a00a62f46585725d0.tar.gz | |
allow (ignore) bare slash in gitignore
Diffstat (limited to 'src')
| -rw-r--r-- | src/attr_file.c | 3 | ||||
| -rw-r--r-- | src/pool.c | 5 |
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'; |
