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

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/fsck.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-07-25 00:50:42 +0300
committerJunio C Hamano <gitster@pobox.com>2018-07-25 00:50:42 +0300
commita9e7fe96ccac50628ad032a99bc514f5ed7bf09c (patch)
tree624287a9cc64a963e49f23e6042c63beb240be21 /fsck.c
parentb7bd9486b055c3f967a870311e704e3bb0654e4f (diff)
parentfb16287719375b86818aca0d2df2496b925e9380 (diff)
Merge branch 'rj/submodule-fsck-skip'
"fsck.skipList" did not prevent a blob object listed there from being inspected for is contents (e.g. we recently started to inspect the contents of ".gitmodules" for certain malicious patterns), which has been corrected. * rj/submodule-fsck-skip: fsck: check skiplist for object in fsck_blob()
Diffstat (limited to 'fsck.c')
-rw-r--r--fsck.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fsck.c b/fsck.c
index 4dfe65f715..ae4b1f3c09 100644
--- a/fsck.c
+++ b/fsck.c
@@ -316,6 +316,13 @@ static void append_msg_id(struct strbuf *sb, const char *msg_id)
strbuf_addstr(sb, ": ");
}
+static int object_on_skiplist(struct fsck_options *opts, struct object *obj)
+{
+ if (opts && opts->skiplist && obj)
+ return oid_array_lookup(opts->skiplist, &obj->oid) >= 0;
+ return 0;
+}
+
__attribute__((format (printf, 4, 5)))
static int report(struct fsck_options *options, struct object *object,
enum fsck_msg_id id, const char *fmt, ...)
@@ -327,8 +334,7 @@ static int report(struct fsck_options *options, struct object *object,
if (msg_type == FSCK_IGNORE)
return 0;
- if (options->skiplist && object &&
- oid_array_lookup(options->skiplist, &object->oid) >= 0)
+ if (object_on_skiplist(options, object))
return 0;
if (msg_type == FSCK_FATAL)
@@ -998,6 +1004,9 @@ static int fsck_blob(struct blob *blob, const char *buf,
return 0;
oidset_insert(&gitmodules_done, &blob->object.oid);
+ if (object_on_skiplist(options, &blob->object))
+ return 0;
+
if (!buf) {
/*
* A missing buffer here is a sign that the caller found the