diff options
Diffstat (limited to 'sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-db.patch')
-rw-r--r-- | sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-db.patch | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-db.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-db.patch new file mode 100644 index 000000000000..42b14e8c1475 --- /dev/null +++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-db.patch @@ -0,0 +1,69 @@ +http://security.freebsd.org/advisories/FreeBSD-SA-09:07.libc.asc + + + +Index: lib/libc/db/btree/bt_split.c +=================================================================== +--- lib/libc/db/btree/bt_split.c ++++ lib/libc/db/btree/bt_split.c +@@ -372,7 +372,7 @@ + } + + /* Put the new left page for the split into place. */ +- if ((l = (PAGE *)malloc(t->bt_psize)) == NULL) { ++ if ((l = (PAGE *)calloc(1, t->bt_psize)) == NULL) { + mpool_put(t->bt_mp, r, 0); + return (NULL); + } +Index: lib/libc/db/hash/hash_buf.c +=================================================================== +--- lib/libc/db/hash/hash_buf.c ++++ lib/libc/db/hash/hash_buf.c +@@ -57,6 +57,7 @@ + #include <stddef.h> + #include <stdio.h> + #include <stdlib.h> ++#include <string.h> + + #ifdef DEBUG + #include <assert.h> +@@ -169,12 +170,12 @@ + */ + if (hashp->nbufs || (bp->flags & BUF_PIN)) { + /* Allocate a new one */ +- if ((bp = (BUFHEAD *)malloc(sizeof(BUFHEAD))) == NULL) ++ if ((bp = (BUFHEAD *)calloc(1, sizeof(BUFHEAD))) == NULL) + return (NULL); + #ifdef PURIFY + memset(bp, 0xff, sizeof(BUFHEAD)); + #endif +- if ((bp->page = (char *)malloc(hashp->BSIZE)) == NULL) { ++ if ((bp->page = (char *)calloc(1, hashp->BSIZE)) == NULL) { + free(bp); + return (NULL); + } +@@ -319,8 +314,10 @@ + } + /* Check if we are freeing stuff */ + if (do_free) { +- if (bp->page) ++ if (bp->page) { ++ (void)memset(bp->page, 0, hashp->BSIZE); + free(bp->page); ++ } + BUF_REMOVE(bp); + free(bp); + bp = LRU; +Index: lib/libc/db/mpool/mpool.c +=================================================================== +--- lib/libc/db/mpool/mpool.c ++++ lib/libc/db/mpool/mpool.c +@@ -332,7 +332,7 @@ + return (bp); + } + +-new: if ((bp = (BKT *)malloc(sizeof(BKT) + mp->pagesize)) == NULL) ++new: if ((bp = (BKT *)calloc(1, sizeof(BKT) + mp->pagesize)) == NULL) + return (NULL); + #ifdef STATISTICS + ++mp->pagealloc; |