diff options
| author | guenther <> | 2015-02-12 04:26:46 +0000 | 
|---|---|---|
| committer | guenther <> | 2015-02-12 04:26:46 +0000 | 
| commit | ab4a82250d7e3d789db8c65178152714cd439966 (patch) | |
| tree | 98875c7b109fab975797e07c97aa5d1736315fda /src | |
| parent | af58c5a0249197f4588e83704defd69abf588136 (diff) | |
| download | openbsd-ab4a82250d7e3d789db8c65178152714cd439966.tar.gz openbsd-ab4a82250d7e3d789db8c65178152714cd439966.tar.bz2 openbsd-ab4a82250d7e3d789db8c65178152714cd439966.zip | |
qsort() compare functions MUST use memcmp() instead of bcmp() to have
the correct return value.  Prefer memcmp() anyway for portability.
ok jsing@ tedu@
Diffstat (limited to 'src')
| -rw-r--r-- | src/usr.bin/openssl/certhash.c | 6 | 
1 files changed, 4 insertions, 2 deletions
| 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) | |||
| 121 | rv = hia->hash - hib->hash; | 121 | rv = hia->hash - hib->hash; | 
| 122 | if (rv != 0) | 122 | if (rv != 0) | 
| 123 | return (rv); | 123 | return (rv); | 
| 124 | rv = bcmp(hia->fingerprint, hib->fingerprint, sizeof(hia->fingerprint)); | 124 | rv = memcmp(hia->fingerprint, hib->fingerprint, | 
| 125 | sizeof(hia->fingerprint)); | ||
| 125 | if (rv != 0) | 126 | if (rv != 0) | 
| 126 | return (rv); | 127 | return (rv); | 
| 127 | return strcmp(hia->filename, hib->filename); | 128 | return strcmp(hia->filename, hib->filename); | 
| @@ -404,7 +405,8 @@ certhash_index(struct hashinfo *head, const char *name) | |||
| 404 | for (entry = head; entry != NULL; entry = entry->next) { | 405 | for (entry = head; entry != NULL; entry = entry->next) { | 
| 405 | if (last != NULL) { | 406 | if (last != NULL) { | 
| 406 | if (entry->hash == last->hash) { | 407 | if (entry->hash == last->hash) { | 
| 407 | if (bcmp(entry->fingerprint, last->fingerprint, | 408 | if (memcmp(entry->fingerprint, | 
| 409 | last->fingerprint, | ||
| 408 | sizeof(entry->fingerprint)) == 0) { | 410 | sizeof(entry->fingerprint)) == 0) { | 
| 409 | fprintf(stderr, "WARNING: duplicate %s " | 411 | fprintf(stderr, "WARNING: duplicate %s " | 
| 410 | "in %s (using %s), ignoring...\n", | 412 | "in %s (using %s), ignoring...\n", | 
