diff options
| author | Edward Thomson <ethomson@microsoft.com> | 2015-05-14 13:30:29 -0400 |
|---|---|---|
| committer | Edward Thomson <ethomson@microsoft.com> | 2015-05-28 09:43:57 -0400 |
| commit | d67f270e58942fed5871eca6802d3fa4f290e4f1 (patch) | |
| tree | 12439058aa4abd0c0de53990ac6a543f09cdba1f /src | |
| parent | 3ab5a65967b2007e200be4925781583880e5b938 (diff) | |
| download | libgit2-d67f270e58942fed5871eca6802d3fa4f290e4f1.tar.gz | |
index: validate mode of new conflicts
Diffstat (limited to 'src')
| -rw-r--r-- | src/index.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/index.c b/src/index.c index b39c0893d..e37cb1f4d 100644 --- a/src/index.c +++ b/src/index.c @@ -1317,6 +1317,15 @@ int git_index_conflict_add(git_index *index, (ret = index_entry_dup(&entries[2], INDEX_OWNER(index), their_entry)) < 0) goto on_error; + /* Validate entries */ + for (i = 0; i < 3; i++) { + if (entries[i] && !valid_filemode(entries[i]->mode)) { + giterr_set(GITERR_INDEX, "invalid filemode for stage %d entry", + i); + return -1; + } + } + /* Remove existing index entries for each path */ for (i = 0; i < 3; i++) { if (entries[i] == NULL) |
