summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2015-04-03 22:17:27 +0000
committerDamien Miller <djm@mindrot.org>2015-04-04 09:18:26 +1100
commit3f4ea3c9ab1d32d43c9222c4351f58ca11144156 (patch)
tree1ce9d621ecdabd2d6218e2f0c6c198e06d80d297
parent7da2be0cb9601ed25460c83aa4d44052b967ba0f (diff)
upstream commit
correct return value in pubkey parsing, spotted by Ben Hawkes ok markus@
-rw-r--r--sshkey.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sshkey.c b/sshkey.c
index 476879033..3cc3f444a 100644
--- a/sshkey.c
+++ b/sshkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshkey.c,v 1.15 2015/03/06 01:40:56 djm Exp $ */ 1/* $OpenBSD: sshkey.c,v 1.16 2015/04/03 22:17:27 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved. 4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -2013,8 +2013,8 @@ sshkey_from_blob_internal(struct sshbuf *b, struct sshkey **keyp,
2013 ret = SSH_ERR_ALLOC_FAIL; 2013 ret = SSH_ERR_ALLOC_FAIL;
2014 goto out; 2014 goto out;
2015 } 2015 }
2016 if (sshbuf_get_bignum2(b, key->rsa->e) == -1 || 2016 if (sshbuf_get_bignum2(b, key->rsa->e) != 0 ||
2017 sshbuf_get_bignum2(b, key->rsa->n) == -1) { 2017 sshbuf_get_bignum2(b, key->rsa->n) != 0) {
2018 ret = SSH_ERR_INVALID_FORMAT; 2018 ret = SSH_ERR_INVALID_FORMAT;
2019 goto out; 2019 goto out;
2020 } 2020 }
@@ -2035,10 +2035,10 @@ sshkey_from_blob_internal(struct sshbuf *b, struct sshkey **keyp,
2035 ret = SSH_ERR_ALLOC_FAIL; 2035 ret = SSH_ERR_ALLOC_FAIL;
2036 goto out; 2036 goto out;
2037 } 2037 }
2038 if (sshbuf_get_bignum2(b, key->dsa->p) == -1 || 2038 if (sshbuf_get_bignum2(b, key->dsa->p) != 0 ||
2039 sshbuf_get_bignum2(b, key->dsa->q) == -1 || 2039 sshbuf_get_bignum2(b, key->dsa->q) != 0 ||
2040 sshbuf_get_bignum2(b, key->dsa->g) == -1 || 2040 sshbuf_get_bignum2(b, key->dsa->g) != 0 ||
2041 sshbuf_get_bignum2(b, key->dsa->pub_key) == -1) { 2041 sshbuf_get_bignum2(b, key->dsa->pub_key) != 0) {
2042 ret = SSH_ERR_INVALID_FORMAT; 2042 ret = SSH_ERR_INVALID_FORMAT;
2043 goto out; 2043 goto out;
2044 } 2044 }