1
0
Fork 0
forked from len0rd/rockbox

More consistent error checking.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8364 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2006-01-18 08:34:32 +00:00
parent 22ffc9bf03
commit a8c408c6a3
2 changed files with 7 additions and 7 deletions

View file

@ -243,7 +243,8 @@ int codec_load_ram(char* codecptr, int size, void* ptr2, int bufwrap,
}
hdr = (struct codec_header *)codecbuf;
if (hdr->magic != CODEC_MAGIC
if (size <= (signed)sizeof(struct codec_header)
|| hdr->magic != CODEC_MAGIC
|| hdr->target_id != TARGET_ID
|| hdr->load_addr != codecbuf
|| hdr->end_addr > codecbuf + CODEC_SIZE) {
@ -258,8 +259,7 @@ int codec_load_ram(char* codecptr, int size, void* ptr2, int bufwrap,
if (hdr == NULL
|| hdr->magic != CODEC_MAGIC
|| hdr->target_id != TARGET_ID
|| hdr->entry_point == NULL) {
|| hdr->target_id != TARGET_ID) {
sim_codec_close(pd);
return CODEC_ERROR;
}