summaryrefslogtreecommitdiffstats
path: root/session.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2007-09-17 08:09:15 +0200
committerDamien Miller <djm@mindrot.org>2007-09-17 08:09:15 +0200
commit14b017d6f2277c83856489054e9c6c1428095bbb (patch)
treecc10c13ca8483de9ec16695a35de2355c90c29ef /session.c
parent - stevesk@cvs.openbsd.org 2007/09/11 04:36:29 (diff)
downloadopenssh-14b017d6f2277c83856489054e9c6c1428095bbb.tar.xz
openssh-14b017d6f2277c83856489054e9c6c1428095bbb.zip
- gilles@cvs.openbsd.org 2007/09/11 15:47:17
[session.c ssh-keygen.c sshlogin.c] use strcspn to properly overwrite '\n' in fgets returned buffer ok pyr@, ray@, millert@, moritz@, chl@
Diffstat (limited to 'session.c')
-rw-r--r--session.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/session.c b/session.c
index c19c2ac5a..2b0580b45 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.223 2007/08/23 02:55:51 djm Exp $ */
+/* $OpenBSD: session.c,v 1.224 2007/09/11 15:47:17 gilles Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -897,8 +897,9 @@ read_environment_file(char ***env, u_int *envsize,
;
if (!*cp || *cp == '#' || *cp == '\n')
continue;
- if (strchr(cp, '\n'))
- *strchr(cp, '\n') = '\0';
+
+ cp[strcspn(cp, "\n")] = '\0';
+
value = strchr(cp, '=');
if (value == NULL) {
fprintf(stderr, "Bad line %u in %.100s\n", lineno,