diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-11-23 18:01:00 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-11-23 18:01:00 +0000 |
commit | 19fb58ed59ed9a41a94059d6166bf818a43e5e19 (patch) | |
tree | 2deefe1c753cba248ceaae01fd07209b24c46cf7 /usr.sbin/named | |
parent | d75115f56b816578bf8ed8fabe5f282bd659efb7 (diff) |
pass length for OpenFile(), bug in previous oflow detection; found by form
Diffstat (limited to 'usr.sbin/named')
-rw-r--r-- | usr.sbin/named/nslookup/list.c | 8 | ||||
-rw-r--r-- | usr.sbin/named/nslookup/main.c | 8 | ||||
-rw-r--r-- | usr.sbin/named/nslookup/subr.c | 11 |
3 files changed, 14 insertions, 13 deletions
diff --git a/usr.sbin/named/nslookup/list.c b/usr.sbin/named/nslookup/list.c index 3cb090835dd..3f7501b415a 100644 --- a/usr.sbin/named/nslookup/list.c +++ b/usr.sbin/named/nslookup/list.c @@ -1,4 +1,4 @@ -/* $OpenBSD: list.c,v 1.5 1998/09/10 18:38:09 deraadt Exp $ */ +/* $OpenBSD: list.c,v 1.6 1998/11/23 18:00:58 deraadt Exp $ */ /* * ++Copyright++ 1985, 1989 @@ -60,7 +60,7 @@ static char sccsid[] = "@(#)list.c 5.23 (Berkeley) 3/21/91"; static char rcsid[] = "$From: list.c,v 8.9 1996/11/26 10:11:26 vixie Exp $"; #else -static char rcsid[] = "$OpenBSD: list.c,v 1.5 1998/09/10 18:38:09 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: list.c,v 1.6 1998/11/23 18:00:58 deraadt Exp $"; #endif #endif /* not lint */ @@ -340,7 +340,7 @@ ListSubr(qtype, domain, cmd) if (cmd == NULL) { filePtr = stdout; } else { - filePtr = OpenFile(cmd, file); + filePtr = OpenFile(cmd, file, sizeof file); if (filePtr == NULL) { fprintf(stderr, "*** Can't open %s for writing\n", file); (void) close(sockFD); @@ -999,7 +999,7 @@ Finger(string, putToFile) if (!putToFile) { filePtr = stdout; } else { - filePtr = OpenFile(string, file); + filePtr = OpenFile(string, file, sizeof file); if (filePtr == NULL) { fprintf(stderr, "*** Can't open %s for writing\n", file); close(sockFD); diff --git a/usr.sbin/named/nslookup/main.c b/usr.sbin/named/nslookup/main.c index db40d4b57e9..98e03e8f0b5 100644 --- a/usr.sbin/named/nslookup/main.c +++ b/usr.sbin/named/nslookup/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.5 1998/08/31 18:58:37 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.6 1998/11/23 18:00:58 deraadt Exp $ */ /* * ++Copyright++ 1985, 1989 @@ -66,7 +66,7 @@ char copyright[] = static char sccsid[] = "@(#)main.c 5.42 (Berkeley) 3/3/91"; static char rcsid[] = "$From: main.c,v 8.4 1996/11/11 06:36:54 vixie Exp $"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.5 1998/08/31 18:58:37 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.6 1998/11/23 18:00:58 deraadt Exp $"; #endif #endif /* not lint */ @@ -694,7 +694,7 @@ LookupHost(string, putToFile) if (!putToFile) { filePtr = stdout; } else { - filePtr = OpenFile(string, file); + filePtr = OpenFile(string, file, sizeof file); if (filePtr == NULL) { fprintf(stderr, "*** Can't open %s for writing\n", file); return(ERROR); @@ -758,7 +758,7 @@ LookupHostWithServer(string, putToFile) if (!putToFile) { filePtr = stdout; } else { - filePtr = OpenFile(string, file); + filePtr = OpenFile(string, file, sizeof file); if (filePtr == NULL) { fprintf(stderr, "*** Can't open %s for writing\n", file); return(ERROR); diff --git a/usr.sbin/named/nslookup/subr.c b/usr.sbin/named/nslookup/subr.c index 57d20caa627..6999185298f 100644 --- a/usr.sbin/named/nslookup/subr.c +++ b/usr.sbin/named/nslookup/subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr.c,v 1.3 1998/08/30 03:39:21 deraadt Exp $ */ +/* $OpenBSD: subr.c,v 1.4 1998/11/23 18:00:59 deraadt Exp $ */ /* * ++Copyright++ 1985, 1989 @@ -60,7 +60,7 @@ static char sccsid[] = "@(#)subr.c 5.24 (Berkeley) 3/2/91"; static char rcsid[] = "$From: subr.c,v 8.6 1996/08/08 06:54:51 vixie Exp $"; #else -static char rcsid[] = "$OpenBSD: subr.c,v 1.3 1998/08/30 03:39:21 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: subr.c,v 1.4 1998/11/23 18:00:59 deraadt Exp $"; #endif #endif /* not lint */ @@ -337,9 +337,10 @@ PrintHostInfo(file, title, hp) */ FILE * -OpenFile(string, file) +OpenFile(string, file, flen) char *string; char *file; + int flen; { char *redirect; FILE *tmpPtr; @@ -355,11 +356,11 @@ OpenFile(string, file) return(NULL); } if (redirect[1] == '>') { - snprintf(get, sizeof get, ">> %%%ds", sizeof file-1); + snprintf(get, sizeof get, ">> %%%ds", flen-1); sscanf(redirect, get, file); tmpPtr = fopen(file, "a+"); } else { - snprintf(get, sizeof get, "> %%%ds", sizeof file-1); + snprintf(get, sizeof get, "> %%%ds", flen-1); sscanf(redirect, get, file); tmpPtr = fopen(file, "w"); } |