Date: Tue, 25 Jan 2022 16:01:13 GMT From: Wolfram Schneider <wosch@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: b7a74bbc41b3 - main - stop on error and display the statstics anyway Message-ID: <202201251601.20PG1Dh4004987@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by wosch: URL: https://cgit.FreeBSD.org/src/commit/?id=b7a74bbc41b38fc7f43d66ba868e22a97f08f660 commit b7a74bbc41b38fc7f43d66ba868e22a97f08f660 Author: Wolfram Schneider <wosch@FreeBSD.org> AuthorDate: 2022-01-25 15:58:29 +0000 Commit: Wolfram Schneider <wosch@FreeBSD.org> CommitDate: 2022-01-25 15:59:41 +0000 stop on error and display the statstics anyway PR: 32686 --- usr.bin/locate/locate/fastfind.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/usr.bin/locate/locate/fastfind.c b/usr.bin/locate/locate/fastfind.c index b230f93439fd..67d22bfca7b7 100644 --- a/usr.bin/locate/locate/fastfind.c +++ b/usr.bin/locate/locate/fastfind.c @@ -66,6 +66,12 @@ statistic (fp, path_fcodes) } else count += c - OFFSET; + if (count < 0 || count > MAXPATHLEN) { + /* stop on error and display the statstics anyway */ + warnx("corrupted database: %s", path_fcodes); + break; + } + for (p = path + count; (c = getc(fp)) > SWITCH; size++) if (c < PARITY) { if (c == UMLAUT) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202201251601.20PG1Dh4004987>