summaryrefslogtreecommitdiffhomepage
path: root/src/internal
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2022-10-24 19:48:58 +0000
committermidipix <writeonce@midipix.org>2022-10-30 16:24:17 +0000
commit6dc70d02aa1767532f0339e7e335d544edced1c8 (patch)
tree0f51d1f2265a11ac6cad2ad73add139c3c540b9d /src/internal
parentfcced56a2b9ae4305a15de0c640b5d01be4e58c2 (diff)
downloadntux-6dc70d02aa1767532f0339e7e335d544edced1c8.tar.bz2
ntux-6dc70d02aa1767532f0339e7e335d544edced1c8.tar.xz
ntux_strcpy(): null-terminate the destination string.
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/ntux_nolibc_impl.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/internal/ntux_nolibc_impl.c b/src/internal/ntux_nolibc_impl.c
index b543582..e20d046 100644
--- a/src/internal/ntux_nolibc_impl.c
+++ b/src/internal/ntux_nolibc_impl.c
@@ -18,9 +18,13 @@ void * ntux_memset(void * ch, int c, size_t n)
char * ntux_strcpy(char * dst, const char * src)
{
- return __xfi_memcpy(
- dst,src,
- __xfi_strlen(src));
+ size_t srclen;
+
+ srclen = __xfi_strlen(src);
+ __xfi_memcpy(dst,src,srclen);
+ dst[srclen] = '\0';
+
+ return dst;
}
size_t ntux_strlen(const char * ch)