From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anatolij Gustschin Date: Tue, 23 Feb 2010 15:55:57 +0100 Subject: [U-Boot] [PATCH] cmd_mtdparts.c: prevent printbuffer overflows In-Reply-To: <20100223142546.57DE2EB3810@gemini.denx.de> References: <1266924140-14457-1-git-send-email-agust@denx.de> <20100223142546.57DE2EB3810@gemini.denx.de> Message-ID: <20100223155557.232246cc@wker> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Wolfgang, Wolfgang Denk wrote: > > + /* Check to prevent printbuffer overflows */ > > + if (mtdparts_default && strlen(mtdparts_default) > CONFIG_SYS_PBSIZE) { > > + puts("Warning: mtdparts too long," > > + " please increase CONFIG_SYS_PBSIZE\n"); > > + return; > > + } > > + > > Instead of adding essentially dead code that does not really help the > end user, it would be better to avoid the potential problems. As log > as the console code has not been improved, it may make sense to avoid > printf() when you don't really need it. This is indeed much better, thanks! > I recommend to change this > > > printf("mtdparts: %s\n", > > mtdparts_default ? mtdparts_default : "none"); > > into something like > > puts("mtdparts: "); > puts(mtdparts_default ? mtdparts_default : "none"); I'll fix it as suggested, thanks! Best regards, Anatolij -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de