1
0
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:
Luca Boccassi 2021-08-03 14:53:31 +01:00
parent c7cfde640d
commit 8954e89195

View File

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