diff --git a/crypto/asn1/asn_mime.c b/crypto/asn1/asn_mime.c index 6d8a9bf90f1d3d0ae502c8356d5ac25d7e8c89cc..54a704a969ead5e66680da2e712aed00ae3101dc 100644 --- a/crypto/asn1/asn_mime.c +++ b/crypto/asn1/asn_mime.c @@ -862,9 +862,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)); } @@ -872,6 +871,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)); }