From 215276243d74b89fc8c28509d16dd2a107c65946 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Mon, 12 Mar 2012 15:25:53 +0000 Subject: [PATCH] corrected fix to PR#2711 and also cover mime_param_cmp --- crypto/asn1/asn_mime.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crypto/asn1/asn_mime.c b/crypto/asn1/asn_mime.c index 0a9989def2..ad8fbed907 100644 --- a/crypto/asn1/asn_mime.c +++ b/crypto/asn1/asn_mime.c @@ -790,9 +790,8 @@ static int mime_hdr_addparam(MIME_HEADER *mhdr, char *name, char *value) static int mime_hdr_cmp(const MIME_HEADER * const *a, const MIME_HEADER * const *b) { - if ((*a)->name == NULL || (*b)->name == NULL) - return (*a)->name - (*b)->name < 0 ? -1 : - (*a)->name - (*b)->name > 0 ? 1 : 0; + if (!(*a)->name || !(*b)->name) + return !!(*a)->name - !!(*b)->name; return(strcmp((*a)->name, (*b)->name)); } @@ -800,6 +799,8 @@ static int mime_hdr_cmp(const MIME_HEADER * const *a, static int mime_param_cmp(const MIME_PARAM * const *a, const MIME_PARAM * const *b) { + if (!(*a)->param_name || !(*b)->param_name) + return !!(*a)->param_name - !!(*b)->param_name; return(strcmp((*a)->param_name, (*b)->param_name)); } -- 2.25.1