From: markus Date: Fri, 8 Dec 2023 09:18:39 +0000 (+0000) Subject: prevent leak in sshsig_match_principals; ok djm@ X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8d543432a22cbd42cb581b2b3d4a68f8f4a16923;p=openbsd prevent leak in sshsig_match_principals; ok djm@ --- diff --git a/usr.bin/ssh/sshsig.c b/usr.bin/ssh/sshsig.c index b35801531c6..268940b03c8 100644 --- a/usr.bin/ssh/sshsig.c +++ b/usr.bin/ssh/sshsig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshsig.c,v 1.33 2023/09/06 23:18:15 djm Exp $ */ +/* $OpenBSD: sshsig.c,v 1.34 2023/12/08 09:18:39 markus Exp $ */ /* * Copyright (c) 2019 Google LLC * @@ -1119,12 +1119,11 @@ sshsig_match_principals(const char *path, const char *principal, if (ret == 0) { if (nprincipals == 0) ret = SSH_ERR_KEY_NOT_FOUND; + if (nprincipalsp != 0) + *nprincipalsp = nprincipals; if (principalsp != NULL) { *principalsp = principals; principals = NULL; /* transferred */ - } - if (nprincipalsp != 0) { - *nprincipalsp = nprincipals; nprincipals = 0; } }