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

Bug#154257: Patch to fix #154257



flags 154257 + patch
thanks

The included patch fixes the problem, but requires some explanation.

When the nf* stuff is reset by calling nffreeall (which some things,
such as dselect do indirectly) all pointers returned by things such as
nfstrsave are freed.

The problem comes in that parsemustfield (the function which is patched)
tries to save a little memory by only allocating the empty string once,
however after nffreeall is called the pointer it has is invalid, and it
has no way of knowing this.

The fix is to make the function a little dumber, I have verified that it
fixes the generation of corrupted /var/lib/dpkg/available files.

Zephaniah E. Hull.

diff -ur dpkg-1.10.4/lib/parsehelp.c dpkg-1.10.4.new/lib/parsehelp.c
--- dpkg-1.10.4/lib/parsehelp.c	2002-05-06 12:18:15.000000000 -0400
+++ dpkg-1.10.4/lib/parsehelp.c	2002-08-28 07:10:00.000000000 -0400
@@ -228,12 +228,9 @@
  const struct pkginfo *pigp, int warnonly,
  const char **value, const char *what) 
 {
-  static char *empty = NULL;
-  if (!empty)
-    empty= nfstrsave("");
   if (!*value) {
     parseerr(file,filename,lno, warnto,warncount,pigp,warnonly, _("missing %s"),what);
-    *value= empty;
+    *value= nfstrsave("");
   } else if (!**value) {
     parseerr(file,filename,lno, warnto,warncount,pigp,warnonly,
              _("empty value for %s"),what);

-- 
	1024D/E65A7801 Zephaniah E. Hull <warp@babylon.d2dc.net>
	   92ED 94E4 B1E6 3624 226D  5727 4453 008B E65A 7801
	    CCs of replies from mailing lists are requested.

<cas> well there ya go.  say something stupid in irc and have it
      immortalised forever in someone's .sig file

Attachment: pgpsXv6RyboOp.pgp
Description: PGP signature


Reply to: