mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-20 17:54:05 +01:00
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:
parent
6b8f566498
commit
65f279dc1e
@ -173,7 +173,7 @@ const char *util_get_domain(const char *identity)
|
|||||||
for (c = identity; *c; c++) {
|
for (c = identity; *c; c++) {
|
||||||
switch (*c) {
|
switch (*c) {
|
||||||
case '\\':
|
case '\\':
|
||||||
strncpy(domain, identity, c - identity);
|
memcpy(domain, identity, c - identity);
|
||||||
return domain;
|
return domain;
|
||||||
case '@':
|
case '@':
|
||||||
strcpy(domain, c + 1);
|
strcpy(domain, c + 1);
|
||||||
@ -200,7 +200,7 @@ const char *util_get_username(const char *identity)
|
|||||||
strcpy(username, c + 1);
|
strcpy(username, c + 1);
|
||||||
return username;
|
return username;
|
||||||
case '@':
|
case '@':
|
||||||
strncpy(username, identity, c - identity);
|
memcpy(username, identity, c - identity);
|
||||||
return username;
|
return username;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user