Fix: Add additional error checking

This commit is contained in:
Denis Kenzior 2009-10-02 17:57:24 -05:00
parent c8150fc120
commit f7c97ca10a
1 changed files with 4 additions and 1 deletions

View File

@ -687,7 +687,10 @@ gboolean sim_parse_2g_get_response(unsigned char *response, int len,
int *file_len, int *record_len,
int *structure, unsigned char *access)
{
if (len < 14)
if (len < 14 || response[6] != 0x04)
return FALSE;
if ((response[13] == 0x01 || response[13] == 0x03) && len < 15)
return FALSE;
*file_len = (response[2] << 8) | response[3];