mirror of
https://github.com/systemd/systemd.git
synced 2024-10-30 14:55:37 +03:00
creds: assert that credential read from file fits in data struct
Coverity CID#1458114
This commit is contained in:
parent
c7cfde640d
commit
8954e89195
@ -299,6 +299,8 @@ int get_credential_host_secret(CredentialSecretFlags flags, void **ret, size_t *
|
||||
if (ret) {
|
||||
void *copy;
|
||||
|
||||
assert(sz <= sizeof(f->data)); /* Ensure we don't read past f->data bounds */
|
||||
|
||||
copy = memdup(f->data, sz);
|
||||
if (!copy)
|
||||
return -ENOMEM;
|
||||
|
Loading…
Reference in New Issue
Block a user