From fe1fc9864cf2c216a91e940aaf7b2739ff6729b3 Mon Sep 17 00:00:00 2001 From: klemek Date: Sat, 16 May 2026 15:39:17 +0200 Subject: [PATCH] fix: string_replace_at check args validity --- src/string.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/string.c b/src/string.c index 6eb5e18..1426def 100644 --- a/src/string.c +++ b/src/string.c @@ -62,6 +62,10 @@ char *string_replace_at(const char *src, unsigned int from, unsigned int to, unsigned long rpl_len; char *dst; + if (to < from) { + return ""; + } + src_len = strnlen(src, STR_LEN * STR_LEN); rpl_len = strnlen(rpl, STR_LEN * STR_LEN);