commit 65f279dc1e82d2150db92060d8883bb4cf840825
parent 6b8f566498156981d01c39a4198a50949cd3a6f1
Author: James Prestwood <prestwoj@gmail.com>
Date: Thu, 17 Oct 2019 09:12:12 -0700
util: Use memcpy instead of strncpy
The sub-string copied here will never have NULL terminators, so use
memcpy here to make this clearer.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git 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;