void-packages/srcpkgs/musl/patches/mo_lookup.patch

20 lines
659 B
Diff

Do not crash with a NULL pointer dereference when dcngettext()
is called with NULL msgid[12] arguments.
Fix for https://github.com/void-linux/void-packages/issues/12042
and probably others.
--xtraeme
--- src/locale/__mo_lookup.c.orig 2019-06-26 09:55:36.843012674 +0200
+++ src/locale/__mo_lookup.c 2019-06-26 09:56:11.529443955 +0200
@@ -13,7 +13,7 @@ const char *__mo_lookup(const void *p, s
uint32_t b = 0, n = swapc(mo[2], sw);
uint32_t o = swapc(mo[3], sw);
uint32_t t = swapc(mo[4], sw);
- if (n>=size/4 || o>=size-4*n || t>=size-4*n || ((o|t)%4))
+ if (!s || n>=size/4 || o>=size-4*n || t>=size-4*n || ((o|t)%4))
return 0;
o/=4;
t/=4;