From: Mark Wooding Date: Thu, 21 Nov 2019 17:43:51 +0000 (+0000) Subject: key/key-data.c (key_copydata): Fix catastrophic bug. X-Git-Tag: 2.4.5~19 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/catacomb/commitdiff_plain/b1182cd3f0e7369aec459444949ee504929e89c4 key/key-data.c (key_copydata): Fix catastrophic bug. The fundamental problem is that the key-encoding test has the wrong sense. The result is that we end up (only) trying to iterate over non- structured keys, which results in an assertion failure. Also, switch things around so that we check the encoding type before checking the flags. --- diff --git a/key/key-data.c b/key/key-data.c index 3a0b7351..cd5c8d78 100644 --- a/key/key-data.c +++ b/key/key-data.c @@ -428,8 +428,8 @@ static int structmatchp(key_data *k, const key_filter *kf) { key_subkeyiter i; - if (!KEY_MATCH(k, kf)) return (0); - else if ((k->e & KF_ENCMASK) == KENC_STRUCT) return (1); + if ((k->e & KF_ENCMASK) != KENC_STRUCT) + return (KEY_MATCH(k, kf)); else { for (key_mksubkeyiter(&i, k); key_nextsubkey(&i, 0, &k); ) if (!structmatchp(k, kf)) return (0);