upstream: Set linesize returned by getline to zero when freeing and

NULLing the returned string.  OpenBSD's getline handles this just fine, but
some implementations used by -portable do not.  ok djm@

OpenBSD-Commit-ID: 4d7bd5169d3397654247db9655cc69a9908d165c
This commit is contained in:
dtucker@openbsd.org 2021-01-31 10:50:10 +00:00 committed by Damien Miller
parent a5dfc5bae8
commit 7a92a324a2
1 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sshsig.c,v 1.19 2021/01/26 00:49:30 djm Exp $ */ /* $OpenBSD: sshsig.c,v 1.20 2021/01/31 10:50:10 dtucker Exp $ */
/* /*
* Copyright (c) 2019 Google LLC * Copyright (c) 2019 Google LLC
* *
@ -853,6 +853,7 @@ sshsig_check_allowed_keys(const char *path, const struct sshkey *sign_key,
principal, sig_namespace); principal, sig_namespace);
free(line); free(line);
line = NULL; line = NULL;
linesize = 0;
if (r == SSH_ERR_KEY_NOT_FOUND) if (r == SSH_ERR_KEY_NOT_FOUND)
continue; continue;
else if (r == 0) { else if (r == 0) {
@ -998,6 +999,7 @@ sshsig_find_principals(const char *path, const struct sshkey *sign_key,
sign_key, principals); sign_key, principals);
free(line); free(line);
line = NULL; line = NULL;
linesize = 0;
if (r == SSH_ERR_KEY_NOT_FOUND) if (r == SSH_ERR_KEY_NOT_FOUND)
continue; continue;
else if (r == 0) { else if (r == 0) {