]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super0.c
super0: fix crash on assemble if homehost is not set.
[thirdparty/mdadm.git] / super0.c
index 2b4942f4ecdfa28c40cdefdcec89567451773219..07f47924eae0bbbe15be9ef5a09ea5b518c7a980 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -305,9 +305,13 @@ static int match_home0(struct supertype *st, char *homehost)
 {
        mdp_super_t *sb = st->sb;
        char buf[20];
-       char *hash = sha1_buffer(homehost,
-                                strlen(homehost),
-                                buf);
+       char *hash;
+
+       if (!homehost)
+               return 0;
+       hash = sha1_buffer(homehost,
+                          strlen(homehost),
+                          buf);
 
        return (memcmp(&sb->set_uuid2, hash, 8)==0);
 }