programs: cert_write: fixed bug in parsing dec serial

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
This commit is contained in:
Valerio Setti 2023-01-12 15:31:35 +01:00
parent 856cec45eb
commit 48fdbb3940

View file

@ -277,7 +277,7 @@ int parse_serial_decimal_format(unsigned char *obuf, size_t obufmax,
val = (dec >> ((remaining_bytes - 1) * 8)) & 0xFF;
/* Skip leading zeros */
if ((val) != 0) {
if ((val != 0) || (*len != 0)) {
*p = val;
(*len)++;
p++;