[coreboot] [bios_extract] filenames patch for phoenix

Peter Stuge peter at stuge.se
Mon Jan 11 23:53:15 CET 2010


Matthias Wenzel wrote:
> +++ b/phoenix.c
..
> @@ -117,10 +117,10 @@ PhoenixModule(unsigned char *BIOSImage, int BIOSLength, int Offset)
>  
>      ModuleName = PhoenixModuleNameGet(Module->Type);
>      if (ModuleName) {
> -	filename = malloc(strlen(ModuleName) + 7);
> +	filename = malloc(strlen(ModuleName) + 7 + 3);
>  	sprintf(filename, "%s_%1d.rom", ModuleName, Module->Id);
>      } else {
> -	filename = malloc(9);
> +	filename = malloc(9 + 3);
>  	sprintf(filename, "%02X_%1d.rom", Module->Type, Module->Id);
>      }

If everything (also Type) is u8 then the above is 1 byte extra :) but
better safe than sorry!

If anything is larger than u8 then the above needs some more bytes.


//Peter




More information about the coreboot mailing list