mirror of
git://anongit.mindrot.org/openssh.git
synced 2024-12-25 11:22:10 +00:00
- chl@cvs.openbsd.org 2007/10/02 17:49:58
[ssh-keygen.c] handles zero-sized strings that fgets can return
This commit is contained in:
parent
b8c9807628
commit
0f4ed693d6
@ -30,6 +30,9 @@
|
|||||||
- dtucker@cvs.openbsd.org 2007/09/29 00:25:51
|
- dtucker@cvs.openbsd.org 2007/09/29 00:25:51
|
||||||
[auth2.c]
|
[auth2.c]
|
||||||
Remove unused prototype. ok djm@
|
Remove unused prototype. ok djm@
|
||||||
|
- chl@cvs.openbsd.org 2007/10/02 17:49:58
|
||||||
|
[ssh-keygen.c]
|
||||||
|
handles zero-sized strings that fgets can return
|
||||||
|
|
||||||
20070927
|
20070927
|
||||||
- (dtucker) [configure.ac atomicio.c] Fall back to including <sys/poll.h> if
|
- (dtucker) [configure.ac atomicio.c] Fall back to including <sys/poll.h> if
|
||||||
@ -3301,4 +3304,4 @@
|
|||||||
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
||||||
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.4766 2007/10/26 04:26:15 djm Exp $
|
$Id: ChangeLog,v 1.4767 2007/10/26 04:26:32 djm Exp $
|
||||||
|
16
ssh-keygen.c
16
ssh-keygen.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: ssh-keygen.c,v 1.162 2007/09/11 15:47:17 gilles Exp $ */
|
/* $OpenBSD: ssh-keygen.c,v 1.163 2007/10/02 17:49:58 chl Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
@ -535,8 +535,7 @@ do_fingerprint(struct passwd *pw)
|
|||||||
f = fopen(identity_file, "r");
|
f = fopen(identity_file, "r");
|
||||||
if (f != NULL) {
|
if (f != NULL) {
|
||||||
while (fgets(line, sizeof(line), f)) {
|
while (fgets(line, sizeof(line), f)) {
|
||||||
i = strlen(line) - 1;
|
if ((cp = strchr(line, '\n')) == NULL) {
|
||||||
if (line[i] != '\n') {
|
|
||||||
error("line %d too long: %.40s...", num, line);
|
error("line %d too long: %.40s...", num, line);
|
||||||
skip = 1;
|
skip = 1;
|
||||||
continue;
|
continue;
|
||||||
@ -546,7 +545,7 @@ do_fingerprint(struct passwd *pw)
|
|||||||
skip = 0;
|
skip = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
line[i] = '\0';
|
*cp = '\0';
|
||||||
|
|
||||||
/* Skip leading whitespace, empty and comment lines. */
|
/* Skip leading whitespace, empty and comment lines. */
|
||||||
for (cp = line; *cp == ' ' || *cp == '\t'; cp++)
|
for (cp = line; *cp == ' ' || *cp == '\t'; cp++)
|
||||||
@ -614,7 +613,7 @@ do_known_hosts(struct passwd *pw, const char *name)
|
|||||||
Key *public;
|
Key *public;
|
||||||
char *cp, *cp2, *kp, *kp2;
|
char *cp, *cp2, *kp, *kp2;
|
||||||
char line[16*1024], tmp[MAXPATHLEN], old[MAXPATHLEN];
|
char line[16*1024], tmp[MAXPATHLEN], old[MAXPATHLEN];
|
||||||
int c, i, skip = 0, inplace = 0, num = 0, invalid = 0, has_unhashed = 0;
|
int c, skip = 0, inplace = 0, num = 1, invalid = 0, has_unhashed = 0;
|
||||||
|
|
||||||
if (!have_identity) {
|
if (!have_identity) {
|
||||||
cp = tilde_expand_filename(_PATH_SSH_USER_HOSTFILE, pw->pw_uid);
|
cp = tilde_expand_filename(_PATH_SSH_USER_HOSTFILE, pw->pw_uid);
|
||||||
@ -649,19 +648,18 @@ do_known_hosts(struct passwd *pw, const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (fgets(line, sizeof(line), in)) {
|
while (fgets(line, sizeof(line), in)) {
|
||||||
num++;
|
if ((cp = strchr(line, '\n')) == NULL) {
|
||||||
i = strlen(line) - 1;
|
|
||||||
if (line[i] != '\n') {
|
|
||||||
error("line %d too long: %.40s...", num, line);
|
error("line %d too long: %.40s...", num, line);
|
||||||
skip = 1;
|
skip = 1;
|
||||||
invalid = 1;
|
invalid = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
num++;
|
||||||
if (skip) {
|
if (skip) {
|
||||||
skip = 0;
|
skip = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
line[i] = '\0';
|
*cp = '\0';
|
||||||
|
|
||||||
/* Skip leading whitespace, empty and comment lines. */
|
/* Skip leading whitespace, empty and comment lines. */
|
||||||
for (cp = line; *cp == ' ' || *cp == '\t'; cp++)
|
for (cp = line; *cp == ' ' || *cp == '\t'; cp++)
|
||||||
|
Loading…
Reference in New Issue
Block a user