From: dtucker@openbsd.org Date: Wed, 11 Jun 2025 13:24:05 +0000 (+0000) Subject: upstream: Improve termination condition of while loop to compare X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=4b3d27032ba88dd089b721f3bbe3e4a8d23b4ae1;p=thirdparty%2Fopenssh-portable.git upstream: Improve termination condition of while loop to compare size_t's. Assuming read() does what it's supposed to this shouldn't matter, but should be more robust. Flagged by Coverity CID 470514, ok djm@ OpenBSD-Commit-ID: d7b5ad60feb797b3464964b9ea67fd78fb9d6cc6 --- diff --git a/readpass.c b/readpass.c index d42b1185d..5a88824b4 100644 --- a/readpass.c +++ b/readpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readpass.c,v 1.71 2024/03/30 04:27:44 djm Exp $ */ +/* $OpenBSD: readpass.c,v 1.72 2025/06/11 13:24:05 dtucker Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. * @@ -91,7 +91,7 @@ ssh_askpass(char *askpass, const char *msg, const char *env_hint) if (r <= 0) break; len += r; - } while (sizeof(buf) - 1 - len > 0); + } while (len < sizeof(buf) - 1); buf[len] = '\0'; close(p[0]);