David Hill <[email protected]> writes: > On Tue, Oct 15, 2013 at 11:46:06PM +0200, J?r?mie Courr?ges-Anglas wrote: >> David Hill <[email protected]> writes: >> >> > mail/dkim-milter -- dkim-filter seg faults on strlen(key_data) when >> > using malloc.conf option 'S'. So, I am unable to use it unless I >> > remove malloc options. >> > >> > This fixes it. >> > >> > Please review and commit. >> >> Looks fine to me but I don't use that port. While tracking key_data use >> I spotted what looks like a copy/pasto (double-free). >> >> Test reports? OK? > > nice find! > > Anyone want to commit this? maintainer timeout?
Actually I was just testing it. It's now in, thanks. >> >> Index: Makefile >> =================================================================== >> RCS file: /cvs/ports/mail/dkim-milter/Makefile,v >> retrieving revision 1.36 >> diff -u -p -r1.36 Makefile >> --- Makefile 11 Mar 2013 11:23:50 -0000 1.36 >> +++ Makefile 13 Oct 2013 23:24:52 -0000 >> @@ -3,7 +3,7 @@ >> COMMENT= DKIM milter >> >> DISTNAME= dkim-milter-2.8.3 >> -REVISION = 1 >> +REVISION = 2 >> CATEGORIES= mail >> HOMEPAGE= http://sourceforge.net/projects/dkim-milter/ >> >> Index: patches/patch-dkim-filter_dkim-filter_c >> =================================================================== >> RCS file: >> /cvs/ports/mail/dkim-milter/patches/patch-dkim-filter_dkim-filter_c,v >> retrieving revision 1.10 >> diff -u -p -r1.10 patch-dkim-filter_dkim-filter_c >> --- patches/patch-dkim-filter_dkim-filter_c 23 Jan 2009 06:43:07 -0000 >> 1.10 >> +++ patches/patch-dkim-filter_dkim-filter_c 13 Oct 2013 23:17:10 -0000 >> @@ -1,7 +1,28 @@ >> $OpenBSD: patch-dkim-filter_dkim-filter_c,v 1.10 2009/01/23 06:43:07 jasper >> Exp $ >> ---- dkim-filter/dkim-filter.c.orig Tue Jan 6 19:39:08 2009 >> -+++ dkim-filter/dkim-filter.c Thu Jan 22 23:28:54 2009 >> -@@ -8906,7 +8906,7 @@ main(int argc, char **argv) >> +- key_data should be NUL-terminated (dkim_sign calls strlen) >> +- fix double free at reload time >> +- set unprivileged _dkim-milter user >> +--- dkim-filter/dkim-filter.c.orig Wed May 27 18:34:05 2009 >> ++++ dkim-filter/dkim-filter.c Mon Oct 14 01:13:06 2013 >> +@@ -4872,7 +4872,7 @@ dkimf_loadkeys(char *file, struct dkimf_config *conf) >> + return -1; >> + } >> + >> +- new->key_data = malloc(s.st_size); >> ++ new->key_data = calloc(1, s.st_size + 1); >> + if (new->key_data == NULL) >> + { >> + fprintf(stderr, "%s: malloc(): %s\n", >> +@@ -4950,7 +4950,7 @@ dkimf_freekeys(struct dkimf_config *conf) >> + if (cur->key_domain != NULL) >> + free(cur->key_domain); >> + if (cur->key_data != NULL) >> +- free(cur->key_domain); >> ++ free(cur->key_data); >> + regfree(&cur->key_re); >> + >> + free(cur); >> +@@ -9044,7 +9044,7 @@ main(int argc, char **argv) >> unsigned long tmpl; >> const char *args = CMDLINEOPTS; >> FILE *f; >> Index: patches/patch-libdkim_dkim_h >> =================================================================== >> RCS file: /cvs/ports/mail/dkim-milter/patches/patch-libdkim_dkim_h,v >> retrieving revision 1.5 >> diff -u -p -r1.5 patch-libdkim_dkim_h >> --- patches/patch-libdkim_dkim_h 23 Jan 2009 06:43:07 -0000 1.5 >> +++ patches/patch-libdkim_dkim_h 13 Oct 2013 23:13:47 -0000 >> @@ -1,7 +1,7 @@ >> $OpenBSD: patch-libdkim_dkim_h,v 1.5 2009/01/23 06:43:07 jasper Exp $ >> ---- libdkim/dkim.h.orig Tue Jan 13 09:22:18 2009 >> -+++ libdkim/dkim.h Thu Jan 22 23:28:54 2009 >> -@@ -17,6 +17,10 @@ static char dkim_h_id[] = "@(#)$Id: dkim.h,v 1.197 200 >> +--- libdkim/dkim.h.orig Tue Apr 7 00:36:09 2009 >> ++++ libdkim/dkim.h Mon Oct 14 00:55:25 2013 >> +@@ -17,6 +17,10 @@ static char dkim_h_id[] = "@(#)$Id: dkim.h,v 1.202 200 >> /* openssl includes */ >> #include <openssl/sha.h> >> [...] -- jca | PGP: 0x06A11494 / 61DB D9A0 00A4 67CF 2A90 8961 6191 8FBF 06A1 1494
