Skip to content

guard SnprintF return against int overflow - #2130

Open
dxbjavid wants to merge 1 commit into
abseil:masterfrom
dxbjavid:snprintf-return-overflow
Open

guard SnprintF return against int overflow#2130
dxbjavid wants to merge 1 commit into
abseil:masterfrom
dxbjavid:snprintf-return-overflow

Conversation

@dxbjavid

Copy link
Copy Markdown
Contributor

snprintf can return a bogus length for oversize output

If SnprintF is asked to format more than INT_MAX bytes the size_t byte count is narrowed straight into the int return value, so absl::SNPrintF may hand back a negative or otherwise wrong length while errno is left untouched. The sibling FprintF already rejects the same case with EFBIG, so this just brings the buffer path into line and adds a test next to the existing FprintfTooLarge one.

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