errbuf is only required to be non-NULL if errbuf_size != 0.

diff --git a/lib/libc/regex/regerror.c b/lib/libc/regex/regerror.c
index 262144220f3b..fe553a8f3327 100644
--- a/lib/libc/regex/regerror.c
+++ b/lib/libc/regex/regerror.c
@@ -139,7 +139,7 @@ regerror(int errcode,
        char convbuf[50];

        _DIAGASSERT(errcode != REG_ATOI || preg != NULL);
-       _DIAGASSERT(errbuf != NULL);
+       _DIAGASSERT(errbuf_size == 0 || errbuf != NULL);

        if (errcode == REG_ATOI) {
                s = regatoi(preg, convbuf, sizeof convbuf);

Reply via email to