]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
readprofile: check input file is not empty [asan]
authorSami Kerola <kerolasa@iki.fi>
Sun, 13 Jan 2019 19:59:40 +0000 (19:59 +0000)
committerKarel Zak <kzak@redhat.com>
Tue, 2 Apr 2019 10:12:50 +0000 (12:12 +0200)
Addresses: https://github.com/karelzak/util-linux/issues/717
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/readprofile.c

index 035073847a36f040668f17571254605b1566dbbe..75a623bc98757ba739b89d139f89be484b2b1527 100644 (file)
@@ -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);