From cae9283ab18956951d9e037f18be09edccae4751 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 13 Jan 2019 19:59:40 +0000 Subject: [PATCH] readprofile: check input file is not empty [asan] Addresses: https://github.com/karelzak/util-linux/issues/717 Signed-off-by: Sami Kerola --- sys-utils/readprofile.c | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.47.2