summaryrefslogtreecommitdiffstats
path: root/sys-utils/readprofile.c
diff options
context:
space:
mode:
authorSami Kerola2019-01-13 20:59:40 +0100
committerSami Kerola2019-01-13 21:00:45 +0100
commitcae9283ab18956951d9e037f18be09edccae4751 (patch)
tree8935f58ddacbb419775fe347dce7bf119dd43380 /sys-utils/readprofile.c
parentlast: fix wtmp user name buffer overflow [asan] (diff)
downloadkernel-qcow2-util-linux-cae9283ab18956951d9e037f18be09edccae4751.tar.gz
kernel-qcow2-util-linux-cae9283ab18956951d9e037f18be09edccae4751.tar.xz
kernel-qcow2-util-linux-cae9283ab18956951d9e037f18be09edccae4751.zip
readprofile: check input file is not empty [asan]
Addresses: https://github.com/karelzak/util-linux/issues/717 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/readprofile.c')
-rw-r--r--sys-utils/readprofile.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c
index 035073847..75a623bc9 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);