Fix minimal-printf stack overflow

pull/12508/head
Evelyne Donnaes 2020-02-25 09:41:31 +00:00
parent 745a4b4513
commit a02f4b4856
1 changed files with 6 additions and 6 deletions

View File

@ -220,12 +220,12 @@ static void mbed_minimal_formatted_string_hexadecimal(char *buffer, size_t lengt
unsigned int nibble_one = (output >> 4);
unsigned int nibble_two = (output & 0x0F);
const char int2hex_lower[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
};
const char int2hex_upper[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};
static const char int2hex_lower[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
};
static const char int2hex_upper[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};
const char *int2hex = upper ? int2hex_upper : int2hex_lower;
if (print_leading_zero || nibble_one != 0) {