]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
check for a valid blocksize prior to entering loop
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 15 Nov 2013 08:54:26 +0000 (09:54 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 15 Nov 2013 08:55:46 +0000 (09:55 +0100)
lib/gnutls_state.c

index a609fb97a503df6a96de80e5cfa9400fe6816c7c..231e6b0b64aa028944bcace1f1ede41c571462e0 100644 (file)
@@ -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;