Prechádzať zdrojové kódy

nfstrnsave() was not allocated n+1 chars, and was not setting the n+1 byte
to \0.

Adam Heath 25 rokov pred
rodič
commit
0b3f87301a
3 zmenil súbory, kde vykonal 11 pridanie a 1 odobranie
  1. 5 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 4 1
      lib/nfmalloc.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+Fri Apr 27 20:43:25 CDT 2001 Adam Heath <doogie@debian.org>
+
+  * lib/nfmalloc.c: nfstrnsave() was not allocated n+1 chars, and was not
+    setting the n+1 byte to \0.
+
 Sat Apr 28 02:52:56 CEST 2001 Wichert Akkerman <wakkerma@debian.org>
 Sat Apr 28 02:52:56 CEST 2001 Wichert Akkerman <wakkerma@debian.org>
 
 
   * scripts/dpkg-shlibdeps.pl: do not care if dpkg --search returns
   * scripts/dpkg-shlibdeps.pl: do not care if dpkg --search returns

+ 2 - 0
debian/changelog

@@ -4,6 +4,8 @@ dpkg (1.9.1) unstable; urgency=low
     trailing new line.  Closes: #95496
     trailing new line.  Closes: #95496
   * Make dpkg-shlibdeps not care if dpkg --search return with an error.
   * Make dpkg-shlibdeps not care if dpkg --search return with an error.
     Closes: Bug#95568
     Closes: Bug#95568
+  * Fix corruption of user-defined fields in status and available.
+    Closes: Bug#95567.
 
 
  -- Wichert Akkerman <wakkerma@debian.org>  UNRELEASED
  -- Wichert Akkerman <wakkerma@debian.org>  UNRELEASED
 
 

+ 4 - 1
lib/nfmalloc.c

@@ -57,8 +57,11 @@ char *nfstrsave(const char *string) {
 }
 }
 
 
 char *nfstrnsave(const char *string, int l) {
 char *nfstrnsave(const char *string, int l) {
+  char *ret;
   OBSTACK_INIT;
   OBSTACK_INIT;
-  return obstack_copy (&db_obs, string, l);
+  ret = obstack_copy (&db_obs, string, l + 1);
+  *(ret + l + 1) = 0;
+  return ret;
 }
 }
 
 
 void nffreeall(void) {
 void nffreeall(void) {