qmicli: fix PLMN printing

BCD PLMNs with 2 digit MNCs will have an 'F' digit between
the MCC and the MNC.  This maps to \0, which would cause
a truncated result string with only the MCC.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
This commit is contained in:
Bjørn Mork 2016-02-08 14:18:14 +01:00 committed by Dan Williams
parent 4aed63cf6b
commit 6f988368fd
1 changed files with 6 additions and 2 deletions

View File

@ -2233,8 +2233,12 @@ str_from_bcd_plmn (const gchar *bcd)
str = g_malloc (7);
for (i = 0, j = 0 ; i < 3; i++) {
str[j++] = bcd_chars[bcd[i] & 0xF];
str[j++] = bcd_chars[(bcd[i] >> 4) & 0xF];
str[j] = bcd_chars[bcd[i] & 0xF];
if (str[j])
j++;
str[j] = bcd_chars[(bcd[i] >> 4) & 0xF];
if (str[j])
j++;
}
str[j] = '\0';