From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 5/6] net: set enetaddr to invalid address when an invalid string is passed
Date: Wed, 15 Feb 2012 09:04:03 +0100 [thread overview]
Message-ID: <1329293044-9967-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1329293044-9967-1-git-send-email-s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
net/net.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/net.c b/net/net.c
index 26ba44e..2752884 100644
--- a/net/net.c
+++ b/net/net.c
@@ -166,8 +166,10 @@ int string_to_ethaddr(const char *str, char *enetaddr)
int reg;
char *e;
- if (!str || strlen(str) != 17)
- return -1;
+ if (!str || strlen(str) != 17) {
+ memset(enetaddr, 0, 6);
+ return -1;
+ }
if (str[2] != ':' || str[5] != ':' || str[8] != ':' ||
str[11] != ':' || str[14] != ':')
--
1.7.9
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-02-15 8:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-15 8:03 USB/network unregistration patches Sascha Hauer
2012-02-15 8:03 ` [PATCH 1/6] usb net smsc95xx: remove unused variable Sascha Hauer
2012-02-15 8:04 ` [PATCH 2/6] usb net smsc95xx: add missing mii_unregister Sascha Hauer
2012-02-15 8:04 ` [PATCH 3/6] usb net: fix unregistration Sascha Hauer
2012-02-15 8:04 ` [PATCH 4/6] net: fix eth device unregistration Sascha Hauer
2012-02-15 8:04 ` Sascha Hauer [this message]
2012-02-15 8:04 ` [PATCH 6/6] USB storage: fix disconnect Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1329293044-9967-6-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox