usb: gadget: android: Fix product name
authorBenoit Goby <benoit@android.com>
Tue, 29 May 2012 20:57:27 +0000 (13:57 -0700)
committerBenoit Goby <benoit@android.com>
Tue, 29 May 2012 22:21:48 +0000 (15:21 -0700)
Product names may contain spaces and scanf %s only matches the 1st word.
Use strlcpy instead.

Change-Id: Ie8703fea9775f7fc17fe615a42597ca3816d36b0
Signed-off-by: Benoit Goby <benoit@android.com>
drivers/usb/gadget/android.c

index 3abc53afff3ebf09094551c6a2c9f957c9a49af7..1236d6f593d3b2f5663c2b44329fe416df5d5be9 100644 (file)
@@ -1083,10 +1083,7 @@ field ## _store(struct device *dev, struct device_attribute *attr,       \
                const char *buf, size_t size)                           \
 {                                                                      \
        if (size >= sizeof(buffer)) return -EINVAL;                     \
-       if (sscanf(buf, "%s", buffer) == 1) {                           \
-               return size;                                            \
-       }                                                               \
-       return -1;                                                      \
+       return strlcpy(buffer, buf, sizeof(buffer));                    \
 }                                                                      \
 static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, field ## _show, field ## _store);