From: Sami Kerola Date: Sun, 13 Jan 2019 19:59:40 +0000 (+0000) Subject: readprofile: check input file is not empty [asan] X-Git-Tag: v2.33.2~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c7fb646738be59279df97162200cce710f65267f;p=thirdparty%2Futil-linux.git readprofile: check input file is not empty [asan] Addresses: https://github.com/karelzak/util-linux/issues/717 Signed-off-by: Sami Kerola --- diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c index 035073847a..75a623bc98 100644 --- a/sys-utils/readprofile.c +++ b/sys-utils/readprofile.c @@ -246,6 +246,8 @@ int main(int argc, char **argv) || ((int)(len = lseek(proFd, 0, SEEK_END)) < 0) || (lseek(proFd, 0, SEEK_SET) < 0)) err(EXIT_FAILURE, "%s", proFile); + if (!len) + errx(EXIT_FAILURE, "%s: %s", proFile, _("input file is empty")); buf = xmalloc(len);