Introduction
Introduction Statistics Contact Development Disclaimer Help
fix uninitialized memory when parsing bogofilter header - bmf - bmf (Bayesian M…
git clone git://git.codemadness.org/bmf
Log
Files
Refs
README
LICENSE
---
commit 24fa4a0c3c143c6f36f1ca08b41135156c68f9ff
parent b627d86afb6118bb029d5601078fe972d576ab3e
Author: Hiltjo Posthuma <[email protected]>
Date: Thu, 8 Nov 2018 18:07:02 +0100
fix uninitialized memory when parsing bogofilter header
the memory was not guaranteed to be NUL terminated
Diffstat:
M dbh.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/dbh.c b/dbh.c
@@ -221,7 +221,7 @@ dbtext_db_opentable(dbhtext_t * pthis, cpchar table, bool_t…
if (st.st_size == 0) {
return (dbt_t *) ptable;
}
- if ((ptable->pbuf = malloc(st.st_size)) == NULL) {
+ if ((ptable->pbuf = calloc(1, st.st_size + 1)) == NULL) {
perror("malloc()");
goto bail_uc;
}
@@ -229,6 +229,7 @@ dbtext_db_opentable(dbhtext_t * pthis, cpchar table, bool_t…
perror("read()");
goto bail_fuc;
}
+
/* XXX: bogofilter compatibility */
if (sscanf(ptable->pbuf, BOGOFILTER_HEADER, &ptable->nmsgs) != 1) {
goto bail_fuc;
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.