diff options
author | jojemann <none@none> | 2006-10-17 05:42:55 -0700 |
---|---|---|
committer | jojemann <none@none> | 2006-10-17 05:42:55 -0700 |
commit | 34ef97d02919c3304cf8ae36b076911a992b6e8c (patch) | |
tree | ef75b516fe9a223a9cca35e07e8fe59c8125486c /usr/src/cmd/ipf | |
parent | e63f95655416ec126dcfb73886ff1a7694b1dcae (diff) | |
download | illumos-gate-34ef97d02919c3304cf8ae36b076911a992b6e8c.tar.gz |
6478243 ippool can dump core (Regression)
6480720 ipnat usage output incorrect (Regression)
6480905 some ipfilter tools once again don't check for return values from memory allocation (Regression)
Diffstat (limited to 'usr/src/cmd/ipf')
-rw-r--r-- | usr/src/cmd/ipf/tools/ipfcomp.c | 36 | ||||
-rw-r--r-- | usr/src/cmd/ipf/tools/ipnat.c | 2 | ||||
-rw-r--r-- | usr/src/cmd/ipf/tools/ippool.c | 2 |
3 files changed, 36 insertions, 4 deletions
diff --git a/usr/src/cmd/ipf/tools/ipfcomp.c b/usr/src/cmd/ipf/tools/ipfcomp.c index f09bfd314f..b99a6f8385 100644 --- a/usr/src/cmd/ipf/tools/ipfcomp.c +++ b/usr/src/cmd/ipf/tools/ipfcomp.c @@ -2,7 +2,13 @@ * Copyright (C) 1993-2001 by Darren Reed. * * See the IPFILTER.LICENCE file for details on licencing. + * + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ + +#pragma ident "%Z%%M% %I% %E% SMI" + #if !defined(lint) static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed"; static const char rcsid[] = "@(#)$Id: ipfcomp.c,v 1.24.2.2 2004/04/28 10:34:44 darrenr Exp $"; @@ -159,9 +165,17 @@ frentry_t *fr; int i; f = (frentry_t *)malloc(sizeof(*f)); + if (f == NULL) { + fprintf(stderr, "out of memory\n"); + exit(1); + } bcopy((char *)fr, (char *)f, sizeof(*fr)); if (fr->fr_ipf) { f->fr_ipf = (fripf_t *)malloc(sizeof(*f->fr_ipf)); + if (f->fr_ipf == NULL) { + fprintf(stderr, "out of memory\n"); + exit(1); + } bcopy((char *)fr->fr_ipf, (char *)f->fr_ipf, sizeof(*fr->fr_ipf)); } @@ -174,6 +188,10 @@ frentry_t *fr; if (g == NULL) { g = (frgroup_t *)calloc(1, sizeof(*g)); + if (g == NULL) { + fprintf(stderr, "out of memory\n"); + exit(1); + } g->fg_next = groups; groups = g; g->fg_head = f; @@ -214,6 +232,10 @@ static u_long ipf%s_rule_data_%s_%u[] = {\n", break; if (g == NULL) { g = (frgroup_t *)calloc(1, sizeof(*g)); + if (g == NULL) { + fprintf(stderr, "out of memory\n"); + exit(1); + } g->fg_next = groups; groups = g; g->fg_head = f; @@ -931,8 +953,13 @@ u_int incount, outcount; fr->fr_flags & FR_INQUE ? "in" : "out", fr->fr_group, num); } - if (n == NULL) + if (n == NULL) { n = (mc_t *)malloc(sizeof(*n) * FRC_MAX); + if (n == NULL) { + fprintf(stderr, "out of memory\n"); + exit(1); + } + } bcopy((char *)m, (char *)n, sizeof(*n) * FRC_MAX); sin = in; } @@ -944,8 +971,13 @@ int dir; static mc_t *m = NULL; frgroup_t *g; - if (m == NULL) + if (m == NULL) { m = (mc_t *)calloc(1, sizeof(*m) * FRC_MAX); + if (m == NULL) { + fprintf(stderr, "out of memory\n"); + exit(1); + } + } for (g = groups; g != NULL; g = g->fg_next) { if ((dir == 0) && ((g->fg_flags & FR_INQUE) != 0)) diff --git a/usr/src/cmd/ipf/tools/ipnat.c b/usr/src/cmd/ipf/tools/ipnat.c index 6989a511f1..df64e0d92d 100644 --- a/usr/src/cmd/ipf/tools/ipnat.c +++ b/usr/src/cmd/ipf/tools/ipnat.c @@ -94,7 +94,7 @@ int opts; void usage(name) char *name; { - fprintf(stderr, "Usage: %s [-CFhlnrRsv] [-f filename]\n", name); + fprintf(stderr, "Usage: %s [-CdFhlnrRsv] [-f filename]\n", name); exit(1); } diff --git a/usr/src/cmd/ipf/tools/ippool.c b/usr/src/cmd/ipf/tools/ippool.c index 9e7919c757..edf6793898 100644 --- a/usr/src/cmd/ipf/tools/ippool.c +++ b/usr/src/cmd/ipf/tools/ippool.c @@ -215,7 +215,7 @@ char *argv[]; bzero((char *)&iph, sizeof(iph)); bzero((char *)&pool, sizeof(pool)); - while ((c = getopt(argc, argv, "dm:no:RSt:v")) != -1) + while ((c = getopt(argc, argv, "dm:no:RS:t:v")) != -1) switch (c) { case 'd' : |