]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
xstring: prevent null pointer dereference
authorBaptiste Daroussin <bapt@FreeBSD.org>
Tue, 20 Jun 2023 07:59:12 +0000 (09:59 +0200)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Tue, 20 Jun 2023 07:59:12 +0000 (09:59 +0200)
include/xstring.h

index 24738a66da02fc3c532892ff18caab426d25dcb4..8c348ad2027ba492b0ea8496b9b9c215d022b485 100644 (file)
@@ -59,6 +59,8 @@ do {                          \
 static inline char *
 xstring_get(xstring *str)
 {
+       if (str == NULL)
+               return (NULL);
        fclose(str->fp);
        char *ret = str->buf;
        free(str);