diff options
author | archie <archie@FreeBSD.org> | 1999-06-05 05:55:07 +0000 |
---|---|---|
committer | archie <archie@FreeBSD.org> | 1999-06-05 05:55:07 +0000 |
commit | 9cf3e817878a26fda221f78495625164f5fd020c (patch) | |
tree | 1354d71e88ec43727765e6112f1b550962ed43dc /sbin/natd | |
parent | d7f89ddca7bda593e462c757e7236f7be265b7ba (diff) | |
download | FreeBSD-src-9cf3e817878a26fda221f78495625164f5fd020c.zip FreeBSD-src-9cf3e817878a26fda221f78495625164f5fd020c.tar.gz |
When incrementing through a SIOCGIFCONF list, enforce a lower limit of
sizeof(ifr->ifr_addr) for the variable length field ifr->ifr_addr.sa_len.
Otherwise the increment will be wrong in certain cases.
Obtained from: Whistle source tree
For the record: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> suggests
SIOCGIFCONF should be dropped in favor of a sysctl mechanism.
Diffstat (limited to 'sbin/natd')
-rw-r--r-- | sbin/natd/natd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sbin/natd/natd.c b/sbin/natd/natd.c index d67944e..aefcc7e 100644 --- a/sbin/natd/natd.c +++ b/sbin/natd/natd.c @@ -9,7 +9,7 @@ * * Ari Suutari <suutari@iki.fi> * - * $Id: natd.c,v 1.16 1999/05/13 16:58:31 brian Exp $ + * $Id: natd.c,v 1.17 1999/05/13 17:09:44 brian Exp $ */ #define SYSLOG_NAMES @@ -762,6 +762,8 @@ static void SetAliasAddressFromIfName (char* ifn) } extra = ifPtr->ifr_addr.sa_len - sizeof (struct sockaddr); + if (extra < 0) + extra = 0; ifPtr++; ifPtr = (struct ifreq*) ((char*) ifPtr + extra); |