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

Peter Tyser ptyser at xes-inc.com
Fri Feb 11 17:57:19 CET 2011


Hi Wolfgang,

> -	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.

Best,
Peter



More information about the U-Boot mailing list