1
0
mirror of https://github.com/PDP-10/klh10.git synced 2026-01-13 15:27:10 +00:00

Increase the size for a device name

For the benefit of VDE.
For other interfacing methods, check that the name is at most IFNAMSIZ,
which should always have been checked, because of unexpected truncation.
This commit is contained in:
Olaf Seibert 2017-11-29 21:31:48 +01:00
parent 9d6add677a
commit e904b0b49e
2 changed files with 19 additions and 2 deletions

View File

@ -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 */

View File

@ -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");
}