Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/usr.sbin/mopd/mopd Pull up 1.8, approved by thorpej, jh...
details: https://anonhg.NetBSD.org/src/rev/4ab9c4b917c3
branches: netbsd-1-5
changeset: 488771:4ab9c4b917c3
user: mjl <mjl%NetBSD.org@localhost>
date: Thu Jul 27 09:26:34 2000 +0000
description:
Pull up 1.8, approved by thorpej, jhawk:
Increase buffer size to maximum allowed by spec (filename may be
up to 128 chars long).
Ignore filenames longer than this.
diffstat:
usr.sbin/mopd/mopd/process.c | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
diffs (98 lines):
diff -r 3239393db91a -r 4ab9c4b917c3 usr.sbin/mopd/mopd/process.c
--- a/usr.sbin/mopd/mopd/process.c Thu Jul 27 05:12:45 2000 +0000
+++ b/usr.sbin/mopd/mopd/process.c Thu Jul 27 09:26:34 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: process.c,v 1.6.4.1 2000/06/28 13:56:09 ragge Exp $ */
+/* $NetBSD: process.c,v 1.6.4.2 2000/07/27 09:26:34 mjl Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: process.c,v 1.6.4.1 2000/06/28 13:56:09 ragge Exp $");
+__RCSID("$NetBSD: process.c,v 1.6.4.2 2000/07/27 09:26:34 mjl Exp $");
#endif
#include "os.h"
@@ -214,6 +214,8 @@
}
}
+#define MAX_ETH_PAYLOAD 1492
+
void
mopStartLoad(dst, src, dl_rpr, trans)
u_char *dst,*src;
@@ -278,12 +280,13 @@
dllist[slot].a_lseek = 0;
dllist[slot].count = 0;
- if (dllist[slot].dl_bsz >= 1492)
- dllist[slot].dl_bsz = 1492;
+ if (dllist[slot].dl_bsz >= MAX_ETH_PAYLOAD || dllist[slot].dl_bsz == 0)
+ dllist[slot].dl_bsz = MAX_ETH_PAYLOAD;
if (dllist[slot].dl_bsz == 1030) /* VS/uVAX 2000 needs this */
dllist[slot].dl_bsz = 1000;
if (dllist[slot].dl_bsz == 0) /* Needed by "big" VAXen */
- dllist[slot].dl_bsz = 1492;
+ dllist[slot].dl_bsz = MAX_ETH_PAYLOAD;
+
if (trans == TRANS_8023)
dllist[slot].dl_bsz = dllist[slot].dl_bsz - 8;
@@ -366,14 +369,14 @@
sprintf(line,
"%x:%x:%x:%x:%x:%x Load completed",
dst[0],dst[1],dst[2],dst[3],dst[4],dst[5]);
- syslog(LOG_INFO, line);
+ syslog(LOG_INFO, "%s", line);
return;
}
dllist[slot].lseek = lseek(dllist[slot].ldfd,0L,SEEK_CUR);
- if (dllist[slot].dl_bsz >= 1492)
- dllist[slot].dl_bsz = 1492;
+ if (dllist[slot].dl_bsz >= MAX_ETH_PAYLOAD)
+ dllist[slot].dl_bsz = MAX_ETH_PAYLOAD;
index = 0;
mopPutHeader(pkt, &index, dst, src, ptype, trans);
@@ -453,7 +456,7 @@
{
u_char tmpc;
u_short moplen;
- u_char pfile[17], mopcode;
+ u_char pfile[129], mopcode;
char filename[FILENAME_MAX];
char line[100];
int i,nfd,iindex;
@@ -502,6 +505,8 @@
rpr_pgty = mopGetChar(pkt,index); /* Program Type */
tmpc = mopGetChar(pkt,index); /* Software ID Len */
+ if (tmpc > sizeof(pfile) - 1)
+ return;
for (i = 0; i < tmpc; i++) {
pfile[i] = mopGetChar(pkt,index);
pfile[i+1] = '\0';
@@ -543,7 +548,7 @@
src[0],src[1],src[2],
src[3],src[4],src[5],trans,pfile);
}
- syslog(LOG_INFO, line);
+ syslog(LOG_INFO, "%s", line);
} else {
if ((mopCmpEAddr(dst,ii->eaddr) == 0)) {
dl_rpr->ldfd = open(filename, O_RDONLY, 0);
@@ -552,7 +557,7 @@
"%x:%x:%x:%x:%x:%x Send me %s",
src[0],src[1],src[2],
src[3],src[4],src[5],pfile);
- syslog(LOG_INFO, line);
+ syslog(LOG_INFO, "%s", line);
}
}
Home |
Main Index |
Thread Index |
Old Index