From: Wolfgang Denk Date: Sun, 28 Apr 2013 00:35:34 +0200 Subject: [U-Boot] [PATCH] env: don't add an empty key to the env hashtable In-Reply-To: <1367099787-25602-1-git-send-email-cojocar@gmail.com> References: <1367099787-25602-1-git-send-email-cojocar@gmail.com> Message-ID: <20130427223534.0A1F33811D4@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > --- > 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. 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. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de You cannot propel yourself forward by patting yourself on the back.