Skip to content

Commit 10d7943

Browse files
committed
util: allocate null terminator on fresh str
This has been a lurking issue for a while. I think there were just never any cases where an empty str got used.
1 parent 4409b45 commit 10d7943

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

waywall/util/str.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ str_free(str str) {
4646

4747
str
4848
str_new() {
49-
struct hdr *hdr = zalloc(1, sizeof(*hdr));
49+
struct hdr *hdr = zalloc(1, sizeof(*hdr) + 1);
5050
return hdrstr(hdr);
5151
}

0 commit comments

Comments
 (0)