From 7f8e5b892d697f858d84b12b84b26979ac264f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 19 Feb 2022 16:32:59 +0100 Subject: [PATCH] core: call strdup in string_strndup if bytes equals strlen of string --- src/core/wee-string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/wee-string.c b/src/core/wee-string.c index f0566bf2f..f514f55f0 100644 --- a/src/core/wee-string.c +++ b/src/core/wee-string.c @@ -82,7 +82,7 @@ string_strndup (const char *string, int bytes) if (!string || (bytes < 0)) return NULL; - if ((int)strlen (string) < bytes) + if ((int)strlen (string) <= bytes) return strdup (string); result = malloc (bytes + 1);