[openssh-commits] [openssh] 01/05: upstream: fix rtrim() function to not attempt to delete whitespace

git+noreply at mindrot.org git+noreply at mindrot.org
Thu Sep 4 13:06:38 AEST 2025


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 8e85ad33cfcc71e03594e53f2e19d8ce2e27dcc6
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Thu Sep 4 00:31:49 2025 +0000

    upstream: fix rtrim() function to not attempt to delete whitespace
    
    inside a string, just at the end. ok deraadt@
    
    OpenBSD-Commit-ID: d44deaa43580cd88de978dd5509b14e905b67b84
---
 misc.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/misc.c b/misc.c
index c80f65554..183332082 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.205 2025/09/04 00:30:06 djm Exp $ */
+/* $OpenBSD: misc.c,v 1.206 2025/09/04 00:31:49 djm Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  * Copyright (c) 2005-2020 Damien Miller.  All rights reserved.
@@ -101,10 +101,13 @@ rtrim(char *s)
 
 	if ((i = strlen(s)) == 0)
 		return;
-	for (i--; i > 0; i--) {
+	do {
+		i--;
 		if (isspace((unsigned char)s[i]))
 			s[i] = '\0';
-	}
+		else
+			break;
+	} while (i > 0);
 }
 
 /*

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list