diff --git a/src/dpni20.h b/src/dpni20.h index 90addeb..4984fa5 100644 --- a/src/dpni20.h +++ b/src/dpni20.h @@ -34,8 +34,8 @@ /* Version of DPNI20-specific shared memory structure */ -#define DPNI20_VERSION DPC_VERSION(1,1,2) /* 1.1.2 */ -#define IFNAM_LEN 16 /* at least IFNAMSIZ! */ +#define DPNI20_VERSION DPC_VERSION(1,1,3) /* 1.1.3 */ +#define IFNAM_LEN PATH_MAX /* at least IFNAMSIZ! */ /* DPNI20-specific stuff */ /* C = controlling parent sets, D = Device proc sets */ diff --git a/src/osdnet.c b/src/osdnet.c index a8b27a6..4787636 100644 --- a/src/osdnet.c +++ b/src/osdnet.c @@ -845,6 +845,10 @@ osn_ifeaget2(char *ifnam, /* Interface name */ { char eastr[OSN_EASTRSIZ]; + if (strlen(ifnam) >= IFNAMSIZ) { + efatal(1, "interface name '%s' too long (more than %d chars)", ifnam, IFNAMSIZ); + } + #if CENV_SYS_DECOSF /* Direct approach */ { int ownsock = FALSE; @@ -1452,6 +1456,11 @@ osn_pfinit_pcap(struct pfdata *pfdata, struct osnpf *osnpf, void *pfarg) ifnam = ife->ife_name; } + if (strlen(ifnam) >= IFNAMSIZ) { + efatal(1, "interface name '%s' (more than %d chars)", ifnam, IFNAMSIZ); + } + + pfdata->pf_meth = PF_METH_PCAP; pfdata->pf_read = osn_pfread_pcap; pfdata->pf_write = osn_pfwrite_pcap; @@ -1792,6 +1801,10 @@ osn_pfinit_tuntap(struct pfdata *pfdata, struct osnpf *osnpf, void *arg) char *basename = ""; int s; + if (strlen(osnpf->osnpf_ifnam) >= IFNAMSIZ) { + efatal(1, "interface name '%s' (more than %d chars)", osnpf->osnpf_ifnam, IFNAMSIZ); + } + strncpy(tt_ctx.saved_ifnam, osnpf->osnpf_ifnam, IFNAM_LEN); if (DP_DBGFLG) @@ -2216,6 +2229,10 @@ bridge_create(struct tuntap_context *tt_ctx, struct osnpf *osnpf) error("Can't find name of bridge: $KLH10_NET_BRIDGE is unset. Trying with \"%s\"", br_name); } + if (strlen(br_name) >= IFNAMSIZ) { + error("$KLH10_NET_BRIDGE too long (more than %d chars)", IFNAMSIZ); + } + if ((s = socket(AF_LOCAL, SOCK_STREAM, 0)) < 0) { esfatal(1, "bridge_create: socket() failed"); }