simauth: Fixed incorrect AUTS length

The initial SimAuth implementation incorrectly parsed
the AUTS value as 16 bytes, not 14.
This commit is contained in:
James Prestwood 2017-10-20 10:40:52 -07:00 committed by Denis Kenzior
parent 35636752ad
commit 2bc262b3af
2 changed files with 5 additions and 5 deletions

View File

@ -272,7 +272,7 @@ static void handle_umts(struct ofono_sim_auth *sim, const uint8_t *resp,
"{say}", &dict);
if (auts) {
append_dict_byte_array(&dict, "AUTS", auts, 16);
append_dict_byte_array(&dict, "AUTS", auts, 14);
} else {
append_dict_byte_array(&dict, "RES", res, 8);
append_dict_byte_array(&dict, "CK", ck, 16);

View File

@ -1657,7 +1657,7 @@ gboolean sim_parse_umts_authenticate(const unsigned char *buffer,
const unsigned char **ik, const unsigned char **auts,
const unsigned char **kc)
{
if (len < 18 || !buffer)
if (len < 16 || !buffer)
return FALSE;
switch (buffer[0]) {
@ -1695,12 +1695,12 @@ gboolean sim_parse_umts_authenticate(const unsigned char *buffer,
break;
case 0xdc:
/* 'DB' + '10' + AUTS(16) = 18 */
if (len < 18)
/* 'DC' + '0E' + AUTS(14) = 16 */
if (len < 16)
goto umts_end;
/* sync error */
if (buffer[1] != 0x10)
if (buffer[1] != 0x0e)
goto umts_end;
*auts = buffer + 2;