mirror of https://github.com/openssl/openssl.git
				
				
				
			Avoid overflow issues in X509_cmp.
The length is a long, so returning the difference does not quite work. Thanks to Torbjörn Granlund for noticing. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
		
							parent
							
								
									a1f41284d7
								
							
						
					
					
						commit
						87a8405b66
					
				|  | @ -187,9 +187,10 @@ int X509_cmp(const X509 *a, const X509 *b) | ||||||
|         return rv; |         return rv; | ||||||
|     /* Check for match against stored encoding too */ |     /* Check for match against stored encoding too */ | ||||||
|     if (!a->cert_info.enc.modified && !b->cert_info.enc.modified) { |     if (!a->cert_info.enc.modified && !b->cert_info.enc.modified) { | ||||||
|         rv = (int)(a->cert_info.enc.len - b->cert_info.enc.len); |         if (a->cert_info.enc.len < b->cert_info.enc.len) | ||||||
|         if (rv) |             return -1; | ||||||
|             return rv; |         if (a->cert_info.enc.len > b->cert_info.enc.len) | ||||||
|  |             return 1; | ||||||
|         return memcmp(a->cert_info.enc.enc, b->cert_info.enc.enc, |         return memcmp(a->cert_info.enc.enc, b->cert_info.enc.enc, | ||||||
|                       a->cert_info.enc.len); |                       a->cert_info.enc.len); | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue