pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/42213: pkg_install-20090816 introduces a major pointer bug to pkg_add.



The following reply was made to PR pkg/42213; it has been noted by GNATS.

From: Joerg Sonnenberger <joerg%britannica.bec.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: pkg-manager%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, 
pkgsrc-bugs%netbsd.org@localhost
Subject: Re: pkg/42213: pkg_install-20090816 introduces a major pointer bug
 to pkg_add.
Date: Fri, 23 Oct 2009 00:18:27 +0200

 --OgqxwSJOaUobr8KG
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Please try the attached patch.
 
 Joerg
 
 --OgqxwSJOaUobr8KG
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="pkgdb.diff"
 
 Index: lib/pkgdb.c
 ===================================================================
 RCS file: 
/home/joerg/repo/netbsd/pkgsrc/pkgtools/pkg_install/files/lib/pkgdb.c,v
 retrieving revision 1.35
 diff -u -p -r1.35 pkgdb.c
 --- lib/pkgdb.c        11 Sep 2009 18:00:13 -0000      1.35
 +++ lib/pkgdb.c        22 Oct 2009 22:09:01 -0000
 @@ -78,7 +78,6 @@ __RCSID("$NetBSD: pkgdb.c,v 1.35 2009/09
  
  static DB   *pkgdbp;
  static char *pkgdb_dir = NULL;
 -static char  pkgdb_cache[MaxPathSize];
  
  /*
   *  Open the pkg-database
 @@ -310,8 +309,13 @@ _pkgdb_getPKGDB_DIR(void)
  void
  _pkgdb_setPKGDB_DIR(const char *dir)
  {
 -      (void) snprintf(pkgdb_cache, sizeof(pkgdb_cache), "%s", dir);
 -      pkgdb_dir = pkgdb_cache;
 +      char *new_dir;
 +
 +      if (dir == pkgdb_dir)
 +              return;
 +      new_dir = xstrdup(dir);
 +      free(pkgdb_dir);
 +      pkgdb_dir = new_dir;
  }
  
  char *
 
 --OgqxwSJOaUobr8KG--
 


Home | Main Index | Thread Index | Old Index