diff options
author | Damien Miller <djm@mindrot.org> | 2002-06-26 15:51:06 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2002-06-26 15:51:06 +0200 |
commit | 990070a8c5dead1fcfc270ec797af1f05dba058a (patch) | |
tree | 89ebdb79b0382ece76e6e6fac0fea4926ec15dfc /session.c | |
parent | - deraadt@cvs.openbsd.org 2002/06/26 13:20:57 (diff) | |
download | openssh-990070a8c5dead1fcfc270ec797af1f05dba058a.tar.xz openssh-990070a8c5dead1fcfc270ec797af1f05dba058a.zip |
- deraadt@cvs.openbsd.org 2002/06/26 13:49:26
[session.c]
disclose less information from environment files; based on input
from djm, and dschultz@uclink.Berkeley.EDU
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -33,7 +33,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: session.c,v 1.141 2002/06/26 08:58:26 markus Exp $"); +RCSID("$OpenBSD: session.c,v 1.142 2002/06/26 13:49:26 deraadt Exp $"); #include "ssh.h" #include "ssh1.h" @@ -877,12 +877,15 @@ read_environment_file(char ***env, u_int *envsize, FILE *f; char buf[4096]; char *cp, *value; + u_int lineno = 0; f = fopen(filename, "r"); if (!f) return; while (fgets(buf, sizeof(buf), f)) { + if (++lineno > 1000) + fatal("Too many lines in environment file %s", filename); for (cp = buf; *cp == ' ' || *cp == '\t'; cp++) ; if (!*cp || *cp == '#' || *cp == '\n') @@ -891,7 +894,8 @@ read_environment_file(char ***env, u_int *envsize, *strchr(cp, '\n') = '\0'; value = strchr(cp, '='); if (value == NULL) { - fprintf(stderr, "Bad line in %.100s: %.200s\n", filename, buf); + fprintf(stderr, "Bad line %u in %.100s\n", lineno, + filename); continue; } /* |