Skip to content

Commit 25635de

Browse files
jktjktmichalvasko
authored andcommitted
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.
1 parent d387d1f commit 25635de

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/tree_schema.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,7 @@ lysp_ext_instance_path_append(char **buf, uint32_t *size, const char *format, ..
15261526

15271527
/* learn the required length */
15281528
va_start(ap, format);
1529-
len = vsnprintf(*buf + *size, 0, format, ap);
1529+
len = vsnprintf(*buf ? *buf + *size : NULL, 0, format, ap);
15301530
va_end(ap);
15311531

15321532
/* realloc */

0 commit comments

Comments
 (0)