Skip to content

Commit c1c8e07

Browse files
committed
fix: logging alignment on 32bit targets
The usage "%zu" here can cause a crash on some embedded log/printf implementations used by SS_LOGP don't correctly support the `z` length modifier which can cause misinterpretation and crashes. Cast to unsigned int and print with "%u" which is safe for the 32-bit targets used here.
1 parent 88b6e7e commit c1c8e07

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/softsim/uicc/btlv_utils.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ static void dump_ie(const struct ber_tlv_ie *ie, uint8_t indent, enum log_subsys
9595
delimiter = ' ';
9696
}
9797

98-
SS_LOGP(subsys, level, "%s%s(tag=0x%02x(0x%02x), cls=%x, constr=%s, len=%zu)%c %s\n", indent_str, title_str,
99-
ie->tag_encoded, ie->tag, ie->cls, ie->constr ? "true" : "false", value_len, delimiter, value_str);
98+
SS_LOGP(subsys, level, "%s%s(tag=0x%02x(0x%02x), cls=%x, constr=%s, len=%u)%c %s\n", indent_str, title_str,
99+
ie->tag_encoded, ie->tag, ie->cls, ie->constr ? "true" : "false", (unsigned int)value_len, delimiter,
100+
value_str);
100101
}
101102

102103
/*! Dump decoded BER-TLV data.

0 commit comments

Comments
 (0)