SOURCES: rpm-specdump.c - fix null pointer dereference for rpm 4.4...

glen glen at pld-linux.org
Wed Jan 23 17:42:19 CET 2008


Author: glen                         Date: Wed Jan 23 16:42:19 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fix null pointer dereference for rpm 4.4.2 (h variable was created too early)

---- Files affected:
SOURCES:
   rpm-specdump.c (1.8 -> 1.9) 

---- Diffs:

================================================================
Index: SOURCES/rpm-specdump.c
diff -u SOURCES/rpm-specdump.c:1.8 SOURCES/rpm-specdump.c:1.9
--- SOURCES/rpm-specdump.c:1.8	Wed Jan 23 12:00:03 2008
+++ SOURCES/rpm-specdump.c	Wed Jan 23 17:42:14 2008
@@ -275,7 +275,7 @@
 #if RPM_VERSION_CODE >= RPM_VERSION(4,4,9)
 	if (parseSpec(ts, args.specfile, NULL, 0, NULL, NULL, 1, 1, 0) != 0) {
 #else
-	if (parseSpec(ts, args.specfile, NULL, NULL, 0, NULL, NULL, 1, 1) != 0) {
+	if (parseSpec(ts, args.specfile, NULL, NULL, 1, NULL, NULL, 1, 1) != 0) {
 #endif
 		return EXIT_FAILURE;
 	}
@@ -283,14 +283,16 @@
 	s = rpmtsSpec(ts);
 
 	// here starts the code for builder
-	Header h = s->sourceHeader;
-	const char *name, *version, *release;
+	const char *name = NULL, *version = NULL, *release = NULL;
 
+	if (s->sourceHeader == NULL) {
 #if RPM_VERSION_CODE >= RPM_VERSION(4,4,9)
-	initSourceHeader(s, NULL);
+		initSourceHeader(s, NULL);
 #else
-	initSourceHeader(s);
+		initSourceHeader(s);
 #endif
+	}
+	Header h = s->sourceHeader;
 
 	if (
 		headerGetEntryMinMemory(h, RPMTAG_NAME, NULL, (void *)&name, NULL) == 0 ||
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/rpm-specdump.c?r1=1.8&r2=1.9&f=u



More information about the pld-cvs-commit mailing list