From a0629970a80f4f7ea0c67a1f981a5ba69ff9f238 Mon Sep 17 00:00:00 2001 From: guenther <> Date: Thu, 12 Feb 2015 04:26:46 +0000 Subject: qsort() compare functions MUST use memcmp() instead of bcmp() to have the correct return value. Prefer memcmp() anyway for portability. ok jsing@ tedu@ --- src/usr.bin/openssl/certhash.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/usr.bin/openssl/certhash.c b/src/usr.bin/openssl/certhash.c index a7a42d7f59..7458add906 100644 --- a/src/usr.bin/openssl/certhash.c +++ b/src/usr.bin/openssl/certhash.c @@ -121,7 +121,8 @@ hashinfo_compare(const void *a, const void *b) rv = hia->hash - hib->hash; if (rv != 0) return (rv); - rv = bcmp(hia->fingerprint, hib->fingerprint, sizeof(hia->fingerprint)); + rv = memcmp(hia->fingerprint, hib->fingerprint, + sizeof(hia->fingerprint)); if (rv != 0) return (rv); return strcmp(hia->filename, hib->filename); @@ -404,7 +405,8 @@ certhash_index(struct hashinfo *head, const char *name) for (entry = head; entry != NULL; entry = entry->next) { if (last != NULL) { if (entry->hash == last->hash) { - if (bcmp(entry->fingerprint, last->fingerprint, + if (memcmp(entry->fingerprint, + last->fingerprint, sizeof(entry->fingerprint)) == 0) { fprintf(stderr, "WARNING: duplicate %s " "in %s (using %s), ignoring...\n", -- cgit v1.2.3-55-g6feb