util: Use memcpy instead of strncpy

The sub-string copied here will never have NULL terminators, so use
memcpy here to make this clearer.
This commit is contained in:
James Prestwood 2019-10-17 09:12:12 -07:00 committed by Denis Kenzior
parent 6b8f566498
commit 65f279dc1e
1 changed files with 2 additions and 2 deletions

View File

@ -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;