From a0f6d93f76aea7dc47d1c082382b4f998c75495c Mon Sep 17 00:00:00 2001 From: dtucker Date: Sun, 31 Jan 2021 10:50:10 +0000 Subject: [PATCH] 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@ --- usr.bin/ssh/sshsig.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.bin/ssh/sshsig.c b/usr.bin/ssh/sshsig.c index 2638253958e..58ad4c2643f 100644 --- a/usr.bin/ssh/sshsig.c +++ b/usr.bin/ssh/sshsig.c @@ -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 * @@ -851,6 +851,7 @@ sshsig_check_allowed_keys(const char *path, const struct sshkey *sign_key, principal, sig_namespace); free(line); line = NULL; + linesize = 0; if (r == SSH_ERR_KEY_NOT_FOUND) continue; else if (r == 0) { @@ -996,6 +997,7 @@ sshsig_find_principals(const char *path, const struct sshkey *sign_key, sign_key, principals); free(line); line = NULL; + linesize = 0; if (r == SSH_ERR_KEY_NOT_FOUND) continue; else if (r == 0) { -- 2.20.1