From: Michał Kępień Date: Mon, 13 Jan 2020 05:03:00 +0000 Subject: Handle catopen() errors musl libc's implementation of catgets() crashes when its first argument is -1 instead of a proper message catalog descriptor. Prevent that from happening by making isc_msgcat_get() return the default text if the prior call to catopen() returns an error. Porting forward upstream's fix: https://gitlab.isc.org/isc-projects/bind9/-/commit/daade37977fafee12c7b3c1483516e010d2b74a6 --- --- a/bind/bind-9.11.14/lib/isc/nls/msgcat.c +++ b/bind/bind-9.11.14/lib/isc/nls/msgcat.c @@ -62,9 +62,8 @@ #ifdef HAVE_CATGETS /* - * We don't check if catopen() fails because we don't care. - * If it does fail, then when we call catgets(), it will use - * the default string. + * We don't check if catopen() fails because isc_msgcat_get() takes + * care of that before calling catgets(). */ msgcat->catalog = catopen(name, 0); #endif @@ -112,7 +111,7 @@ REQUIRE(default_text != NULL); #ifdef HAVE_CATGETS - if (msgcat == NULL) + if (msgcat == NULL || msgcat->catalog == (nl_catd)(-1)) return (default_text); return (catgets(msgcat->catalog, set, message, default_text)); #else