diff options
author | Damien Miller <djm@mindrot.org> | 2007-09-17 08:09:15 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2007-09-17 08:09:15 +0200 |
commit | 14b017d6f2277c83856489054e9c6c1428095bbb (patch) | |
tree | cc10c13ca8483de9ec16695a35de2355c90c29ef /session.c | |
parent | - stevesk@cvs.openbsd.org 2007/09/11 04:36:29 (diff) | |
download | openssh-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.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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, |