[U-Boot] [PATCH] unzip: return uncompressed size in `filesize', and print it.

Wolfgang Denk wd at denx.de
Fri Feb 11 20:21:15 CET 2011


Dear Peter Tyser,

In message <1297443439.965.1208.camel at petert> you wrote:
> 
> > -	return !!gunzip((void *) dst, dst_len, (void *) src, &src_len);
> > +	rc = gunzip((void *) dst, dst_len, (void *) src, &src_len);
> > +
> > +	printf("Uncompressed size: %ld = 0x%lX\n", src_len, src_len);
> > +	sprintf(buf, "%lX", src_len);
> > +	setenv("filesize", buf);
> > +
> > +	return !!rc;
> 
> What about:
> if (rc)
> 	return rc;
> 
> printf("Uncompressed size: %ld = 0x%lX\n", src_len, src_len);
> sprintf(buf, "%lX", src_len);
> setenv("filesize", buf);
> 
> return 0;
> 
> 
> This will prevent printing and setting of bogus values when an invalid
> or overly large image is unzipped.

Good point, will fix.  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
HANDLE WITH EXTREME CARE:  This Product Contains  Minute Electrically
Charged  Particles  Moving  at  Velocities  in Excess of Five Hundred
Million Miles Per Hour.


More information about the U-Boot mailing list