greybus: interface: fix potential attribute-buffer overflow
authorJohan Hovold <johan@hovoldconsulting.com>
Tue, 1 Sep 2015 10:25:27 +0000 (12:25 +0200)
committerJohan Hovold <johan@hovoldconsulting.com>
Wed, 2 Sep 2015 08:47:55 +0000 (10:47 +0200)
commit505c9d27b804f2b1e1e6432a89876df197432bbe
tree30c5d3397d8a1b6c5af54d220180cffa0e20b78e
parent287bba82fe2f74dd89f7f24f2da438a7974e57af
greybus: interface: fix potential attribute-buffer overflow

Use scnprintf in the generic attribute helper, which does not currently
check for buffer overflow.

The attribute helper is used to print generic strings, which could
potentially overflow the buffer. Note that the only strings currently
exported are taken from greybus string descriptors and should therefore
be limited to 255 chars.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
drivers/staging/greybus/interface.c