Commit 81180b9b7efdd11cc253ba46d893728061e2ae4e

Thomas de Grivel 2024-03-01T16:59:38

tag_init_1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/libc3/tag.c b/libc3/tag.c
index 084680d..2ed68ab 100644
--- a/libc3/tag.c
+++ b/libc3/tag.c
@@ -285,8 +285,9 @@ s_tag * tag_init_1 (s_tag *tag, const char *p)
   tag_init_void(tag);
   if (! p)
     return tag;
-  buf_init_1(&buf, false, (char *) p);
   len = strlen(p);
+  buf_init(&buf, false, len, (char *) p); // buf is read-only
+  buf.wpos = len;
   r = buf_parse_tag(&buf, tag);
   if (r < 0 || (uw) r != len) {
     err_write_1("invalid tag: \"");