diff uicc/hlread.c @ 56:d4b5a6e547ca

fc-uicc-tool iccid command: same change as in fc-simtool
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 13 Feb 2021 19:45:04 +0000
parents 1b1468869ccf
children ede661d78730
line wrap: on
line diff
--- a/uicc/hlread.c	Sat Feb 13 19:42:14 2021 +0000
+++ b/uicc/hlread.c	Sat Feb 13 19:45:04 2021 +0000
@@ -11,7 +11,7 @@
 {
 	int rc;
 	unsigned len;
-	char buf[21];
+	char buf[21], *cp;
 
 	rc = select_op(FILEID_MF);
 	if (rc < 0)
@@ -30,7 +30,9 @@
 	if (rc < 0)
 		return(rc);
 	decode_reversed_nibbles(sim_resp_data, 10, buf);
-	buf[20] = '\0';
+	for (cp = buf + 20; (cp > buf + 1) && (cp[-1] == 'F'); cp--)
+		;
+	*cp = '\0';
 	printf("%s\n", buf);
 	return(0);
 }