summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pcvt/userkeys
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2001-01-28 09:20:47 +0000
committerkris <kris@FreeBSD.org>2001-01-28 09:20:47 +0000
commit72eee5791327b4dcbfa3abdf32d7ef50392318fe (patch)
tree842f0a4320ea841993a99005bca19fd6856956e7 /usr.sbin/pcvt/userkeys
parentf8be4d8cb4a410f6081a42abe7bea6071e48053e (diff)
downloadFreeBSD-src-72eee5791327b4dcbfa3abdf32d7ef50392318fe.zip
FreeBSD-src-72eee5791327b4dcbfa3abdf32d7ef50392318fe.tar.gz
Finish cleaning up the error reporting (standardize on err*()/warn*())
and fix some overflows. Submitted by: Mike Heffner <mheffner@vt.edu>
Diffstat (limited to 'usr.sbin/pcvt/userkeys')
-rw-r--r--usr.sbin/pcvt/userkeys/vt220keys.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/usr.sbin/pcvt/userkeys/vt220keys.c b/usr.sbin/pcvt/userkeys/vt220keys.c
index 55664c5..ac9c3fc 100644
--- a/usr.sbin/pcvt/userkeys/vt220keys.c
+++ b/usr.sbin/pcvt/userkeys/vt220keys.c
@@ -24,9 +24,12 @@
-hm minor modifications for pcvt 2.0 release
+$FreeBSD$
*/
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <ctype.h>
/*
@@ -81,9 +84,8 @@ main(argc,argv)
int initf = 0; /* read initialization file */
int lockf = 0; /* lock keys after loading strings */
int clearf = 0; /* clear all keys before loading strings */
- char *strcpy();
- (void) strcpy(prog, *argv); /* store program name */
+ strlcpy(prog, *argv, sizeof(prog)); /* store program name */
if(argc == 1) usage(); /* program requires options */
@@ -232,18 +234,9 @@ getinit()
struct stat statbuf; /* stat of the init file */
FILE *fp; /* file pointer to init file */
- /* system calls and subroutines */
- FILE *fopen();
- char *strcpy();
- char *strcat();
- char *fgets();
- char *getenv();
-
/* construct full path name for init file */
home = getenv("HOME");
- (void) strcpy(path, home);
- (void) strcat(path,"/");
- (void) strcat(path,INITFILE);
+ snprintf(path, sizeof(path), "%s/%s", home, INITFILE);
/* check status if init file */
if (stat(path, &statbuf) != -1)
OpenPOWER on IntegriCloud