Skip to content

Commit 28e893e

Browse files
committed
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 <[email protected]>
1 parent 1161e9c commit 28e893e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

secretservice/secretservice.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ GError *get(char *server, char **username, char **secret) {
8383
}
8484
g_free(value);
8585
secretValue = secret_item_get_secret(l->data);
86+
if (secretValue == NULL) {
87+
continue;
88+
}
8689
if (secret != NULL) {
8790
*secret = strdup(secret_value_get(secretValue, &length));
8891
secret_value_unref(secretValue);

0 commit comments

Comments
 (0)