mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][resend] Fix potential NULL pointer deref in gen_init_cpio
@ 2006-04-13 12:34 Jesper Juhl
  0 siblings, 0 replies; only message in thread
From: Jesper Juhl @ 2006-04-13 12:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: jgarzik, jeff, Andrew Morton, Jesper Juhl

(This patch was already send before on Mar 18, this is a resend)

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: Jesper Juhl <jesper.juhl@gmail.com>
---

 usr/gen_init_cpio.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

--- linux-2.6.17-rc1-git7-orig/usr/gen_init_cpio.c	2006-03-20 06:53:29.000000000 +0100
+++ linux-2.6.17-rc1-git7/usr/gen_init_cpio.c	2006-04-13 14:27:51.000000000 +0200
@@ -471,6 +471,7 @@ int main (int argc, char *argv[])
 				"ERROR: incorrect format, could not locate file type line %d: '%s'\n",
 				line_nr, line);
 			ec = -1;
+			break;
 		}
 
 		if ('\n' == *type) {
@@ -506,7 +507,8 @@ int main (int argc, char *argv[])
 				line_nr, line);
 		}
 	}
-	cpio_trailer();
+	if (ec == 0)
+		cpio_trailer();
 
 	exit(ec);
 }



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-04-13 12:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-13 12:34 [PATCH][resend] Fix potential NULL pointer deref in gen_init_cpio Jesper Juhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome