Skip to content

split: allocate space for NUL terminator in CSV mode#266

Open
millert wants to merge 1 commit into
onetrueawk:stagingfrom
millert:csv_split
Open

split: allocate space for NUL terminator in CSV mode#266
millert wants to merge 1 commit into
onetrueawk:stagingfrom
millert:csv_split

Conversation

@millert
Copy link
Copy Markdown
Contributor

@millert millert commented May 9, 2026

If the string to be split doesn't contain a comma, the entire string will be written to the buffer, including the NUL terminator. Because the size allocated does not take the NUL terminator into account, it will write the NUL one byte past the end of the buffer.

Found by Frank Denis using the Swival Security Scanner

https://github.com/Swival/security-audits/blob/015508ed21b8c5fabfd699ddbad6f82bf60780ed/openbsd-bin/audit-findings/071-csv-split-allocates-one-byte-too-few.md

@plan9
Copy link
Copy Markdown
Collaborator

plan9 commented May 9, 2026

ok, thanks

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.

2 participants