Skip to content

Commit a9e7fe9

Browse files
committed
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()
2 parents b7bd948 + fb16287 commit a9e7fe9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

fsck.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,13 @@ static void append_msg_id(struct strbuf *sb, const char *msg_id)
316316
strbuf_addstr(sb, ": ");
317317
}
318318

319+
static int object_on_skiplist(struct fsck_options *opts, struct object *obj)
320+
{
321+
if (opts && opts->skiplist && obj)
322+
return oid_array_lookup(opts->skiplist, &obj->oid) >= 0;
323+
return 0;
324+
}
325+
319326
__attribute__((format (printf, 4, 5)))
320327
static int report(struct fsck_options *options, struct object *object,
321328
enum fsck_msg_id id, const char *fmt, ...)
@@ -327,8 +334,7 @@ static int report(struct fsck_options *options, struct object *object,
327334
if (msg_type == FSCK_IGNORE)
328335
return 0;
329336

330-
if (options->skiplist && object &&
331-
oid_array_lookup(options->skiplist, &object->oid) >= 0)
337+
if (object_on_skiplist(options, object))
332338
return 0;
333339

334340
if (msg_type == FSCK_FATAL)
@@ -998,6 +1004,9 @@ static int fsck_blob(struct blob *blob, const char *buf,
9981004
return 0;
9991005
oidset_insert(&gitmodules_done, &blob->object.oid);
10001006

1007+
if (object_on_skiplist(options, &blob->object))
1008+
return 0;
1009+
10011010
if (!buf) {
10021011
/*
10031012
* A missing buffer here is a sign that the caller found the

0 commit comments

Comments
 (0)