Patchwork [04/17] wpan-phy: use snprintf to limit the amount of chars written

login
register
mail settings
Submitter Dmitry Eremin-Solenikov
Date Nov. 6, 2009, 12:39 p.m.
Message ID <1257511181-19403-5-git-send-email-dbaryshkov@gmail.com>
Download mbox | patch
Permalink /patch/37843/
State Accepted
Delegated to: David Miller
Headers show

Comments

Dmitry Eremin-Solenikov - Nov. 6, 2009, 12:39 p.m.
Use snprintf to limit the amount of chars put in the buffer for attr -> show.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 net/ieee802154/wpan-class.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/net/ieee802154/wpan-class.c b/net/ieee802154/wpan-class.c
index a10ae5b..68ccde6 100644
--- a/net/ieee802154/wpan-class.c
+++ b/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;							\
 }