Преглед изворни кода

wpan-phy: use snprintf to limit the amount of chars written

Use snprintf to limit the amount of chars put in the buffer for attr -> show.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Dmitry Eremin-Solenikov пре 15 година
родитељ
комит
375bb0e04b
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      net/ieee802154/wpan-class.c

+ 1 - 1
net/ieee802154/wpan-class.c

@@ -30,7 +30,7 @@ static ssize_t name ## _show(struct device *dev,			\
 	int ret;							\
 									\
 	mutex_lock(&phy->pib_lock);					\
-	ret = sprintf(buf, format_string "\n", args);			\
+	ret = snprintf(buf, PAGE_SIZE, format_string "\n", args);	\
 	mutex_unlock(&phy->pib_lock);					\
 	return ret;							\
 }