From 1ce69592d2a15bb79beac98709649d0928fcaa84 Mon Sep 17 00:00:00 2001 From: Kees van Reeuwijk Date: Wed, 24 Feb 2010 10:39:58 +0000 Subject: [PATCH] Fixed an array bounds violation. Let include guards comform to the Minix standard. --- drivers/dpeth/3c509.c | 2 +- drivers/fxp/fxp.h | 4 ++-- drivers/fxp/mii.h | 4 ++-- include/sys/types.h | 4 ++-- servers/ds/inc.h | 4 ++-- servers/ds/proto.h | 4 ++-- servers/ds/store.c | 2 +- servers/inet/generic/icmp.c | 5 +++-- servers/inet/generic/ip_ioctl.c | 2 +- 9 files changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/dpeth/3c509.c b/drivers/dpeth/3c509.c index f9f9549b9..a51e2e2cc 100644 --- a/drivers/dpeth/3c509.c +++ b/drivers/dpeth/3c509.c @@ -385,7 +385,7 @@ static void el3_read_StationAddress(dpeth_t * dep) { unsigned int ix, rc; - for (ix = EE_3COM_NODE_ADDR; ix < SA_ADDR_LEN;) { + for (ix = EE_3COM_NODE_ADDR; ix < SA_ADDR_LEN+EE_3COM_NODE_ADDR;) { /* Accesses with word No. */ rc = el3_read_eeprom(dep->de_id_port, ix / 2); /* Swaps bytes of word */ diff --git a/drivers/fxp/fxp.h b/drivers/fxp/fxp.h index 208c2db09..ec1298b69 100644 --- a/drivers/fxp/fxp.h +++ b/drivers/fxp/fxp.h @@ -7,8 +7,8 @@ and 82562 fast ethernet controllers. Created: Nov 2004 by Philip Homburg */ -#ifndef _INC_FXP_H -#define _INC_FXP_H +#ifndef _FXP_FXP_H +#define _FXP_FXP_H #define VERBOSE 0 /* display output during intialization */ diff --git a/drivers/fxp/mii.h b/drivers/fxp/mii.h index 4f71f5e6e..ebd3b5f19 100644 --- a/drivers/fxp/mii.h +++ b/drivers/fxp/mii.h @@ -6,8 +6,8 @@ Created: Nov 2004 by Philip Homburg Definitions for the Media Independent (Ethernet) Interface */ -#ifndef _INC_MII_H -#define _INC_MII_H +#ifndef _FXP_MII_H +#define _FXP_MII_H /* Registers in the Machine Independent Interface (MII) to the PHY. * IEEE 802.3 (2000 Edition) Clause 22. diff --git a/include/sys/types.h b/include/sys/types.h index 2795fc96b..f56544c02 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -1,5 +1,5 @@ -#ifndef _INC_SYS_TYPE_H -#define _INC_SYS_TYPE_H +#ifndef _INCLUDE_SYS_TYPE_H +#define _INCLUDE_SYS_TYPE_H /* * this files resolves conflicts between the file of the host system and diff --git a/servers/ds/inc.h b/servers/ds/inc.h index b8f3630da..6f433e727 100644 --- a/servers/ds/inc.h +++ b/servers/ds/inc.h @@ -1,5 +1,5 @@ -#ifndef _INC_INC_H -#define _INC_INC_H +#ifndef _DS_INC_H +#define _DS_INC_H /* Header file including all needed system headers. */ diff --git a/servers/ds/proto.h b/servers/ds/proto.h index 211ec6b47..1bd516595 100644 --- a/servers/ds/proto.h +++ b/servers/ds/proto.h @@ -1,5 +1,5 @@ -#ifndef _INC_PROTO_H -#define _INC_PROTO_H +#ifndef _DS_PROTO_H +#define _DS_PROTO_H /* Function prototypes. */ diff --git a/servers/ds/store.c b/servers/ds/store.c index d80075171..fdd185ac9 100644 --- a/servers/ds/store.c +++ b/servers/ds/store.c @@ -553,7 +553,7 @@ PUBLIC int do_subscribe(message *m_ptr) subp->flags = DSF_IN_USE | type_set; strcpy(subp->owner, owner); - for(b = 0; b < BITMAP_CHUNKS(NR_DS_SUBS); b++) + for(b = 0; b < BITMAP_CHUNKS(NR_DS_KEYS); b++) subp->old_subs[b] = 0; /* See if caller requested an instant initial list. */ diff --git a/servers/inet/generic/icmp.c b/servers/inet/generic/icmp.c index 1cdfe7000..855389a33 100644 --- a/servers/inet/generic/icmp.c +++ b/servers/inet/generic/icmp.c @@ -997,8 +997,6 @@ icmp_hdr_t *icmp_hdr; { int entries; int entry_size; - u32_t addr; - i32_t pref; u16_t lifetime; int i; char *bufp; @@ -1053,6 +1051,9 @@ icmp_hdr_t *icmp_hdr; for (i= 0, bufp= (char *)&icmp_hdr->ih_dun.uhd_data[0]; i< entries; i++, bufp += entry_size) { + u32_t addr; + i32_t pref; + addr= *(ipaddr_t *)bufp; pref= ntohl(*(u32_t *)(bufp+4)); ipr_add_oroute(icmp_port->icp_ipport, HTONL(0L), HTONL(0L), diff --git a/servers/inet/generic/ip_ioctl.c b/servers/inet/generic/ip_ioctl.c index 3099054b3..055d6c72c 100644 --- a/servers/inet/generic/ip_ioctl.c +++ b/servers/inet/generic/ip_ioctl.c @@ -43,7 +43,7 @@ ioreq_t req; int ent_no, r; nwio_ipconf_t ipconf_var; - assert (fd>=0 && fd<=IP_FD_NR); + assert (fd>=0 && fdif_flags & IFF_INUSE);