netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix overflow of name in struct net_device, replaced sprintf with snprintf.
@ 2011-03-15 20:00 Sasikanth V
  2011-03-15 21:48 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Sasikanth V @ 2011-03-15 20:00 UTC (permalink / raw)
  To: davem; +Cc: netdev, Sasikanth V


Signed-off-by: Sasikanth V <sasikanth.v19@gmail.com>
---
 net/core/dev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 6561021..a74efa9 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -539,7 +539,7 @@ unsigned long netdev_boot_base(const char *prefix, int unit)
 	char name[IFNAMSIZ];
 	int i;
 
-	sprintf(name, "%s%d", prefix, unit);
+	snprintf(name, IFNAMSIZ, "%s%d", prefix, unit);
 
 	/*
 	 * If device already registered then return base of 1
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix overflow of name in struct net_device, replaced sprintf with snprintf.
  2011-03-15 20:00 [PATCH] Fix overflow of name in struct net_device, replaced sprintf with snprintf Sasikanth V
@ 2011-03-15 21:48 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2011-03-15 21:48 UTC (permalink / raw)
  To: Sasikanth V; +Cc: davem, netdev

On Wed, 16 Mar 2011 01:30:08 +0530
Sasikanth V <sasikanth.v19@gmail.com> wrote:

> 
> Signed-off-by: Sasikanth V <sasikanth.v19@gmail.com>
> ---
>  net/core/dev.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 6561021..a74efa9 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -539,7 +539,7 @@ unsigned long netdev_boot_base(const char *prefix, int unit)
>  	char name[IFNAMSIZ];
>  	int i;
>  
> -	sprintf(name, "%s%d", prefix, unit);
> +	snprintf(name, IFNAMSIZ, "%s%d", prefix, unit);
>  
>  	/*
>  	 * If device already registered then return base of 1

that code is only called with a really small values "eth" and "tr" so
it is really not necessary. The whole drivers/net/Space.c code is totally
legacy and should eventually be eliminated anyway.


-- 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-15 21:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-15 20:00 [PATCH] Fix overflow of name in struct net_device, replaced sprintf with snprintf Sasikanth V
2011-03-15 21:48 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).