diff options
| author | Wolfram Schneider <wosch@FreeBSD.org> | 2022-01-25 15:58:29 +0000 |
|---|---|---|
| committer | Wolfram Schneider <wosch@FreeBSD.org> | 2022-01-25 15:59:41 +0000 |
| commit | b7a74bbc41b38fc7f43d66ba868e22a97f08f660 (patch) | |
| tree | c0ec81392340ab56f8420afaa110588fd1bfcef9 | |
| parent | 86a16ada1ea608408cec370171d9f59353e97c77 (diff) | |
| download | src-b7a74bbc41b38fc7f43d66ba868e22a97f08f660.tar.gz src-b7a74bbc41b38fc7f43d66ba868e22a97f08f660.zip | |
stop on error and display the statstics anyway
PR: 32686
| -rw-r--r-- | usr.bin/locate/locate/fastfind.c | 6 |
1 files changed, 6 insertions, 0 deletions
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) { |
