Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed buffer overflow in printint #299

Open
wants to merge 1 commit into
base: riscv
Choose a base branch
from

Conversation

HirbodBehnam
Copy link

Hi

There is a buffer overflow in printint function which can be triggered if numbers with more than 16 digits are written to the terminal. Numbers 18446744073709551615 and -9223372036854775808 both have 20 digits for instance. To this extent, I increased the buffer size to 20 characters which can fit base 10 of all 64 bit numbers (negative or positive).

I was also curious if this bug exists in x86 version of xv6. But apparently, the printint function used to accept an int instead of long long which was only 32 bits!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant