summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2020-03-06 18:13:30 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2020-03-06 18:13:30 +0000
commit14d071b9f0d7eb24dbed2f1a316e79fd71f3d252 (patch)
tree3903fee47595a47b510974873eba5119012d671b /usr.bin
parent4142e404a953a306517e38dbce7aa0d6ed999114 (diff)
sshsig: return correct error, fix null-deref; ok djm
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/sshsig.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.bin/ssh/sshsig.c b/usr.bin/ssh/sshsig.c
index b3402611216..356f0583b0e 100644
--- a/usr.bin/ssh/sshsig.c
+++ b/usr.bin/ssh/sshsig.c
@@ -207,8 +207,10 @@ sshsig_wrap_sign(struct sshkey *key, const char *hashalg,
goto done;
}
- *out = blob;
- blob = NULL;
+ if (out != NULL) {
+ *out = blob;
+ blob = NULL;
+ }
r = 0;
done:
free(sig);
@@ -422,7 +424,7 @@ hash_buffer(const struct sshbuf *m, const char *hashalg, struct sshbuf **bp)
out:
sshbuf_free(b);
explicit_bzero(hash, sizeof(hash));
- return 0;
+ return r;
}
int
@@ -550,7 +552,7 @@ hash_file(int fd, const char *hashalg, struct sshbuf **bp)
sshbuf_free(b);
ssh_digest_free(ctx);
explicit_bzero(hash, sizeof(hash));
- return 0;
+ return r;
}
int
@@ -833,7 +835,7 @@ sshsig_check_allowed_keys(const char *path, const struct sshkey *sign_key,
char *line = NULL;
size_t linesize = 0;
u_long linenum = 0;
- int r, oerrno;
+ int r = SSH_ERR_INTERNAL_ERROR, oerrno;
/* Check key and principal against file */
if ((f = fopen(path, "r")) == NULL) {