]> git.ozlabs.org Git - petitboot/commit - test/parser/Makefile.am
grub2: fix empty file handling
authorJeremy Kerr <jk@ozlabs.org>
Wed, 4 Jun 2014 07:45:53 +0000 (15:45 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 5 Jun 2014 07:25:10 +0000 (15:25 +0800)
commit8c430d0509a2f1f5dc64de308d1c1d2668d2031b
tree18cb9a8671f977e49c0aab70e718e9ecd224b8cf
parentdcc2bd8913d3741614e971b0be12f490d8334538
grub2: fix empty file handling

Currently, we have a bug when parsing zero-length files: we subtract one
from the length to exclude the trailing NUL (added by read_file), but a
zero-length file will result in a length of -1.

This change adds an explicit exit if we're attempting to parse an empty
file.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/grub2/parser.y
test/parser/Makefile.am
test/parser/test-grub2-empty.c [new file with mode: 0644]