summaryrefslogtreecommitdiffstats
path: root/src/if.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-01-26 15:46:16 +0000
committerRoy Marples <roy@marples.name>2020-01-26 15:46:16 +0000
commit3bca2be9a4dba4deea45131c687a390f23332f2a (patch)
tree9e77e4c244658f032e622dd12b4633f2d0af36cd /src/if.c
parent3c348f209e856fe4a507a28d75d8338b5f0b6359 (diff)
downloaddhcpcd-3bca2be9a4dba4deea45131c687a390f23332f2a.tar.xz
if: Don't use a variable length buffer
Otherwise SSP complains.
Diffstat (limited to 'src/if.c')
-rw-r--r--src/if.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/if.c b/src/if.c
index 75776512..2fa6e133 100644
--- a/src/if.c
+++ b/src/if.c
@@ -183,14 +183,18 @@ if_randomisemac(struct interface *ifp)
{
uint32_t randnum;
size_t hwlen = ifp->hwlen, rlen = 0;
- uint8_t buf[hwlen], *bp = buf, *rp = (uint8_t *)&randnum;
- char sbuf[hwlen * 3];
+ uint8_t buf[HWADDR_LEN], *bp = buf, *rp = (uint8_t *)&randnum;
+ char sbuf[HWADDR_LEN * 3];
int retval;
if (hwlen == 0) {
errno = ENOTSUP;
return -1;
}
+ if (hwlen > sizeof(buf)) {
+ errno = ENOBUFS;
+ return -1;
+ }
for (; hwlen != 0; hwlen--) {
if (rlen == 0) {