OSDN Git Service

efi_loadopt_args_from_file(): make sure buf is only NULL if size is.
authorPeter Jones <pjones@redhat.com>
Mon, 1 May 2017 19:19:18 +0000 (15:19 -0400)
committerPeter Jones <pjones@redhat.com>
Mon, 1 May 2017 20:06:31 +0000 (16:06 -0400)
This avoids passing NULL to fread().

Found by covscan.

Signed-off-by: Peter Jones <pjones@redhat.com>
src/loadopt.c

index 8db8074..5301f3d 100644 (file)
@@ -269,7 +269,7 @@ efi_loadopt_args_from_file(uint8_t *buf, ssize_t size, char *filename)
        int saved_errno;
        FILE *f;
 
-       if (!buf && size > 0) {
+       if (!buf && size != 0) {
                errno = -EINVAL;
                return -1;
        }