fix off by one malloc sizes

Submitted by:	Michal Mertl
MFC after:	1 week
This commit is contained in:
Sam Leffler 2006-02-14 23:19:40 +00:00
parent 97bcffbd74
commit 225b126b2d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=155702

View File

@ -475,7 +475,7 @@ set80211bssid(const char *val, int d, int s, const struct afswtch *rafp)
char *temp;
struct sockaddr_dl sdl;
temp = malloc(strlen(val) + 2);
temp = malloc(strlen(val) + 2); /* ':' and '\0' */
if (temp == NULL)
errx(1, "malloc failed");
temp[0] = ':';
@ -601,7 +601,7 @@ set80211macmac(int s, int op, const char *val)
char *temp;
struct sockaddr_dl sdl;
temp = malloc(strlen(val) + 1);
temp = malloc(strlen(val) + 2); /* ':' and '\0' */
if (temp == NULL)
errx(1, "malloc failed");
temp[0] = ':';
@ -633,7 +633,7 @@ DECL_CMD_FUNC(set80211kickmac, val, d)
struct sockaddr_dl sdl;
struct ieee80211req_mlme mlme;
temp = malloc(strlen(val) + 1);
temp = malloc(strlen(val) + 2); /* ':' and '\0' */
if (temp == NULL)
errx(1, "malloc failed");
temp[0] = ':';