From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Sat, 27 Nov 2010 23:19:43 +0100 Subject: [U-Boot] [RFC/PATCHv2 1/2] Common/command: Guard strchr/strlen from NULL pointer In-Reply-To: <1290600472-23147-1-git-send-email-weber@corscience.de> References: <20101124110719.C428C135EA0@gemini.denx.de> <1290600472-23147-1-git-send-email-weber@corscience.de> Message-ID: <20101127221943.24CD3B7172@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 Thomas Weber, In message <1290600472-23147-1-git-send-email-weber@corscience.de> you wrote: > Guard strchr/strlen from being called with NULL pointer. > This line is crashing when command "env" is called without subcommand. > > The cmd is NULL in this case because the calling function "do_env" > decremented the argc without checking if there are still arguments available. > > Signed-off-by: Thomas Weber > --- > Changes for v2: > - Use shorter way to leave function in error case. > > common/command.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) Applied, thanks. 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 Every little picofarad has a nanohenry all its own. - Don Vonada