summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ee203ec)
raw | patch | inline | side by side (parent: ee203ec)
author | Florian Forster <octo@huhu.verplant.org> | |
Sun, 16 Aug 2009 07:13:31 +0000 (09:13 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Sun, 16 Aug 2009 07:13:31 +0000 (09:13 +0200) |
readlink(2) doesn't null-terminate the buffer in any case. Thanks to Ondrej for
pointing this out.
pointing this out.
src/madwifi.c | patch | blob | history |
diff --git a/src/madwifi.c b/src/madwifi.c
index 9d973ec059a94335ca42477a8791d3dd9ef27a8c..f0230f9b2e4cf13b413d92cc1a5b4d634c589b9f 100644 (file)
--- a/src/madwifi.c
+++ b/src/madwifi.c
static int
check_devname (const char *dev)
{
- char buf[256];
- char buf2[256];
+ char buf[PATH_MAX];
+ char buf2[PATH_MAX];
int i;
if (dev[0] == '.')
ssnprintf (buf, sizeof (buf), "/sys/class/net/%s/device/driver", dev);
buf[sizeof (buf) - 1] = 0;
+ memset (buf2, 0, sizeof (buf2));
i = readlink (buf, buf2, sizeof (buf2) - 1);
if (i < 0)
return 0;
- buf2[sizeof (buf2) - 1] = 0;
if (strstr (buf2, "/drivers/ath_") == NULL)
return 0;