git: df872d66f24a - stable/14 - loader: Increase buffer size to accommodate longer commands

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 26 Mar 2025 01:28:52 UTC
The branch stable/14 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=df872d66f24a4f496cddb1e2da2222f10e3bc722

commit df872d66f24a4f496cddb1e2da2222f10e3bc722
Author:     Ahmad Khalifa <ahmadkhalifa570@gmail.com>
AuthorDate: 2024-06-05 00:32:58 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-03-26 01:28:37 +0000

    loader: Increase buffer size to accommodate longer commands
    
    The longest command we have is "efi-autoresizecons". That combined with
    the two spaces before and after the command gives us a total of 23
    characters including the null-terminator.
    
    Also move the two trailing spaces to their own pager_output call so they
    don't get truncated if the command is too long and increase the minimum
    string length to 20 in order to fix alignment issues caused by the
    increased buffer size.
    
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1277
    
    (cherry picked from commit ab08da5328b4175e399d8e59adc4dfad0eea24f1)
---
 stand/common/commands.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/stand/common/commands.c b/stand/common/commands.c
index e6e4fd005f72..95d12ad95973 100644
--- a/stand/common/commands.c
+++ b/stand/common/commands.c
@@ -229,7 +229,7 @@ command_commandlist(int argc __unused, char *argv[] __unused)
 {
 	struct bootblk_command	**cmdp;
 	int	res;
-	char	name[20];
+	char	name[23];
 
 	res = 0;
 	pager_open();
@@ -238,9 +238,10 @@ command_commandlist(int argc __unused, char *argv[] __unused)
 		if (res)
 			break;
 		if ((*cmdp)->c_name != NULL && (*cmdp)->c_desc != NULL) {
-			snprintf(name, sizeof(name), "  %-15s  ",
+			snprintf(name, sizeof(name), "  %-20s",
 			    (*cmdp)->c_name);
 			pager_output(name);
+			pager_output("  ");
 			pager_output((*cmdp)->c_desc);
 			res = pager_output("\n");
 		}