Skip to contentSkip to conversation

simauth: Fixed incorrect AUTS length

PATCH Applied James Prestwood 2 participants 2 messages Oct 20, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 simauth: Fixed incorrect AUTS length

The initial SimAuth implementation incorrectly parsed the AUTS value as 16 bytes, not 14.

---
 src/sim-auth.c | 2 +-
 src/simutil.c  | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)
src/sim-auth.c +1 -1
index 9ae5574..c0b2422 100644
@@ -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);
src/simutil.c +5 -4
index 8fbde15..2f49500 100644
@@ -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,16 +1695,17 @@ 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;
 
+
 		break;
 	default:
 		goto umts_end;
Signature · 1 line
2.7.4
#1 lore raw

Hi James,

Quoted 7 lines · James Prestwood

The initial SimAuth implementation incorrectly parsed the AUTS value as 16 bytes, not 14.

---
  src/sim-auth.c | 2 +-
  src/simutil.c  | 9 +++++----
  2 files changed, 6 insertions(+), 5 deletions(-)

Applied, thanks.

Regards,
-Denis