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.34-rc1~160^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cae9283ab18956951d9e037f18be09edccae4751;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);