diff options
author | Sami Kerola | 2019-01-13 20:59:40 +0100 |
---|---|---|
committer | Sami Kerola | 2019-01-13 21:00:45 +0100 |
commit | cae9283ab18956951d9e037f18be09edccae4751 (patch) | |
tree | 8935f58ddacbb419775fe347dce7bf119dd43380 /sys-utils/readprofile.c | |
parent | last: fix wtmp user name buffer overflow [asan] (diff) | |
download | kernel-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.c | 2 |
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); |