From 9f5bf5240e2663f7ea0724c5bbfdae0e012da9ee Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Sun, 22 Jul 2018 20:34:46 +0200 Subject: main/opensmtpd: fix segfault in crypt_checkpass --- main/opensmtpd/APKBUILD | 6 ++- .../fix-segfault-in-crypt_checkpass.patch | 44 ++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 main/opensmtpd/fix-segfault-in-crypt_checkpass.patch (limited to 'main/opensmtpd') diff --git a/main/opensmtpd/APKBUILD b/main/opensmtpd/APKBUILD index 61596332dd..781b02e946 100644 --- a/main/opensmtpd/APKBUILD +++ b/main/opensmtpd/APKBUILD @@ -4,7 +4,7 @@ # Maintainer: Jonathan Curran pkgname=opensmtpd pkgver=6.0.3p1 -pkgrel=0 +pkgrel=1 pkgdesc="secure, reliable, lean, and easy-to configure SMTP server" url="http://www.opensmtpd.org" arch="all" @@ -18,6 +18,7 @@ source="https://www.opensmtpd.org/archives/$pkgname-$pkgver.tar.gz smtpd.initd aliases autoconf-decl-checks.patch + fix-segfault-in-crypt_checkpass.patch " options="suid !check" @@ -60,4 +61,5 @@ package() { sha512sums="e579818a0ddbe637deb5a4e40f43eaf797783903ceac18fd89a57581b135b9e407d424e1a70ff7b4b06a0ee50bafb6e8ab2451371917887904b06ff1b55d320f opensmtpd-6.0.3p1.tar.gz 8d3b27c760df84804baadc90c23b34f3e99980fae97c685f98ab096c3e84ab293316cd7c49317fa3cffac7ab5e63217ada6a2c5b245f352bafe880b087e7705e smtpd.initd 51d47b34eb3d728daa45f29d6434cc75db28dfa69b6fb3ecd873121df85b296a2d2c81016d765a07778aa26a496e4b29c09a30b82678cf42596a536734b5deca aliases -37104cc605569f142ceffa902f200e8a7e9e1114ebe5394ed1eac0ed6ce25454e1610270921c45246de8396eee04b7c8ab5a112a231036a6ef14e7e229b264e3 autoconf-decl-checks.patch" +37104cc605569f142ceffa902f200e8a7e9e1114ebe5394ed1eac0ed6ce25454e1610270921c45246de8396eee04b7c8ab5a112a231036a6ef14e7e229b264e3 autoconf-decl-checks.patch +cd6b60e478703890af1112d93c2d2ac0c87c5ad394d91a7903ca11532c4d2c8763330a8c20ef9b8d5a79632760faee5ee1437a43d37d1727aef2e1431d1d030c fix-segfault-in-crypt_checkpass.patch" diff --git a/main/opensmtpd/fix-segfault-in-crypt_checkpass.patch b/main/opensmtpd/fix-segfault-in-crypt_checkpass.patch new file mode 100644 index 0000000000..e7bd733b21 --- /dev/null +++ b/main/opensmtpd/fix-segfault-in-crypt_checkpass.patch @@ -0,0 +1,44 @@ +From 9b5f70b93e038df5446bd37a4adac5a0380748e7 Mon Sep 17 00:00:00 2001 +From: johannes +Date: Wed, 21 Feb 2018 23:57:11 +0100 +Subject: [PATCH] crypt_checkpass: include HAVE_CRYPT_H definition, add NULL + check + +Patch-Source: https://github.com/OpenSMTPD/OpenSMTPD/pull/835 +--- + openbsd-compat/crypt_checkpass.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/openbsd-compat/crypt_checkpass.c b/openbsd-compat/crypt_checkpass.c +index dafd2dae..d10b3a57 100644 +--- a/openbsd-compat/crypt_checkpass.c ++++ b/openbsd-compat/crypt_checkpass.c +@@ -1,5 +1,6 @@ + /* OPENBSD ORIGINAL: lib/libc/crypt/cryptutil.c */ + ++#include "includes.h" + #include + #ifdef HAVE_CRYPT_H + #include +@@ -10,6 +11,8 @@ + int + crypt_checkpass(const char *pass, const char *goodhash) + { ++ char *c; ++ + if (goodhash == NULL) + goto fail; + +@@ -17,7 +20,11 @@ crypt_checkpass(const char *pass, const char *goodhash) + if (strlen(goodhash) == 0 && strlen(pass) == 0) + return 0; + +- if (strcmp(crypt(pass, goodhash), goodhash) == 0) ++ c = crypt(pass, goodhash); ++ if (c == NULL) ++ goto fail; ++ ++ if (strcmp(c, goodhash) == 0) + return 0; + + fail: -- cgit v1.2.3