summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2020-03-06 18:15:38 +0000
committermarkus <markus@openbsd.org>2020-03-06 18:15:38 +0000
commit805ffd19e445a3fa19681259da208f30b8c71f38 (patch)
treed55833ae2f2d6b54d3558d72104e31c5f464e94b
parentexit if ssh_krl_revoke_key_sha256 fails; ok djm (diff)
downloadwireguard-openbsd-805ffd19e445a3fa19681259da208f30b8c71f38.tar.xz
wireguard-openbsd-805ffd19e445a3fa19681259da208f30b8c71f38.zip
fix null-deref on calloc failure; ok djm
-rw-r--r--usr.bin/ssh/auth-options.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/ssh/auth-options.c b/usr.bin/ssh/auth-options.c
index d01fbf7c793..7bc20e485ec 100644
--- a/usr.bin/ssh/auth-options.c
+++ b/usr.bin/ssh/auth-options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth-options.c,v 1.91 2020/02/26 13:40:09 jsg Exp $ */
+/* $OpenBSD: auth-options.c,v 1.92 2020/03/06 18:15:38 markus Exp $ */
/*
* Copyright (c) 2018 Damien Miller <djm@mindrot.org>
*
@@ -731,9 +731,11 @@ deserialise_array(struct sshbuf *m, char ***ap, size_t *np)
*np = n;
n = 0;
out:
- for (i = 0; i < n; i++)
- free(a[i]);
- free(a);
+ if (a != NULL) {
+ for (i = 0; i < n; i++)
+ free(a[i]);
+ free(a);
+ }
sshbuf_free(b);
return r;
}