[PATCH v1 1/1] Set cmdline array size to COMMAND_LINE_SIZE

bfgithub at veryspeedy.net bfgithub at veryspeedy.net
Wed Aug 18 19:21:46 PDT 2021


From: Berto Furth <bfgithub at veryspeedy.net>

Use maximum size in declaration of ATAG cmdline string.

The declaration of the cmdline string in the ATAG type tag_cmdline
uses an array size of 1. This means that the fortified versions of
string functions (like strlcpy) will panic when they see that the
actual contents of the cmdline string are bigger than 1 byte.

Fix is to simply indicate that the string can actually be up to
COMMAND_LINE_SIZE bytes by setting the array size as such.

Signed-off-by: Berto Furth <bfgithub at veryspeedy.net>
Tested-by: Berto Furth <bfgithub at veryspeedy.net>
---
 arch/arm/include/uapi/asm/setup.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/uapi/asm/setup.h b/arch/arm/include/uapi/asm/setup.h
index 25ceda63b284..9c88c919467b 100644
--- a/arch/arm/include/uapi/asm/setup.h
+++ b/arch/arm/include/uapi/asm/setup.h
@@ -124,7 +124,7 @@ struct tag_videolfb {
 #define ATAG_CMDLINE	0x54410009
 
 struct tag_cmdline {
-	char	cmdline[1];	/* this is the minimum size */
+	char	cmdline[COMMAND_LINE_SIZE];
 };
 
 /* acorn RiscPC specific information */
-- 
2.32.0




More information about the linux-arm-kernel mailing list