summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>2002-01-23 18:13:51 +0000
committerHakan Olsson <ho@cvs.openbsd.org>2002-01-23 18:13:51 +0000
commit06a8d66b021d7c173881d28d46ce27b18871f0b3 (patch)
tree5ac5a89c072915f6debac3e1cace7017594886e4
parent5db3b6bd3166b141e55d8937492e4dfeb056b304 (diff)
sprintf->snprintf & bugfix
-rw-r--r--sbin/isakmpd/apps/keyconv/keyconv.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sbin/isakmpd/apps/keyconv/keyconv.c b/sbin/isakmpd/apps/keyconv/keyconv.c
index 18534f1a088..5e9175b5a68 100644
--- a/sbin/isakmpd/apps/keyconv/keyconv.c
+++ b/sbin/isakmpd/apps/keyconv/keyconv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keyconv.c,v 1.2 2001/08/22 15:25:32 ho Exp $ */
+/* $OpenBSD: keyconv.c,v 1.3 2002/01/23 18:13:50 ho Exp $ */
/*
* Copyright (c) 2000, 2001 Hakan Olsson. All rights reserved.
@@ -606,6 +606,7 @@ convert_openssl_to_dns (char *file_in, char *file_out)
DH *dh;
enum DNS_TAGS tag;
char *pubname;
+ int len;
rsa = NULL;
dsa = NULL;
@@ -645,8 +646,15 @@ convert_openssl_to_dns (char *file_in, char *file_out)
return 1;
}
- pubname = strdup (file_out);
- sprintf (pubname + strlen (pubname), ".pubkey");
+ len = strlen (file_out) + sizeof ".pubkey" + 1;
+ pubname = malloc (len);
+ if (!pubname)
+ {
+ perror ("malloc");
+ return 1;
+ }
+ strlcpy (pubname, file_out, len);
+ strlcat (pubname, ".pubkey", len);
fprintf (stderr, "Writing output file \"%s\".\n", file_out);
fprintf (oo, "%s v%d.%d\n", dns_tags[TAG_VERSION], MAJOR_VERSION,