ALSA: Limit the fallback card id string size
[pandora-kernel.git] / sound / core / init.c
index 6b90871..1351f22 100644 (file)
@@ -66,7 +66,7 @@ static int module_slot_match(struct module *module, int idx)
 #ifdef MODULE
        const char *s1, *s2;
 
-       if (!module || !module->name || !slots[idx])
+       if (!module || !*module->name || !slots[idx])
                return 0;
 
        s1 = module->name;
@@ -597,7 +597,7 @@ static void snd_card_set_id_no_lock(struct snd_card *card, const char *src,
        /* last resort... */
        snd_printk(KERN_ERR "unable to set card id (%s)\n", id);
        if (card->proc_root->name)
-               strcpy(card->id, card->proc_root->name);
+               strlcpy(card->id, card->proc_root->name, sizeof(card->id));
 }
 
 /**