diff --git a/src/lib/ares_str.c b/src/lib/ares_str.c index 54f5afe0..d7d973b9 100644 --- a/src/lib/ares_str.c +++ b/src/lib/ares_str.c @@ -74,8 +74,7 @@ size_t ares_strcpy(char *dest, const char *src, size_t dest_size) if (dest == NULL || dest_size == 0) return 0; - if (src != NULL) - len = strlen(src); + len = ares_strlen(src); if (len >= dest_size) len = dest_size - 1; @@ -84,5 +83,6 @@ size_t ares_strcpy(char *dest, const char *src, size_t dest_size) memcpy(dest, src, len); } + dest[len] = 0; return len; }