From: Steinar H. Gunderson Date: Mon, 9 Nov 2020 23:19:58 +0000 (+0100) Subject: When reading mlocate.db, properly skip the configuration block. X-Git-Tag: 1.1.0~24 X-Git-Url: https://git.sesse.net/?p=plocate;a=commitdiff_plain;h=7a7af4649b47543e32105dee4ef7045d279a4dd9 When reading mlocate.db, properly skip the configuration block. This could cause some entries to be skipped until we regained sync, especially in the root directory. --- diff --git a/plocate-build.cpp b/plocate-build.cpp index 62be45d..132a3ff 100644 --- a/plocate-build.cpp +++ b/plocate-build.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -420,6 +421,12 @@ void read_mlocate(FILE *fp, DatabaseReceiver *receiver) // TODO: Care about the base path. string path = read_cstr(fp); + + if (fseek(fp, ntohl(hdr.conf_size), SEEK_CUR) != 0) { + perror("skip conf block"); + exit(1); + } + while (!feof(fp)) { handle_directory(fp, receiver); }