* guard all mallocs in cbfstool

* fix an issue that could lead to cbfstool writing outside of its allocated
  memory 

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Peter Stuge <peter@stuge.se>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4653 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Stefan Reinauer
2009-09-22 15:55:01 +00:00
committed by Stefan Reinauer
parent 0e0655e6ef
commit 853270af39
2 changed files with 27 additions and 4 deletions

View File

@@ -29,7 +29,7 @@ static void *phys_to_virt(uint32_t addr)
static uint32_t virt_to_phys(void *addr)
{
return (long)(addr - offset) & 0xffffffff;
return (unsigned long)(addr - offset) & 0xffffffff;
}
#define ALIGN(val, by) (((val) + (by)-1)&~((by)-1))
@@ -61,3 +61,5 @@ int create_cbfs_image(const char *romfile, uint32_t romsize,
int add_file_to_cbfs(void *content, uint32_t contentsize, uint32_t location);
void print_cbfs_directory(const char *filename);
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))