Skip to content

Commit 0728d9c

Browse files
committed
Fix two bugs in PostRemoveId agent identity removal
Fix inverted WMEMCMP check that removed non-matching entries and kept matching ones. WMEMCMP returns 0 on match, so the condition was backwards. Fix head-of-list removal setting idList to NULL instead of cur->next, which dropped all remaining entries after the removed one
1 parent 4cb8d1e commit 0728d9c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/agent.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,15 +590,15 @@ static int PostRemoveId(WOLFSSH_AGENT_CTX* agent,
590590
int match;
591591

592592
match = WMEMCMP(id, cur->id, WC_SHA256_DIGEST_SIZE);
593-
if (!match) {
593+
if (match) {
594594
prev = cur;
595595
cur = cur->next;
596596
}
597597
else {
598598
if (prev != NULL)
599599
prev->next = cur->next;
600600
else
601-
agent->idList = NULL;
601+
agent->idList = cur->next;
602602

603603
wolfSSH_AGENT_ID_free(cur, agent->heap);
604604
cur = NULL;

0 commit comments

Comments
 (0)