summaryrefslogtreecommitdiff
path: root/sys/arch/i386/isa/pcvt
diff options
context:
space:
mode:
authorAaron Campbell <aaron@cvs.openbsd.org>1999-05-24 15:37:45 +0000
committerAaron Campbell <aaron@cvs.openbsd.org>1999-05-24 15:37:45 +0000
commitca64aa2b1309ab8c2c4bc1529e7127ad6276b9e8 (patch)
tree45ff932be1726b3acebeaa76b51a35ac194e5c9b /sys/arch/i386/isa/pcvt
parent2288d57f5b59aa20f8c96fef5e0b4529ef14053a (diff)
more buf oflows
Diffstat (limited to 'sys/arch/i386/isa/pcvt')
-rw-r--r--sys/arch/i386/isa/pcvt/Util/demo/playvt.c4
-rw-r--r--sys/arch/i386/isa/pcvt/Util/fed/misc.c22
-rw-r--r--sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c4
-rw-r--r--sys/arch/i386/isa/pcvt/Util/loadfont/loadfont.c8
-rw-r--r--sys/arch/i386/isa/pcvt/Util/scon/scon.c4
-rw-r--r--sys/arch/i386/isa/pcvt/Util/userkeys/vt220keys.c10
6 files changed, 26 insertions, 26 deletions
diff --git a/sys/arch/i386/isa/pcvt/Util/demo/playvt.c b/sys/arch/i386/isa/pcvt/Util/demo/playvt.c
index d332618e89a..d9a1c9f0bc0 100644
--- a/sys/arch/i386/isa/pcvt/Util/demo/playvt.c
+++ b/sys/arch/i386/isa/pcvt/Util/demo/playvt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: playvt.c,v 1.3 1999/01/13 07:26:03 niklas Exp $ */
+/* $OpenBSD: playvt.c,v 1.4 1999/05/24 15:37:43 aaron Exp $ */
/*
* Copyright (c) 1995 Hellmuth Michaelis
@@ -87,7 +87,7 @@ char *argv[];
{
char buffer[80];
strcpy(buffer,"ERROR opening file ");
- strcat(buffer,filename);
+ strncat(buffer,filename,sizeof(buffer) - strlen(buffer));
perror(buffer);
exit(1);
}
diff --git a/sys/arch/i386/isa/pcvt/Util/fed/misc.c b/sys/arch/i386/isa/pcvt/Util/fed/misc.c
index 5d4dc353bd3..cd1c1ce343e 100644
--- a/sys/arch/i386/isa/pcvt/Util/fed/misc.c
+++ b/sys/arch/i386/isa/pcvt/Util/fed/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.3 1999/01/13 07:26:03 niklas Exp $ */
+/* $OpenBSD: misc.c,v 1.4 1999/05/24 15:37:43 aaron Exp $ */
/*
* Copyright (c) 1992, 1993, 1994 by Hellmuth Michaelis
@@ -91,14 +91,14 @@ void readfont(char *filename)
if((in = fopen(filename, "r")) == NULL)
{
- sprintf(buffer, "cannot open file %s for reading", filename);
+ snprintf(buffer, sizeof(buffer), "cannot open file %s for reading", filename);
perror(buffer);
exit(1);
}
if((fstat(fileno(in), sbp)) != 0)
{
- sprintf(buffer, "cannot fstat file %s", filename);
+ snprintf(buffer, sizeof(buffer), "cannot fstat file %s", filename);
perror(buffer);
exit(1);
}
@@ -141,12 +141,12 @@ void readfont(char *filename)
exit(1);
}
- strcpy(lfilename, filename); /* save for write */
- lfilesize = sbp->st_size; /* save for write */
+ strncpy(lfilename, filename, sizeof(lfilename)); /* save for write */
+ lfilesize = sbp->st_size; /* save for write */
if((ret = fread(fonttab, sizeof(*fonttab), sbp->st_size, in)) != sbp->st_size)
{
- sprintf(buffer,"error reading file %s, size = %ld, ret = %d\n",filename,(long)sbp->st_size, ret);
+ snprintf(buffer,sizeof(buffer),"error reading file %s, size = %ld, ret = %d\n",filename,(long)sbp->st_size, ret);
perror(buffer);
exit(1);
}
@@ -166,11 +166,11 @@ void writefont()
int c;
char wfn[1024];
- strcpy(wfn, lfilename);
- strcat(wfn, ".BAK");
+ strncpy(wfn, lfilename, sizeof(wfn));
+ strncat(wfn, ".BAK", sizeof(wfn) - strlen(wfn));
if((out = fopen(wfn, "w")) == NULL)
{
- sprintf(buffer, "cannot open file %s for writing", wfn);
+ snprintf(buffer, sizeof(buffer), "cannot open file %s for writing", wfn);
perror(buffer);
exit(1);
}
@@ -184,14 +184,14 @@ void writefont()
if((out = fopen(lfilename, "w")) == NULL)
{
- sprintf(buffer, "cannot open file %s for writing", lfilename);
+ snprintf(buffer, sizeof(buffer), "cannot open file %s for writing", lfilename);
perror(buffer);
exit(1);
}
if((ret = fwrite(fonttab, sizeof(*fonttab), lfilesize, out)) != lfilesize)
{
- sprintf(buffer,"error writing file %s, size=%d, ret=%d\n",lfilename,lfilesize, ret);
+ snprintf(buffer,sizeof(buffer),"error writing file %s, size=%d, ret=%d\n",lfilename,lfilesize, ret);
perror(buffer);
exit(1);
}
diff --git a/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c b/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c
index d84c5fd4ec6..b80defdc229 100644
--- a/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c
+++ b/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ispcvt.c,v 1.6 1999/01/13 07:26:04 niklas Exp $ */
+/* $OpenBSD: ispcvt.c,v 1.7 1999/05/24 15:37:44 aaron Exp $ */
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis
@@ -119,7 +119,7 @@ char *argv[];
{
char buffer[80];
strcpy(buffer,"ERROR opening ");
- strcat(buffer,device);
+ strncat(buffer,device,sizeof(buffer) - strlen(buffer));
perror(buffer);
}
exit(1);
diff --git a/sys/arch/i386/isa/pcvt/Util/loadfont/loadfont.c b/sys/arch/i386/isa/pcvt/Util/loadfont/loadfont.c
index 5d1786e028a..e1dfb28568f 100644
--- a/sys/arch/i386/isa/pcvt/Util/loadfont/loadfont.c
+++ b/sys/arch/i386/isa/pcvt/Util/loadfont/loadfont.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loadfont.c,v 1.4 1999/01/13 07:26:06 niklas Exp $ */
+/* $OpenBSD: loadfont.c,v 1.5 1999/05/24 15:37:44 aaron Exp $ */
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis
@@ -141,7 +141,7 @@ main(int argc, char **argv)
{
char buffer[80];
strcpy(buffer,"ERROR opening ");
- strcat(buffer,device);
+ strncat(buffer,device,sizeof(buffer) - strlen(buffer));
perror(buffer);
exit(1);
}
@@ -226,7 +226,7 @@ main(int argc, char **argv)
if((in = fopen(filename, "r")) == NULL)
{
char buffer[80];
- sprintf(buffer, "cannot open file %s for reading", filename);
+ snprintf(buffer, sizeof(buffer), "cannot open file %s for reading", filename);
perror(buffer);
exit(1);
}
@@ -234,7 +234,7 @@ main(int argc, char **argv)
if((fstat(fileno(in), sbp)) != 0)
{
char buffer[80];
- sprintf(buffer, "cannot fstat file %s", filename);
+ snprintf(buffer, sizeof(buffer), "cannot fstat file %s", filename);
perror(buffer);
exit(1);
}
diff --git a/sys/arch/i386/isa/pcvt/Util/scon/scon.c b/sys/arch/i386/isa/pcvt/Util/scon/scon.c
index 92cf1ea7723..436cd143764 100644
--- a/sys/arch/i386/isa/pcvt/Util/scon/scon.c
+++ b/sys/arch/i386/isa/pcvt/Util/scon/scon.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scon.c,v 1.11 1999/01/13 07:26:06 niklas Exp $ */
+/* $OpenBSD: scon.c,v 1.12 1999/05/24 15:37:44 aaron Exp $ */
/*
* Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch
@@ -353,7 +353,7 @@ char *argv[];
{
char buffer[80];
strcpy(buffer,"ERROR opening ");
- strcat(buffer,device);
+ strncat(buffer,device,sizeof(buffer) - strlen(buffer));
perror(buffer);
exit(1);
}
diff --git a/sys/arch/i386/isa/pcvt/Util/userkeys/vt220keys.c b/sys/arch/i386/isa/pcvt/Util/userkeys/vt220keys.c
index 262f3c41862..9ada0fef774 100644
--- a/sys/arch/i386/isa/pcvt/Util/userkeys/vt220keys.c
+++ b/sys/arch/i386/isa/pcvt/Util/userkeys/vt220keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vt220keys.c,v 1.4 1999/01/13 07:26:07 niklas Exp $ */
+/* $OpenBSD: vt220keys.c,v 1.5 1999/05/24 15:37:44 aaron Exp $ */
/*
* Trivial program to load VT220 Function keys with strings,
@@ -93,7 +93,7 @@ int main(argc,argv)
int clearf = 0; /* clear all keys before loading strings */
char *strcpy();
- (void) strcpy(prog, *argv); /* store program name */
+ (void) strncpy(prog, *argv, sizeof(prog)); /* store program name */
if(argc == 1) usage(); /* program requires options */
@@ -251,9 +251,9 @@ void getinit()
/* construct full path name for init file */
home = getenv("HOME");
- (void) strcpy(path, home);
- (void) strcat(path,"/");
- (void) strcat(path,INITFILE);
+ (void) strncpy(path, home, sizeof(path));
+ (void) strncat(path,"/",sizeof(path) - strlen(path));
+ (void) strncat(path,INITFILE,sizeof(path) - strlen(path));
/* check status if init file */
if (stat(path, &statbuf) != -1)