fix buffer oflow; now runs on sparc

This commit is contained in:
marc 1998-07-15 22:38:20 +00:00
parent 5a4cfdeae6
commit d918d47dc7
4 changed files with 63 additions and 28 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.5 1998/07/08 04:06:24 form Exp $
# $OpenBSD: Makefile,v 1.6 1998/07/15 22:38:20 marc Exp $
# NetBSD: Makefile,v 1.6 1998/04/15 11:15:34 frueauf Exp
#
@ -20,15 +20,12 @@ do-configure:
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/icb/icb ${PREFIX}/bin
@if [ ! -d /etc/icb ]; then \
${INSTALL} -d /etc/icb; \
${INSTALL_SCRIPT} ${WRKSRC}/sample.icbrc \
${INSTALL_DATA} ${WRKSRC}/icbserverdb ${PREFIX}/lib
${INSTALL} -d ${PREFIX}/lib/icb
${INSTALL_DATA} ${WRKSRC}/sample.icbrc \
${WRKSRC}/contrib/bartender \
${WRKSRC}/contrib/confuse \
${WRKSRC}/contrib/echofile \
/etc/icb; \
${INSTALL_SCRIPT} ${WRKSRC}/icbserverdb /etc/icb; \
chmod 644 /etc/icb/*; \
fi
${PREFIX}/lib/icb
.include <bsd.port.mk>

View File

@ -7,7 +7,7 @@
#
# Installing user's home directory
HOME = /nonexistent
HOME = /none
# Directory where the client will be installed.
BINDIR = @PREFIX@/bin
@ -19,11 +19,11 @@ MANDIR = @PREFIX@/man
CC = cc
# Compile options.
CFLAGS = -O2 -DNO_LRAND48 -DSTRINGS_H -DTIME_H
TCLCFLAGS = -O2 -DNO_LRAND48 -DSTRINGS_H -DTIME_H
CFLAGS = -O2 ${DEBUG} -DSTRINGS_H -DTIME_H
TCLCFLAGS = -O2 ${DEBUG} -DSTRINGS_H -DTIME_H
# Lint flags
LFLAGS = -u -DNO_LRAND48 -DSTRINGS_H -DTIME_H
LFLAGS = -u -DSTRINGS_H -DTIME_H
# System dependent source file.
SYSDEP =sysdep.bsd
@ -41,14 +41,15 @@ PMAKE =
MAKEDEPEND = makedepend
# Makefile dependency generator.
DEPENDFLAGS = -fMake -DNO_LRAND48 -DSTRINGS_H -DTIME_H
DEPENDFLAGS = -fMake -DSTRINGS_H -DTIME_H
# Hostname and port of remote server.
DEFAULTHOST = cvs.openbsd.org
DEFAULTHOST = 129.24.12.18
DEFAULTPORT = 7326
# Directory for support files
LIBDIR = /etc
LIBDIR = @PREFIX@/lib/icb
# location of server database
SERVERLIST = /etc/icb/icbserverdb
SERVERLIST = @PREFIX@/lib/icbserverdb

View File

@ -1,6 +1,41 @@
--- icbserverdb.orig Fri Feb 24 13:19:29 1995
+++ icbserverdb Mon May 25 16:25:18 1998
@@ -1,2 +1,3 @@
+openbsd cvs.openbsd.org 7326
dragon crater.unm.edu 7326
alt remus.rutgers.edu 7326
--- icb/serverlist.c.~1~ Fri Feb 24 13:20:29 1995
+++ icb/serverlist.c Wed Jul 15 15:09:58 1998
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "icb.h"
@@ -16,7 +17,8 @@
struct stat statbuf;
char *personalsl;
char command[256];
- char pwd[256];
+ char pwd[MAXPATHLEN];
+ char * home;
FILE *ret;
#ifdef sgi
@@ -25,15 +27,19 @@
#ifndef SYSV
getwd(pwd);
#else /* SYSV */
- getcwd(pwd, MAXPATHLEN+1);
+ getcwd(pwd, MAXPATHLEN);
#endif /* SYSV */
#ifdef sgi
#define SYSV
#endif
- chdir(getenv("HOME"));
+ home = getenv( "HOME" );
+ if ( ! home )
+ errx( 1, "can't get home directory from env" );
+ chdir( home );
if (!stat(PERSONALSL,&statbuf))
{
- sprintf(command,"/bin/cat %s %s\n", PERSONALSL, SERVERLIST);
+ snprintf(command, sizeof command, "/bin/cat %s %s\n",
+ PERSONALSL, SERVERLIST);
ret= popen(command,"r");
}
else

View File

@ -1,7 +1,9 @@
@cwd /usr/local
@name icb-5.0.9
bin/icb
libdata/icbserverdb
libdata/icb/sample.icbrc
libdata/icb/bartender
libdata/icb/confuse
libdata/icb/echofile
@dirrm libdata/icb
lib/icb/sample.icbrc
lib/icb/bartender
lib/icb/confuse
lib/icb/echofile
lib/icbserverdb
@dirrm lib/icb