From: Nikos Mavrogiannopoulos Date: Fri, 15 Nov 2013 08:54:26 +0000 (+0100) Subject: check for a valid blocksize prior to entering loop X-Git-Tag: gnutls_3_3_0pre0~596 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=33cda206abc5f77d7797902fcea9297e47db4c8d;p=thirdparty%2Fgnutls.git check for a valid blocksize prior to entering loop --- diff --git a/lib/gnutls_state.c b/lib/gnutls_state.c index a609fb97a5..231e6b0b64 100644 --- a/lib/gnutls_state.c +++ b/lib/gnutls_state.c @@ -777,13 +777,13 @@ P_hash(gnutls_mac_algorithm_t algorithm, int output_bytes, result; const mac_entry_st *me = mac_to_entry(algorithm); - if (seed_size > MAX_SEED_SIZE || total_bytes <= 0) { + blocksize = _gnutls_mac_get_algo_len(me); + + if (seed_size > MAX_SEED_SIZE || total_bytes <= 0 || blocksize == 0) { gnutls_assert(); return GNUTLS_E_INTERNAL_ERROR; } - blocksize = _gnutls_mac_get_algo_len(me); - output_bytes = 0; do { output_bytes += blocksize;