summaryrefslogtreecommitdiffstats
path: root/include/import
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:20:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:20:30 +0000
commitddfc40eabdbc59a607b568e946fb116dcd3439fd (patch)
treeb3253de65399448dbbf12e5b65d2da56c53d3af6 /include/import
parentAdding upstream version 2.9.6. (diff)
downloadhaproxy-ddfc40eabdbc59a607b568e946fb116dcd3439fd.tar.xz
haproxy-ddfc40eabdbc59a607b568e946fb116dcd3439fd.zip
Adding upstream version 2.9.7.upstream/2.9.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--include/import/ist.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/include/import/ist.h b/include/import/ist.h
index 16b8616..e4e1425 100644
--- a/include/import/ist.h
+++ b/include/import/ist.h
@@ -939,15 +939,12 @@ static inline void istfree(struct ist *ist)
*/
static inline struct ist istdup(const struct ist src)
{
- const size_t src_size = src.len;
-
- /* Allocate at least 1 byte to allow duplicating an empty string with
- * malloc implementations that return NULL for a 0-size allocation.
- */
- struct ist dst = istalloc(src_size ? src_size : 1);
+ /* Allocate 1 extra byte to add an extra \0 delimiter. */
+ struct ist dst = istalloc(src.len + 1);
if (isttest(dst)) {
- istcpy(&dst, src, src_size);
+ istcpy(&dst, src, src.len);
+ dst.ptr[dst.len] = '\0';
}
return dst;