Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott J. Goldman <scottjg@github.com>2012-11-19 04:52:04 +0400
committerScott J. Goldman <scottjg@github.com>2012-11-19 04:52:04 +0400
commit0d778b1a892d53161b4392ed75adcb3dcfe1a3df (patch)
tree751b5e4e84a0be800f196ed4f588b697d2b57b31 /src/tree.c
parent19af78bb36b144022d7dbe68605c8715cd6dc322 (diff)
Catch invalid filenames in append_entry()
This prevents the index api from calling write_tree() with a bogus tree.
Diffstat (limited to 'src/tree.c')
-rw-r--r--src/tree.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/tree.c b/src/tree.c
index 150f90c44..6f9838880 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -374,6 +374,9 @@ static int append_entry(
{
git_tree_entry *entry;
+ if (!valid_entry_name(filename))
+ return tree_error("Failed to insert entry. Invalid name for a tree entry");
+
entry = alloc_entry(filename);
GITERR_CHECK_ALLOC(entry);