mirror of https://github.com/openssl/openssl.git
				
				
				
			More correctly handle a selected_len of 0 when processing NPN
In the case where the NPN callback returns with SSL_TLEXT_ERR_OK, but the selected_len is 0 we should fail. Previously this would fail with an internal_error alert because calling OPENSSL_malloc(selected_len) will return NULL when selected_len is 0. We make this error detection more explicit and return a handshake failure alert. Follow on from CVE-2024-5535 Reviewed-by: Neil Horman <nhorman@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/24718)
This commit is contained in:
		
							parent
							
								
									4ada436a19
								
							
						
					
					
						commit
						4279c89a72
					
				|  | @ -1536,7 +1536,8 @@ int tls_parse_stoc_npn(SSL *s, PACKET *pkt, unsigned int context, X509 *x, | ||||||
|                                   PACKET_data(pkt), |                                   PACKET_data(pkt), | ||||||
|                                   PACKET_remaining(pkt), |                                   PACKET_remaining(pkt), | ||||||
|                                   s->ctx->ext.npn_select_cb_arg) != |                                   s->ctx->ext.npn_select_cb_arg) != | ||||||
|              SSL_TLSEXT_ERR_OK) { |                                   SSL_TLSEXT_ERR_OK | ||||||
|  |             || selected_len == 0) { | ||||||
|         SSLfatal(s, SSL_AD_HANDSHAKE_FAILURE, SSL_R_BAD_EXTENSION); |         SSLfatal(s, SSL_AD_HANDSHAKE_FAILURE, SSL_R_BAD_EXTENSION); | ||||||
|         return 0; |         return 0; | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue