1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-13 16:01:28 +05:30

secretservice: fix null derefence on locked collections

secret_item_get_secret() may return null if an item is locked or not loaded.
While we set SECRET_SEARCH_LOAD_SECRETS and SECRET_SEARCH_UNLOCK, there may
still be locked items, for example the user may refuse the unlock request.

So we still need to check if the secret data is NULL before we can try to
reference it.

Signed-off-by: Moritz "WanzenBug" Wanzenböck <moritz@wanzenbug.xyz>
This commit is contained in:
Moritz "WanzenBug" Wanzenböck
2025-02-19 15:56:07 +01:00
parent 1161e9c157
commit 28e893e56d
+3
View File
@@ -83,6 +83,9 @@ GError *get(char *server, char **username, char **secret) {
}
g_free(value);
secretValue = secret_item_get_secret(l->data);
if (secretValue == NULL) {
continue;
}
if (secret != NULL) {
*secret = strdup(secret_value_get(secretValue, &length));
secret_value_unref(secretValue);