Skip to content

Commit d94965f

Browse files
authored
Merge pull request #12508 from evedon/ed-mprintf-stack-overflow
Fix minimal-printf stack overflow
2 parents 4f07086 + a02f4b4 commit d94965f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

platform/source/minimal-printf/mbed_printf_implementation.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,12 @@ static void mbed_minimal_formatted_string_hexadecimal(char *buffer, size_t lengt
220220
unsigned int nibble_one = (output >> 4);
221221
unsigned int nibble_two = (output & 0x0F);
222222

223-
const char int2hex_lower[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
224-
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
225-
};
226-
const char int2hex_upper[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
227-
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
228-
};
223+
static const char int2hex_lower[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
224+
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
225+
};
226+
static const char int2hex_upper[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
227+
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
228+
};
229229
const char *int2hex = upper ? int2hex_upper : int2hex_lower;
230230

231231
if (print_leading_zero || nibble_one != 0) {

0 commit comments

Comments
 (0)