summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2006-12-09 20:11:55 +0000
committersam <sam@FreeBSD.org>2006-12-09 20:11:55 +0000
commit0e28b7e9fc7bbc9e326d94e48d0e1c7bd2358f99 (patch)
tree8074ec2a482f988e67d97859ccad5c4320b7801a /sbin
parent1960fa1f5d6387f5a911636ba0afda586f8e2b62 (diff)
downloadFreeBSD-src-0e28b7e9fc7bbc9e326d94e48d0e1c7bd2358f99.zip
FreeBSD-src-0e28b7e9fc7bbc9e326d94e48d0e1c7bd2358f99.tar.gz
fix handling of ssid "-" etc; we're writing 1 byte past the
end of the result buffer Noticed by: Sepherosa Zieha Reviewed by: cperciva MFC after: 2 weeks
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ifconfig/ifieee80211.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c
index 5cef7ab..ffd01f6 100644
--- a/sbin/ifconfig/ifieee80211.c
+++ b/sbin/ifconfig/ifieee80211.c
@@ -1913,9 +1913,10 @@ get_string(const char *val, const char *sep, u_int8_t *buf, int *lenp)
}
len = p - buf;
/* The string "-" is treated as the empty string. */
- if (!hexstr && len == 1 && buf[0] == '-')
+ if (!hexstr && len == 1 && buf[0] == '-') {
len = 0;
- if (len < *lenp)
+ memset(buf, 0, *lenp);
+ } else if (len < *lenp)
memset(p, 0, *lenp - len);
*lenp = len;
return val;
OpenPOWER on IntegriCloud