diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ssh-agent.c | 16 |
2 files changed, 15 insertions, 7 deletions
@@ -16,6 +16,10 @@ | |||
16 | - deraadt@cvs.openbsd.org 2006/03/28 01:52:28 | 16 | - deraadt@cvs.openbsd.org 2006/03/28 01:52:28 |
17 | [channels.c] | 17 | [channels.c] |
18 | do not accept unreasonable X ports numbers; ok djm | 18 | do not accept unreasonable X ports numbers; ok djm |
19 | - deraadt@cvs.openbsd.org 2006/03/28 01:53:43 | ||
20 | [ssh-agent.c] | ||
21 | use strtonum() to parse the pid from the file, and range check it | ||
22 | better; ok djm | ||
19 | 23 | ||
20 | 20060326 | 24 | 20060326 |
21 | - OpenBSD CVS Sync | 25 | - OpenBSD CVS Sync |
@@ -4465,4 +4469,4 @@ | |||
4465 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM | 4469 | - (djm) Trim deprecated options from INSTALL. Mention UsePAM |
4466 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu | 4470 | - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu |
4467 | 4471 | ||
4468 | $Id: ChangeLog,v 1.4292 2006/03/31 12:11:07 djm Exp $ | 4472 | $Id: ChangeLog,v 1.4293 2006/03/31 12:11:28 djm Exp $ |
diff --git a/ssh-agent.c b/ssh-agent.c index eb99effd0..162760ac2 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-agent.c,v 1.135 2006/03/25 18:41:45 deraadt Exp $ */ | 1 | /* $OpenBSD: ssh-agent.c,v 1.136 2006/03/28 01:53:43 deraadt Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -1077,20 +1077,24 @@ main(int ac, char **av) | |||
1077 | 1077 | ||
1078 | if (ac == 0 && !c_flag && !s_flag) { | 1078 | if (ac == 0 && !c_flag && !s_flag) { |
1079 | shell = getenv("SHELL"); | 1079 | shell = getenv("SHELL"); |
1080 | if (shell != NULL && strncmp(shell + strlen(shell) - 3, "csh", 3) == 0) | 1080 | if (shell != NULL && |
1081 | strncmp(shell + strlen(shell) - 3, "csh", 3) == 0) | ||
1081 | c_flag = 1; | 1082 | c_flag = 1; |
1082 | } | 1083 | } |
1083 | if (k_flag) { | 1084 | if (k_flag) { |
1085 | const char *errstr = NULL; | ||
1086 | |||
1084 | pidstr = getenv(SSH_AGENTPID_ENV_NAME); | 1087 | pidstr = getenv(SSH_AGENTPID_ENV_NAME); |
1085 | if (pidstr == NULL) { | 1088 | if (pidstr == NULL) { |
1086 | fprintf(stderr, "%s not set, cannot kill agent\n", | 1089 | fprintf(stderr, "%s not set, cannot kill agent\n", |
1087 | SSH_AGENTPID_ENV_NAME); | 1090 | SSH_AGENTPID_ENV_NAME); |
1088 | exit(1); | 1091 | exit(1); |
1089 | } | 1092 | } |
1090 | pid = atoi(pidstr); | 1093 | pid = (int)strtonum(pidstr, 2, INT_MAX, &errstr); |
1091 | if (pid < 1) { | 1094 | if (errstr) { |
1092 | fprintf(stderr, "%s=\"%s\", which is not a good PID\n", | 1095 | fprintf(stderr, |
1093 | SSH_AGENTPID_ENV_NAME, pidstr); | 1096 | "%s=\"%s\", which is not a good PID: %s\n", |
1097 | SSH_AGENTPID_ENV_NAME, pidstr, errstr); | ||
1094 | exit(1); | 1098 | exit(1); |
1095 | } | 1099 | } |
1096 | if (kill(pid, SIGTERM) == -1) { | 1100 | if (kill(pid, SIGTERM) == -1) { |