Re: [PATCH] protect against buggy drivers

From: Greg KH
Date: Fri Oct 08 2004 - 13:47:46 EST


On Fri, Oct 08, 2004 at 02:31:27PM -0400, Richard B. Johnson wrote:
>
> In the meantime, can we do something like:
>
> --- linux-2.6.8/fs/char_dev.c.orig 2004-10-08 14:24:03.838389344 -0400
> +++ linux-2.6.8/fs/char_dev.c 2004-10-08 14:26:51.059967800 -0400
> @@ -206,7 +206,7 @@
>
> cdev->owner = fops->owner;
> cdev->ops = fops;
> - strcpy(cdev->kobj.name, name);
> + strncpy(cdev->kobj.name, name, KOBJ_NAME_LEN-1);
> for (s = strchr(cdev->kobj.name, '/'); s; s = strchr(s, '/'))
> *s = '!';

No, that's still wrong. Use Stephen's other patch instead.

thanks,

greg k-h
-
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/