RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm-4_5: rpm/tools/ rpm-specdump.c

From: Elan Ruusamäe <glen@rpm5.org>
Date: Wed 23 Jan 2008 - 20:46:15 CET
Message-Id: <20080123194615.BE28A34844D@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Elan Ruusamäe
  Root:   /v/rpm/cvs                       Email:  glen@rpm5.org
  Module: rpm                              Date:   23-Jan-2008 20:46:15
  Branch: rpm-4_5                          Handle: 2008012319461500

  Modified files:           (Branch: rpm-4_5)
    rpm/tools               rpm-specdump.c

  Log:
    - fix null pointer dereference for rpm 4.4.2 (h variable was created
    too early)

  Summary:
    Revision    Changes     Path
    1.1.2.2     +8  -6      rpm/tools/rpm-specdump.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/tools/rpm-specdump.c
  ============================================================================
  $ cvs diff -u -r1.1.2.1 -r1.1.2.2 rpm-specdump.c
  --- rpm/tools/rpm-specdump.c	23 Jan 2008 16:07:17 -0000	1.1.2.1
  +++ rpm/tools/rpm-specdump.c	23 Jan 2008 19:46:15 -0000	1.1.2.2
  @@ -1,5 +1,5 @@
   /*
  - * $Id: rpm-specdump.c,v 1.1.2.1 2008/01/23 16:07:17 jbj Exp $
  + * $Id: rpm-specdump.c,v 1.1.2.2 2008/01/23 19:46:15 glen Exp $
    *
    * Prints out following information in same format as %dump for builder:
    * $ rpmbuild --nodigest --nosignature --nobuild -bp --define 'prep %{echo:dummy: PACKAGE_NAME %{name} }%dump' qemu.spec 2>&1 | awk '$2 ~ /^SOURCEURL/ {print} $2 ~ /^PATCHURL/  {print} $2 ~ /^nosource/ {print} $2 ~ /^PACKAGE_/ {print}'
  @@ -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 ||
  @@ .
Received on Wed Jan 23 20:46:15 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.