From 2a717740fa534a3a5bd0040ef9606e15bbe7115c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 23 Jun 2023 16:24:26 +0200 Subject: Fix mistakes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- key2root-rmkey.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'key2root-rmkey.c') diff --git a/key2root-rmkey.c b/key2root-rmkey.c index 1b4a366..f44cf06 100644 --- a/key2root-rmkey.c +++ b/key2root-rmkey.c @@ -45,7 +45,7 @@ removekeys(char *data, size_t *wheadp, size_t *rheadp, size_t *rhead2p, size_t * size_t len, klen; size_t i; - while (*rhead2p < *wheadp || data[*rhead2p] != '\n') + while (*rhead2p < *wheadp && data[*rhead2p] != '\n') ++*rhead2p; if (data[*rhead2p] != '\n') @@ -68,7 +68,7 @@ removekeys(char *data, size_t *wheadp, size_t *rheadp, size_t *rhead2p, size_t * } else { for (i = 0; i < *nkeysp; i++) { klen = strlen(keys[i]); - if (klen >= len || data[*rheadp + klen] != ' ' || memcpy(&data[*rheadp], keys[i], klen)) + if (klen >= len || data[*rheadp + klen] != ' ' || memcmp(&data[*rheadp], keys[i], klen)) continue; /* retain key order so that they are output in the provided order if not found */ memmove(&keys[i], &keys[i + 1], (--*nkeysp - i) * sizeof(*keys)); -- cgit v1.2.3-70-g09d2