From 4c90f9078b0f7ac8fc1b49bc86af9212731403b4 Mon Sep 17 00:00:00 2001 From: apio Date: Thu, 26 Jan 2023 21:40:57 +0100 Subject: [PATCH] fix: Use memcpy() in minitar_strlcpy() This allows the platform to provide a more optimized and FAST version of memcpy than our manual implementation inside strlcpy. --- src/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.c b/src/util.c index e0e455a..445f242 100644 --- a/src/util.c +++ b/src/util.c @@ -45,7 +45,7 @@ static size_t minitar_strlcpy(char* dest, const char* src, size_t size) len = full_len = strlen(src); if (size == 0) return len; if (len > (size - 1)) len = size - 1; - for (size_t i = 0; i < len; ++i) { *(dest + i) = *(src + i); } + memcpy(dest, src, len); dest[len] = 0; // null-terminate return full_len; }