1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:04:59 +00:00

AK: printf was not accounting for plus sign with "%+d"

We have to include the plus sign in the number of characters written,
otherwise sprintf() will put the null terminator too early.
This commit is contained in:
Andreas Kling 2020-11-05 10:50:19 +01:00
parent eed78ffa5a
commit e9403e2b03
2 changed files with 15 additions and 1 deletions

View file

@ -284,7 +284,7 @@ ALWAYS_INLINE int print_signed_number(PutChFunc putch, char*& bufptr, int number
}
if (always_sign)
putch(bufptr, '+');
return print_number(putch, bufptr, number, left_pad, zero_pad, field_width);
return print_number(putch, bufptr, number, left_pad, zero_pad, field_width) + always_sign;
}
struct ModifierState {