diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 2000-07-04 22:00:08 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 2000-07-04 22:00:08 +0000 |
commit | 205132956aa66a8d913462cc60fd3b3607182184 (patch) | |
tree | 460702ce422094b3df16a934352cf7b0f4397c10 | |
parent | 6754bb7272ef9796624623e543356dc9ded2b9ea (diff) |
If the spec allows 128-character filenames, our buffer has to be at least 129
characters to hold the trailing NULL. This also fixes a one-byte overflow.
-rw-r--r-- | usr.sbin/mopd/mopd/process.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/mopd/mopd/process.c b/usr.sbin/mopd/mopd/process.c index d129d16e558..afdd0cf3bb7 100644 --- a/usr.sbin/mopd/mopd/process.c +++ b/usr.sbin/mopd/mopd/process.c @@ -1,4 +1,4 @@ -/* $OpenBSD: process.c,v 1.6 2000/07/03 23:24:42 niklas Exp $ */ +/* $OpenBSD: process.c,v 1.7 2000/07/04 22:00:07 aaron Exp $ */ /* * Copyright (c) 1993-95 Mats O Jansson. All rights reserved. @@ -30,7 +30,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: process.c,v 1.6 2000/07/03 23:24:42 niklas Exp $"; +static char rcsid[] = "$OpenBSD: process.c,v 1.7 2000/07/04 22:00:07 aaron Exp $"; #endif #include "os.h" @@ -438,7 +438,7 @@ mopProcessDL(fd, ii, pkt, index, dst, src, trans, len) { u_char tmpc; u_short moplen; - u_char pfile[128], mopcode; + u_char pfile[129], mopcode; char filename[FILENAME_MAX]; char line[100]; int i,nfd,iindex; @@ -487,7 +487,7 @@ mopProcessDL(fd, ii, pkt, index, dst, src, trans, len) rpr_pgty = mopGetChar(pkt,index); /* Program Type */ tmpc = mopGetChar(pkt,index); /* Software ID Len */ - if (tmpc > sizeof(pfile)) + if (tmpc > sizeof(pfile) - 1) return; for (i = 0; i < tmpc; i++) { pfile[i] = mopGetChar(pkt,index); |