diff --git a/main/czmq/APKBUILD b/main/czmq/APKBUILD
index 3c62aa2f76c3ac0f2916a3d3472f77254adc1019..bf75ecf5dd470f55fdf00e07235f9c78417e100b 100644
--- a/main/czmq/APKBUILD
+++ b/main/czmq/APKBUILD
@@ -2,14 +2,17 @@
 # Maintainer: Jakub Jirutka <jakub@jirutka.cz>
 pkgname=czmq
 pkgver=4.2.0
-pkgrel=2
+pkgrel=3
 pkgdesc="High-level C binding for ZeroMQ"
 url="http://czmq.zeromq.org/"
 arch="all !s390x"  # zproxy test timeouts on s390x
 license="MPL-2.0"
 makedepends="util-linux-dev zeromq-dev cmake"
 subpackages="$pkgname-static $pkgname-dev"
-source="$pkgname-$pkgver.tar.gz::https://github.com/zeromq/czmq/archive/v$pkgver.tar.gz"
+source="$pkgname-$pkgver.tar.gz::https://github.com/zeromq/czmq/archive/v$pkgver.tar.gz
+	fix-zarmour-empty-string-encoding-decoding.patch
+	fix-zarmour-uninitialized-memory-access.patch
+	"
 
 case "$CARCH" in
 # crypto tests assume MIPS is little-endian
@@ -39,4 +42,6 @@ package() {
 	mv "$pkgdir"/usr/share/cmake "$pkgdir"/usr/lib
 }
 
-sha512sums="d6b6356c07095579e6780386e6c5ead6f87c1f3a80d15afbfaea24a9c108ef13ab750e7dcffbcc4d8528fb5b14b0b28f08008d513b2cf85f2df10b7cf5903212  czmq-4.2.0.tar.gz"
+sha512sums="d6b6356c07095579e6780386e6c5ead6f87c1f3a80d15afbfaea24a9c108ef13ab750e7dcffbcc4d8528fb5b14b0b28f08008d513b2cf85f2df10b7cf5903212  czmq-4.2.0.tar.gz
+a39c24fa74255a628a48cf95598b1bf901fdec0a6d3f794c1759274f351f18b744a2d70119058c3c3444fc6e00716ef1e5c30dc4a3a332b6f970c146fb196122  fix-zarmour-empty-string-encoding-decoding.patch
+e1f9ad3df09c16b6d914faefb3c93e1afe10f44f0c972e49ee7fe2d2b832730bb7376c0384650fcddc93d53caa52b0bd944904631ed3df570c5d91cc9f6777ff  fix-zarmour-uninitialized-memory-access.patch"
diff --git a/main/czmq/fix-zarmour-empty-string-encoding-decoding.patch b/main/czmq/fix-zarmour-empty-string-encoding-decoding.patch
new file mode 100644
index 0000000000000000000000000000000000000000..3622f94d55f8b1d4784c684060f91724e7b4e3ba
--- /dev/null
+++ b/main/czmq/fix-zarmour-empty-string-encoding-decoding.patch
@@ -0,0 +1,30 @@
+From ace06a41da51b1196eef411669343cdf7e8665e2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ste=CC=81phane=20Vale=CC=80s?=
+ <7755128+stvales@users.noreply.github.com>
+Date: Tue, 15 Sep 2020 20:02:47 +0200
+Subject: [PATCH] edit test to properly check encoding/decoding of empty
+ strings
+
+Patch-Source: https://github.com/zeromq/czmq/commit/ace06a41da51b1196eef411669343cdf7e8665e2
+Upstream-Issue: https://github.com/zeromq/czmq/issues/2125
+---
+ src/zarmour.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/zarmour.c b/src/zarmour.c
+index a0ecc4c2c..2860f975c 100644
+--- a/src/zarmour.c
++++ b/src/zarmour.c
+@@ -655,8 +655,10 @@ s_armour_decode (zarmour_t *self, const char *test_string, const char *expected,
+     assert (chunk);
+     if (verbose)
+         zsys_debug ("    decoded '%s' into '%s'", test_string, (char *) zchunk_data (chunk));
+-    assert (zchunk_size (chunk) == strlen (expected) + 1);
+-    assert (streq ((char *) zchunk_data (chunk), expected));
++    assert (zchunk_size (chunk) == strlen (expected) + 1
++            || (strlen (expected) == 0 && zchunk_size (chunk) == 0));
++    assert (streq ((char *) zchunk_data (chunk), expected)
++            || (strlen (expected) == 0 && zchunk_size (chunk) == 0));
+     zchunk_destroy (&chunk);
+ }
+ 
diff --git a/main/czmq/fix-zarmour-uninitialized-memory-access.patch b/main/czmq/fix-zarmour-uninitialized-memory-access.patch
new file mode 100644
index 0000000000000000000000000000000000000000..e138373ddee747208c9650b5020e99058f1e1d08
--- /dev/null
+++ b/main/czmq/fix-zarmour-uninitialized-memory-access.patch
@@ -0,0 +1,28 @@
+From 0c7cac3be12707225d03888a6047e5133d926751 Mon Sep 17 00:00:00 2001
+From: Luca Boccassi <luca.boccassi@gmail.com>
+Date: Wed, 16 Sep 2020 15:11:17 +0100
+Subject: [PATCH] Problem: uninitialized memory access in zarmour_test
+
+Solution: check for size == 0 before dereferencing data pointers
+
+Patch-Source: https://github.com/zeromq/czmq/commit/0c7cac3be12707225d03888a6047e5133d926751
+Upstream-Issue: https://github.com/zeromq/czmq/issues/2125
+---
+ src/zarmour.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/zarmour.c b/src/zarmour.c
+index 2860f975c..273eb54cf 100644
+--- a/src/zarmour.c
++++ b/src/zarmour.c
+@@ -657,8 +657,8 @@ s_armour_decode (zarmour_t *self, const char *test_string, const char *expected,
+         zsys_debug ("    decoded '%s' into '%s'", test_string, (char *) zchunk_data (chunk));
+     assert (zchunk_size (chunk) == strlen (expected) + 1
+             || (strlen (expected) == 0 && zchunk_size (chunk) == 0));
+-    assert (streq ((char *) zchunk_data (chunk), expected)
+-            || (strlen (expected) == 0 && zchunk_size (chunk) == 0));
++    assert ((strlen (expected) == 0 && zchunk_size (chunk) == 0)
++            || streq ((char *) zchunk_data (chunk), expected));
+     zchunk_destroy (&chunk);
+ }
+