From: Lucian Cojocar <cojocar@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] env: don't add an empty key to the env hashtable
Date: Sun, 28 Apr 2013 01:08:10 +0200 [thread overview]
Message-ID: <517C5A5A.2010106@gmail.com> (raw)
In-Reply-To: <20130427223534.0A1F33811D4@gemini.denx.de>
On 04/28/2013 12:35 AM, Wolfgang Denk wrote:
> Dear Lucian Cojocar,
>
> In message <1367099787-25602-1-git-send-email-cojocar@gmail.com> you wrote:
>> If the environment contains an entry like "=value" "\0" we should skip
>> this key/value. Otherwise, U-Boot will enter in an infinite loop.
>>
>> Signed-off-by: Lucian Cojocar <cojocar@gmail.com>
>> ---
>> lib/hashtable.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/lib/hashtable.c b/lib/hashtable.c
>> index 07ebfb2..8f5a6f8 100644
>> --- a/lib/hashtable.c
>> +++ b/lib/hashtable.c
>> @@ -870,6 +870,10 @@ int himport_r(struct hsearch_data *htab,
>> *sp++ = '\0'; /* terminate value */
>> ++dp;
>>
>> + /* skip this entry if the name is empty */
>> + if (*name == 0)
>> + continue;
>
> NAK. This would be a serious error, and silently ignoring this is
> downright wrong.
>
> If such a situation should ever happen, it must cause a fatal error.
>
I agree.
> Could you please explain which exact problem you are trying to fix?
> I have to admit that I cannot think of a usage szenario that would
> lead to such an error.
I had an error (typo) in my predefined environment. Basically I had this:
#define CONFIG_EXTRA_ENV_SETTINGS \
"key" "\0" "=value" "\0"
It would be nice if U-Boot told me that there was something wrong with
my environment rather than just hang.
Thanks,
Lucian
next prev parent reply other threads:[~2013-04-27 23:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-27 21:56 [U-Boot] [PATCH] env: don't add an empty key to the env hashtable Lucian Cojocar
2013-04-27 22:35 ` Wolfgang Denk
2013-04-27 23:08 ` Lucian Cojocar [this message]
2013-04-28 9:06 ` Wolfgang Denk
2013-04-28 21:31 ` [U-Boot] [PATCH v2] env: throw an error when an empty key is used Lucian Cojocar
2013-05-10 19:58 ` [U-Boot] [U-Boot, " Tom Rini
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=517C5A5A.2010106@gmail.com \
--to=cojocar@gmail.com \
--cc=u-boot@lists.denx.de \
/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