aboutsummaryrefslogtreecommitdiffstats
path: root/key2root-rmkey.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2023-06-23 16:24:26 +0200
committerMattias Andrée <maandree@kth.se>2023-06-23 16:24:26 +0200
commit2a717740fa534a3a5bd0040ef9606e15bbe7115c (patch)
treee78cd57b48a31c9178d12cac53d0f40a957becf3 /key2root-rmkey.c
parentImplement authentication (diff)
downloadkey2root-2a717740fa534a3a5bd0040ef9606e15bbe7115c.tar.gz
key2root-2a717740fa534a3a5bd0040ef9606e15bbe7115c.tar.bz2
key2root-2a717740fa534a3a5bd0040ef9606e15bbe7115c.tar.xz
Fix mistakes
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'key2root-rmkey.c')
-rw-r--r--key2root-rmkey.c4
1 files changed, 2 insertions, 2 deletions
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));