On Fri, 2017-09-22 at 08:04 +0200, Hannes Reinecke wrote:
> +static ssize_t
> +sdev_show_blacklist(struct device *dev, struct device_attribute *attr,
> +                 char *buf)
> +{

Please make this function accept the output buffer size as fourth argument.

> +             if (len)
> +                     len += snprintf(buf + len, 2, " ");
> +
> +             if (name)
> +                     len += snprintf(buf + len, strlen(name) + 1,
> +                                     "%s", name);
> +             else
> +                     len += snprintf(buf + len, 67,
> +                                     "INVALID_BIT(%d)", i);
+       }
> +     if (len)
> +             len += snprintf(buf + len, 2, "\n");

Please adjust the snprintf() statements such that no buffer overflow can be
triggered.

Thanks,

Bart.

Reply via email to