From 64e0d26cf85390a9ce1b18043f2c4ac8237a4f80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= Date: Thu, 26 Mar 2026 20:12:29 +0100 Subject: [PATCH] lysp_ext_instance_path_append: prevent undefined behavior As ASAN's UBSAN correctly reports (runtime error: applying zero offset to null pointer), a null pointer cannot be added to or subtracted from. --- src/tree_schema.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tree_schema.c b/src/tree_schema.c index 4666633cc..1eb16c54d 100644 --- a/src/tree_schema.c +++ b/src/tree_schema.c @@ -1526,7 +1526,7 @@ lysp_ext_instance_path_append(char **buf, uint32_t *size, const char *format, .. /* learn the required length */ va_start(ap, format); - len = vsnprintf(*buf + *size, 0, format, ap); + len = vsnprintf(*buf ? *buf + *size : NULL, 0, format, ap); va_end(ap); /* realloc */