diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-21 10:48:03 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-21 11:04:07 -0400 |
| commit | 577912ff0e1996b9846db00247648abd828a8f43 (patch) | |
| tree | 379773aaaae0193d1a53583646b48e23edd817a5 | |
| parent | 0231d08f3389be3271fd8be922491b662fb863b5 (diff) | |
| download | stasis-577912ff0e1996b9846db00247648abd828a8f43.tar.gz | |
Avoid segfault on empty meta directorysprintf-to-snprintf
| -rw-r--r-- | src/cli/stasis_indexer/stasis_indexer_main.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cli/stasis_indexer/stasis_indexer_main.c b/src/cli/stasis_indexer/stasis_indexer_main.c index 63fb45c..d475c15 100644 --- a/src/cli/stasis_indexer/stasis_indexer_main.c +++ b/src/cli/stasis_indexer/stasis_indexer_main.c @@ -320,6 +320,11 @@ int main(const int argc, char *argv[]) { msg(STASIS_MSG_L1, "Loading metadata\n"); struct StrList *metafiles = NULL; get_files(&metafiles, ctx.storage.meta_dir, "*.stasis"); + if (!metafiles || !strlist_count(metafiles)) { + SYSERROR("%s: No metadata!", ctx.storage.meta_dir); + delivery_free(&ctx); + exit(1); + } strlist_sort(metafiles, STASIS_SORT_LEN_ASCENDING); struct Delivery **local = calloc(strlist_count(metafiles) + 1, sizeof(*local)); |
