Commit aa1e816f authored by Jesper Juhl's avatar Jesper Juhl Committed by Linus Torvalds

[PATCH] Fix potential NULL pointer deref in gen_init_cpio

Fix potential NULL pointer deref in gen_init_cpio.c spotted by coverity
checker.  This fixes coverity bug #86

Without this patch we risk dereferencing a NULL `type' in the
"if ('\n' == *type) {" line.
Signed-off-by: default avatarJesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9dfb563b
...@@ -471,6 +471,7 @@ int main (int argc, char *argv[]) ...@@ -471,6 +471,7 @@ int main (int argc, char *argv[])
"ERROR: incorrect format, could not locate file type line %d: '%s'\n", "ERROR: incorrect format, could not locate file type line %d: '%s'\n",
line_nr, line); line_nr, line);
ec = -1; ec = -1;
break;
} }
if ('\n' == *type) { if ('\n' == *type) {
...@@ -506,6 +507,7 @@ int main (int argc, char *argv[]) ...@@ -506,6 +507,7 @@ int main (int argc, char *argv[])
line_nr, line); line_nr, line);
} }
} }
if (ec == 0)
cpio_trailer(); cpio_trailer();
exit(ec); exit(ec);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment