From 225b126b2d09570c685ae0cf09aa1c6f1d20fc82 Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Tue, 14 Feb 2006 23:19:40 +0000 Subject: [PATCH] fix off by one malloc sizes Submitted by: Michal Mertl MFC after: 1 week --- sbin/ifconfig/ifieee80211.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index 5b4e2d5cc353..77bc6a7e3ed4 100644 --- a/sbin/ifconfig/ifieee80211.c +++ b/sbin/ifconfig/ifieee80211.c @@ -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] = ':';