summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-02-08 14:39:37 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-02-08 14:39:37 +0000
commit35eb94911efb3d17fd511aa733e810b77a71fa76 (patch)
treed9b585c8a8419a0518598c980717adb3f5ebc394
parent9041f1b4926f316c48e03d7bb83da48aff4be89f (diff)
snprintf
-rw-r--r--usr.bin/ssh/readconf.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.bin/ssh/readconf.c b/usr.bin/ssh/readconf.c
index 4fc830c9318..889fef4828e 100644
--- a/usr.bin/ssh/readconf.c
+++ b/usr.bin/ssh/readconf.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: readconf.c,v 1.60 2001/01/28 20:36:16 stevesk Exp $");
+RCSID("$OpenBSD: readconf.c,v 1.61 2001/02/08 14:39:36 deraadt Exp $");
#include "ssh.h"
#include "xmalloc.h"
@@ -715,6 +715,8 @@ initialize_options(Options * options)
void
fill_default_options(Options * options)
{
+ int len;
+
if (options->forward_agent == -1)
options->forward_agent = 0;
if (options->forward_x11 == -1)
@@ -781,16 +783,18 @@ fill_default_options(Options * options)
options->protocol = SSH_PROTO_1|SSH_PROTO_2|SSH_PROTO_1_PREFERRED;
if (options->num_identity_files == 0) {
if (options->protocol & SSH_PROTO_1) {
+ len = 2 + strlen(_PATH_SSH_CLIENT_IDENTITY) + 1;
options->identity_files[options->num_identity_files] =
- xmalloc(2 + strlen(_PATH_SSH_CLIENT_IDENTITY) + 1);
- sprintf(options->identity_files[options->num_identity_files++],
- "~/%.100s", _PATH_SSH_CLIENT_IDENTITY);
+ xmalloc(len);
+ snprintf(options->identity_files[options->num_identity_files++],
+ len, "~/%.100s", _PATH_SSH_CLIENT_IDENTITY);
}
if (options->protocol & SSH_PROTO_2) {
+ len = 2 + strlen(_PATH_SSH_CLIENT_ID_DSA) + 1;
options->identity_files[options->num_identity_files] =
- xmalloc(2 + strlen(_PATH_SSH_CLIENT_ID_DSA) + 1);
- sprintf(options->identity_files[options->num_identity_files++],
- "~/%.100s", _PATH_SSH_CLIENT_ID_DSA);
+ xmalloc(len);
+ snprintf(options->identity_files[options->num_identity_files++],
+ len, "~/%.100s", _PATH_SSH_CLIENT_ID_DSA);
}
}
if (options->escape_char == -1)