Re: [PATCH] 2.5.31 driverfs: patch for your consideration

David D. Hagood (wowbagger@sktc.net)
Sat, 17 Aug 2002 08:52:03 -0500


Adam Belay wrote:

> +static ssize_t device_read_driver(struct device * dev, char * buf,
> size_t count, loff_t off)
> +{
> + if (dev->driver)
> + return off ? 0 : sprintf(buf,"%s\n",dev->driver->name);

You aren't checking that the name will fit in the supplied buffer - what
is there isn't enough space? Shouldn't you either use snprintf, a
strncpy, or a maximum field width in the sprintf?

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