From ebe9fc5771f976c889dadb259e381d01b70aaee3 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sat, 8 Jan 2022 17:55:46 -0500 Subject: [PATCH] [kservice] fix the problem of rt_strlen crashed in win32 --- src/kservice.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/kservice.c b/src/kservice.c index f112ec92de..b992c7e6e1 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -461,7 +461,17 @@ RTM_EXPORT(rt_strncpy); */ char *rt_strcpy(char *dst, const char *src) { - return rt_strncpy(dst, src, (rt_size_t)-1); + char *dest = dst; + + while (*src != '\0') + { + *dst = *src; + dst++; + src++; + } + + *dst = '\0'; + return dest; } RTM_EXPORT(rt_strcpy);