From: Vladimir 'phcoder' Serbinenko Date: Sun, 27 Dec 2009 21:29:22 +0000 (+0100) Subject: Prevent NULL dereferencing when unregistering ciphers X-Git-Tag: 1.98~212^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3851cc386e1d98f5407fadc2932815f0f6831205;p=thirdparty%2Fgrub.git Prevent NULL dereferencing when unregistering ciphers --- diff --git a/lib/crypto.c b/lib/crypto.c index 021560d6c..d11f0994f 100644 --- a/lib/crypto.c +++ b/lib/crypto.c @@ -59,7 +59,10 @@ grub_cipher_unregister (gcry_cipher_spec_t *cipher) gcry_cipher_spec_t **ciph; for (ciph = &grub_ciphers; *ciph; ciph = &((*ciph)->next)) if (*ciph == cipher) - *ciph = (*ciph)->next; + { + *ciph = (*ciph)->next; + break; + } } void @@ -75,7 +78,10 @@ grub_md_unregister (gcry_md_spec_t *cipher) gcry_md_spec_t **ciph; for (ciph = &grub_digests; *ciph; ciph = &((*ciph)->next)) if (*ciph == cipher) - *ciph = (*ciph)->next; + { + *ciph = (*ciph)->next; + break; + } } void