From 65f279dc1e82d2150db92060d8883bb4cf840825 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 17 Oct 2019 09:12:12 -0700 Subject: [PATCH] util: Use memcpy instead of strncpy The sub-string copied here will never have NULL terminators, so use memcpy here to make this clearer. --- src/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.c b/src/util.c index f787ce6b..cce2a90b 100644 --- a/src/util.c +++ b/src/util.c @@ -173,7 +173,7 @@ const char *util_get_domain(const char *identity) for (c = identity; *c; c++) { switch (*c) { case '\\': - strncpy(domain, identity, c - identity); + memcpy(domain, identity, c - identity); return domain; case '@': strcpy(domain, c + 1); @@ -200,7 +200,7 @@ const char *util_get_username(const char *identity) strcpy(username, c + 1); return username; case '@': - strncpy(username, identity, c - identity); + memcpy(username, identity, c - identity); return username; default: continue;