tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[PATCH] regex.c: fix assertion



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);


Home | Main Index | Thread Index | Old Index