mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-24 07:46:42 +00:00
Console: avoid to use buf for '-' and '0' padding chars
As buf is not sized depending on the padding, if a huge padding is put in buf then we could see an overflow.
This commit is contained in:
parent
c41a2a8279
commit
9593d59b3a
@ -188,7 +188,7 @@ void Console::_out_signed(T value, unsigned base)
|
||||
|
||||
/* add sign to buffer for negative values */
|
||||
if (neg)
|
||||
buf[i++] = '-';
|
||||
_out_char('-');
|
||||
|
||||
/* output buffer in reverse order */
|
||||
for (; i--; )
|
||||
@ -223,7 +223,7 @@ void Console::_out_unsigned(T value, unsigned base, int pad)
|
||||
|
||||
/* add padding zeros */
|
||||
for (; pad-- > 0; )
|
||||
buf[i++] = ascii(0);
|
||||
_out_char(ascii(0));
|
||||
|
||||
/* output buffer in reverse order */
|
||||
for (; i--; )
|
||||
|
Loading…
Reference in New Issue
Block a user