Re: [PATCH] fs - fix name overwrite in __register_chrdev_region

From: Cyrill Gorcunov
Date: Tue Dec 16 2008 - 01:45:41 EST


On Tue, Dec 16, 2008 at 8:57 AM, Andrew Morton
<akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> OK.
>
> strlcpy() prodces a more pleasing result:
>
> --- a/fs/char_dev.c~fs-fix-name-overwrite-in-__register_chrdev_region
> +++ a/fs/char_dev.c
> @@ -120,7 +120,7 @@ __register_chrdev_region(unsigned int ma
> cd->major = major;
> cd->baseminor = baseminor;
> cd->minorct = minorct;
> - strncpy(cd->name,name, 64);
> + strlcpy(cd->name, name, sizeof(cd->name));
>
> i = major_to_index(major);
>
> _
>

Thanks, Andrew!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/