mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: David Dgien <dgienda125@gmail.com>
To: barebox@lists.infradead.org
Cc: David Dgien <dgienda125@gmail.com>
Subject: [PATCH] password: Fix warning with empty default password
Date: Tue, 19 May 2020 23:55:55 -0400	[thread overview]
Message-ID: <20200520035555.84422-1-dgienda125@gmail.com> (raw)

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 <dgienda125@gmail.com>
---
 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2020-05-20  3:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-20  3:55 David Dgien [this message]
2020-05-20  6:26 ` Uwe Kleine-König
2020-05-21  3:04   ` David Dgien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200520035555.84422-1-dgienda125@gmail.com \
    --to=dgienda125@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox