When CONFIG_PASSWORD_DEFAULT is unset, the default_passwd buffer is set
to the empty string. The read_default_passwd() function wants to read at
least two characters from that buffer, causing GCC to generate an array
bounds warning. Make the default_passwd buffer have at least 2 bytes so
this warning is not generated.

Since the read_default_passwd() function is only called when
default_passwd is not the empty string, this is not a functional change.

Signed-off-by: David Dgien <[email protected]>
---
 common/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/Makefile b/common/Makefile
index c14af692f..3b63e89ed 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -74,7 +74,7 @@ ifdef CONFIG_PASSWORD
 
 ifeq ($(CONFIG_PASSWORD_DEFAULT),"")
 define filechk_passwd
-       echo "static const char default_passwd[] = \"\";"
+       echo "static const char default_passwd[] = \"\\0\";"
 endef
 else
 define filechk_passwd
-- 
2.26.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to