diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-04-04 00:42:35 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-04-04 00:42:35 +0000 |
commit | daf329b1c0f01bbdd4028168949c69860a248f9e (patch) | |
tree | ca613584d0fe67c96c9239325b37011daa2ef3cc /usr.bin/awk/lib.c | |
parent | 51ea99310ccd7f074f3727add189ec97cde8b868 (diff) |
snprintf & strlcpy; tedu ok
Diffstat (limited to 'usr.bin/awk/lib.c')
-rw-r--r-- | usr.bin/awk/lib.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/awk/lib.c b/usr.bin/awk/lib.c index 27c6175232c..790b4f526d4 100644 --- a/usr.bin/awk/lib.c +++ b/usr.bin/awk/lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib.c,v 1.11 2002/12/19 21:24:28 millert Exp $ */ +/* $OpenBSD: lib.c,v 1.12 2003/04/04 00:42:34 deraadt Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -84,7 +84,7 @@ void makefields(int n1, int n2) /* create $n1..$n2 inclusive */ if (fldtab[i] == NULL) FATAL("out of space in makefields %d", i); *fldtab[i] = dollar1; - sprintf(temp, "%d", i); + snprintf(temp, sizeof temp, "%d", i); fldtab[i]->nval = tostring(temp); } } @@ -189,7 +189,7 @@ int readrec(char **pbuf, int *pbufsize, FILE *inf) /* read one record into buf * if (strlen(*FS) >= sizeof(inputFS)) FATAL("field separator %.10s... is too long", *FS); - strcpy(inputFS, *FS); /* for subsequent field splitting */ + strlcpy(inputFS, *FS, sizeof inputFS); /* for subsequent field splitting */ if ((sep = **RS) == 0) { sep = '\n'; while ((c=getc(inf)) == '\n' && c != EOF) /* skip leading \n's */ @@ -228,7 +228,7 @@ char *getargv(int n) /* get ARGV[n] */ char *s, temp[50]; extern Array *ARGVtab; - sprintf(temp, "%d", n); + snprintf(temp, sizeof temp, "%d", n); x = setsymtab(temp, "", 0.0, STR, ARGVtab); s = getsval(x); dprintf( ("getargv(%d) returns |%s|\n", n, s) ); |