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:56:28 +01:00
parent c7cfde640d
commit 8954e89195
+2
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;