Skip to content

Commit 27932de

Browse files
committed
flux-fsck: fix potential segfault
Problem: A "missing_indexes" list is not created unless it is needed. Under some rare error scenarios, this list could be accessed without being created. Check that the list is created before using it.
1 parent 159c660 commit 27932de

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/cmd/builtin/fsck.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ static void fsck_valref (struct fsck_ctx *ctx,
357357

358358
/* can only recover if errors were all bad references */
359359
if (ctx->repair
360+
&& fvd.missing_indexes
360361
&& fvd.errorcount == zlist_size (fvd.missing_indexes)) {
361362
json_t *repaired = repair_valref (ctx, treeobj, &fvd);
362363

0 commit comments

Comments
 (0)