summaryrefslogtreecommitdiffstats
path: root/contrib/ipfilter/ipsend
diff options
context:
space:
mode:
authordarrenr <darrenr@FreeBSD.org>2001-02-04 14:25:38 +0000
committerdarrenr <darrenr@FreeBSD.org>2001-02-04 14:25:38 +0000
commit5e62aa9b3dacb0e670998fad60638b79751aff14 (patch)
tree385e237f9b94bd1f0ddf97318d3ced6f6e85ec8b /contrib/ipfilter/ipsend
parent77a62e2a58642d4f2e31e9cfc354994062d9777b (diff)
downloadFreeBSD-src-5e62aa9b3dacb0e670998fad60638b79751aff14.zip
FreeBSD-src-5e62aa9b3dacb0e670998fad60638b79751aff14.tar.gz
Import IP Filter update
Diffstat (limited to 'contrib/ipfilter/ipsend')
-rw-r--r--contrib/ipfilter/ipsend/ip.c10
-rw-r--r--contrib/ipfilter/ipsend/ipsend.c8
-rw-r--r--contrib/ipfilter/ipsend/resend.c7
-rw-r--r--contrib/ipfilter/ipsend/sock.c11
4 files changed, 32 insertions, 4 deletions
diff --git a/contrib/ipfilter/ipsend/ip.c b/contrib/ipfilter/ipsend/ip.c
index e81c890..c5eacb3 100644
--- a/contrib/ipfilter/ipsend/ip.c
+++ b/contrib/ipfilter/ipsend/ip.c
@@ -7,7 +7,7 @@
*/
#if !defined(lint)
static const char sccsid[] = "%W% %G% (C)1995";
-static const char rcsid[] = "@(#)$Id: ip.c,v 2.1 1999/08/04 17:31:04 darrenr Exp $";
+static const char rcsid[] = "@(#)$Id: ip.c,v 2.1.4.1 2001/01/10 06:21:19 darrenr Exp $";
#endif
#include <errno.h>
#include <stdio.h>
@@ -99,7 +99,15 @@ int frag;
int err, iplen;
if (!ipbuf)
+ {
ipbuf = (char *)malloc(65536);
+ if(!ipbuf)
+ {
+ perror("malloc failed");
+ return -2;
+ }
+ }
+
eh = (ether_header_t *)ipbuf;
bzero((char *)A_A eh->ether_shost, sizeof(eh->ether_shost));
diff --git a/contrib/ipfilter/ipsend/ipsend.c b/contrib/ipfilter/ipsend/ipsend.c
index 748abfb..3dd39af 100644
--- a/contrib/ipfilter/ipsend/ipsend.c
+++ b/contrib/ipfilter/ipsend/ipsend.c
@@ -12,7 +12,7 @@
*/
#if !defined(lint)
static const char sccsid[] = "@(#)ipsend.c 1.5 12/10/95 (C)1995 Darren Reed";
-static const char rcsid[] = "@(#)$Id: ipsend.c,v 2.2 1999/12/04 03:37:05 darrenr Exp $";
+static const char rcsid[] = "@(#)$Id: ipsend.c,v 2.2.2.1 2001/01/10 06:21:19 darrenr Exp $";
#endif
#include <stdio.h>
#include <stdlib.h>
@@ -347,6 +347,12 @@ char **argv;
printf("Options: %d\n", olen);
ti = (struct tcpiphdr *)malloc(olen + ip->ip_len);
+ if(!ti)
+ {
+ fprintf(stderr,"malloc failed\n");
+ exit(2);
+ }
+
bcopy((char *)ip, (char *)ti, sizeof(*ip));
ip = (ip_t *)ti;
ip->ip_hl = (olen >> 2);
diff --git a/contrib/ipfilter/ipsend/resend.c b/contrib/ipfilter/ipsend/resend.c
index e4397ce..095aa9e 100644
--- a/contrib/ipfilter/ipsend/resend.c
+++ b/contrib/ipfilter/ipsend/resend.c
@@ -12,7 +12,7 @@
*/
#if !defined(lint)
static const char sccsid[] = "@(#)resend.c 1.3 1/11/96 (C)1995 Darren Reed";
-static const char rcsid[] = "@(#)$Id: resend.c,v 2.1 1999/08/04 17:31:12 darrenr Exp $";
+static const char rcsid[] = "@(#)$Id: resend.c,v 2.1.4.1 2001/01/10 06:21:20 darrenr Exp $";
#endif
#include <stdio.h>
#include <netdb.h>
@@ -97,6 +97,11 @@ char *datain;
ip = (struct ip *)pbuf;
eh = (ether_header_t *)malloc(sizeof(*eh));
+ if(!eh)
+ {
+ perror("malloc failed");
+ return -2;
+ }
bzero((char *)A_A eh->ether_shost, sizeof(eh->ether_shost));
if (gwip.s_addr && (arp((char *)&gwip, dhost) == -1))
diff --git a/contrib/ipfilter/ipsend/sock.c b/contrib/ipfilter/ipsend/sock.c
index cef71fe..2ee5028 100644
--- a/contrib/ipfilter/ipsend/sock.c
+++ b/contrib/ipfilter/ipsend/sock.c
@@ -7,7 +7,7 @@
*/
#if !defined(lint)
static const char sccsid[] = "@(#)sock.c 1.2 1/11/96 (C)1995 Darren Reed";
-static const char rcsid[] = "@(#)$Id: sock.c,v 2.1 1999/08/04 17:31:16 darrenr Exp $";
+static const char rcsid[] = "@(#)$Id: sock.c,v 2.1.4.1 2000/12/16 21:05:44 darrenr Exp $";
#endif
#include <stdio.h>
#include <unistd.h>
@@ -282,12 +282,21 @@ struct tcpiphdr *ti;
return NULL;
fd = (struct filedesc *)malloc(sizeof(*fd));
+#if defined( __FreeBSD_version) && __FreeBSD_version >= 500013
+ if (KMCPY(fd, p->ki_fd, sizeof(*fd)) == -1)
+ {
+ fprintf(stderr, "read(%#lx,%#lx) failed\n",
+ (u_long)p, (u_long)p->ki_fd);
+ return NULL;
+ }
+#else
if (KMCPY(fd, p->kp_proc.p_fd, sizeof(*fd)) == -1)
{
fprintf(stderr, "read(%#lx,%#lx) failed\n",
(u_long)p, (u_long)p->kp_proc.p_fd);
return NULL;
}
+#endif
o = (struct file **)calloc(1, sizeof(*o) * (fd->fd_lastfile + 1));
if (KMCPY(o, fd->fd_ofiles, (fd->fd_lastfile + 1) * sizeof(*o)) == -1)
OpenPOWER on IntegriCloud