From: Adam Heath Date: Fri, 23 Aug 2002 04:31:27 +0000 (+0000) Subject: Fix read past buffer in lib/nfmalloc.c. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29d0e3357e7c4524351e7b33855cb8c42c6dd956;p=dpkg Fix read past buffer in lib/nfmalloc.c. --- diff --git a/ChangeLog b/ChangeLog index 453da1b4..90d39f0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Aug 22 23:25:23 CDT 2002 Adam Heath + + * lib/nfmalloc.c: Fix read past buffer in lib/nfmalloc.c. + Thu Aug 22 23:16:02 CDT 2002 Adam Heath * utils/md5sum.c: Handle directories better in md5sum. diff --git a/debian/changelog b/debian/changelog index ff498c62..f295e5a5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ dpkg (1.10.5) unstable; urgency=low Closes: #154503. * Fix extraction of md5sum in dpkg-scanpackages. Closes: #153769. * Handle directories better in md5sum. Closes: #157453. + * Fix read past buffer in lib/nfmalloc.c. Closes: #157304. -- Adam Heath UNRELEASED diff --git a/lib/nfmalloc.c b/lib/nfmalloc.c index 9bb4b3f1..2930b883 100644 --- a/lib/nfmalloc.c +++ b/lib/nfmalloc.c @@ -53,15 +53,12 @@ inline void *nfmalloc(size_t size) char *nfstrsave(const char *string) { OBSTACK_INIT; - return obstack_copy (&db_obs, string, strlen(string) + 1); + return obstack_copy0 (&db_obs, string, strlen(string)); } char *nfstrnsave(const char *string, int l) { - char *ret; OBSTACK_INIT; - ret = obstack_copy (&db_obs, string, l + 1); - *(ret + l) = 0; - return ret; + return obstack_copy0 (&db_obs, string, l); } void nffreeall(void) {