1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-03 09:00:21 +00:00

To reserve space for 65536 bits, allocate

65536 / (sizeof(int) * CHAR_BITS) `int's instead of
65536 / (sizeof(int) * CHAR_BITS) bytes to avoid a possible
segmentation fault if ports above 16383 are specified via the
-p option on a platform with 4 byte wide ints.

Approved by:	re (bmah)
Reported by:	Marco Wertejuk <wertejuk@mwcis.com>
This commit is contained in:
Robert Drehmel 2003-05-09 09:11:27 +00:00
parent e1519c7c55
commit 9efed1e6e2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=114853

View File

@ -111,7 +111,7 @@ parse_ports(const char *portspec)
int port, end;
if (ports == NULL)
if ((ports = calloc(1, 65536 / INT_BIT)) == NULL)
if ((ports = calloc(65536 / INT_BIT, sizeof(int))) == NULL)
err(1, "calloc()");
p = portspec;
while (*p != '\0') {