summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2001-09-17 20:50:23 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2001-09-17 20:50:23 +0000
commitaad4c7907aa6a2f0a6bc53a12ad05e75b7dae23d (patch)
treec80b9a654d8ff17c03ca84ff8c28d316f7f96295 /usr.bin
parent633b768efe89c15b8a55e9d9f9a1b3c8a816c125 (diff)
better error handling if you try to export a bad key to ssh.com
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/key.c7
-rw-r--r--usr.bin/ssh/ssh-keygen.c7
2 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/ssh/key.c b/usr.bin/ssh/key.c
index 482168de08f..b382f36cf2b 100644
--- a/usr.bin/ssh/key.c
+++ b/usr.bin/ssh/key.c
@@ -32,7 +32,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
-RCSID("$OpenBSD: key.c,v 1.30 2001/09/17 19:27:15 stevesk Exp $");
+RCSID("$OpenBSD: key.c,v 1.31 2001/09/17 20:50:22 markus Exp $");
#include <openssl/evp.h>
@@ -728,8 +728,9 @@ key_to_blob(Key *key, u_char **blobp, u_int *lenp)
buffer_put_bignum2(&b, key->rsa->n);
break;
default:
- error("key_to_blob: illegal key type %d", key->type);
- break;
+ error("key_to_blob: unsupported key type %d", key->type);
+ buffer_free(&b);
+ return 0;
}
len = buffer_len(&b);
buf = xmalloc(len);
diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c
index ed2be941870..2358111bcfd 100644
--- a/usr.bin/ssh/ssh-keygen.c
+++ b/usr.bin/ssh/ssh-keygen.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-keygen.c,v 1.80 2001/09/17 19:27:15 stevesk Exp $");
+RCSID("$OpenBSD: ssh-keygen.c,v 1.81 2001/09/17 20:50:22 markus Exp $");
#include <openssl/evp.h>
#include <openssl/pem.h>
@@ -159,7 +159,10 @@ do_convert_to_ssh2(struct passwd *pw)
exit(1);
}
}
- key_to_blob(k, &blob, &len);
+ if (key_to_blob(k, &blob, &len) <= 0) {
+ fprintf(stderr, "key_to_blob failed\n");
+ exit(1);
+ }
fprintf(stdout, "%s\n", SSH_COM_PUBLIC_BEGIN);
fprintf(stdout,
"Comment: \"%d-bit %s, converted from OpenSSH by %s@%s\"\n",