]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Prevent NULL dereferencing when unregistering ciphers
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 27 Dec 2009 21:29:22 +0000 (22:29 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 27 Dec 2009 21:29:22 +0000 (22:29 +0100)
lib/crypto.c

index 021560d6cf9d67d1002458814eda709524f7da13..d11f0994f9f093ed3f76bc4c7f057a1a6d174ddd 100644 (file)
@@ -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