Prevent NULL dereferencing when unregistering ciphers

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-27 22:29:22 +01:00
parent a2e77ce455
commit 3851cc386e

View file

@ -59,7 +59,10 @@ grub_cipher_unregister (gcry_cipher_spec_t *cipher)
gcry_cipher_spec_t **ciph; gcry_cipher_spec_t **ciph;
for (ciph = &grub_ciphers; *ciph; ciph = &((*ciph)->next)) for (ciph = &grub_ciphers; *ciph; ciph = &((*ciph)->next))
if (*ciph == cipher) if (*ciph == cipher)
*ciph = (*ciph)->next; {
*ciph = (*ciph)->next;
break;
}
} }
void void
@ -75,7 +78,10 @@ grub_md_unregister (gcry_md_spec_t *cipher)
gcry_md_spec_t **ciph; gcry_md_spec_t **ciph;
for (ciph = &grub_digests; *ciph; ciph = &((*ciph)->next)) for (ciph = &grub_digests; *ciph; ciph = &((*ciph)->next))
if (*ciph == cipher) if (*ciph == cipher)
*ciph = (*ciph)->next; {
*ciph = (*ciph)->next;
break;
}
} }
void void