summaryrefslogtreecommitdiffstats
path: root/ssl/s3_lib.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2017-07-08 22:13:24 +0200
committerRichard Levitte <levitte@openssl.org>2017-07-08 22:13:24 +0200
commita7ff57965b81ce4fd73a18266ce29abf6b909fdb (patch)
treedca47b76158cecaeb41c86632a6f1821c37d7276 /ssl/s3_lib.c
parent04256277cb9dddedd77965f19107c6c3935e8b96 (diff)
Fix cipher_compare
Unsigned overflow. Found by Brian Carpenter Fixes #3889 Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3890)
Diffstat (limited to 'ssl/s3_lib.c')
-rw-r--r--ssl/s3_lib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
index d7b8fb03bc..c3adc87268 100644
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
@@ -2793,7 +2793,9 @@ static int cipher_compare(const void *a, const void *b)
const SSL_CIPHER *ap = (const SSL_CIPHER *)a;
const SSL_CIPHER *bp = (const SSL_CIPHER *)b;
- return ap->id - bp->id;
+ if (ap->id == bp->id)
+ return 0;
+ return ap->id < bp->id ? -1 : 1;
}
void ssl_sort_cipher_list(void)