From c0004ed7d52caff7b5620635173c02143b02f07a Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 4 Jan 2025 23:21:04 +0900 Subject: [PATCH] [plist] Always calc string length Making the string length calc based on !json was a mistake that resulted in running off the end of the dstring. --- libs/util/plist.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libs/util/plist.c b/libs/util/plist.c index da294d07b..0525c84e3 100644 --- a/libs/util/plist.c +++ b/libs/util/plist.c @@ -1334,12 +1334,10 @@ write_string (dstring_t *dstr, const char *str, bool json) char *dst; bool quoted = json; - if (!quoted) { - for (s = str; *s; s++) { - if (is_quotable (*s)) - quoted = true; - len++; - } + for (s = str; *s; s++) { + if (is_quotable (*s)) + quoted = true; + len++; } if (!quoted) { dst = dstring_openstr (dstr, len);