Skip to content

Consider null terminator when using malloc - #91

Merged
robiot merged 1 commit into
robiot:masterfrom
TomaSajt:master
Nov 22, 2023
Merged

robiot merged 1 commit into
robiot:masterfrom
TomaSajt:master

Conversation

@TomaSajt

@TomaSajt TomaSajt commented Nov 21, 2023 •

Copy link
Copy Markdown
Contributor

I was trying to package this program for Nixpkgs, and used its custom meson builder script, which uses some kind of fortification by default, which catches buffer overflows.

When running the program I got several buffer overflow errors, and with the help of coredumpctl I could trace it back to some string size math. It looks like there wasn't enough space for the null-terminator of the string.

@TomaSajt TomaSajt mentioned this pull request Nov 21, 2023
3 of 13 tasks

@robiot robiot left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool

@robiot

robiot commented Nov 22, 2023

Copy link
Copy Markdown
Owner

Thanks, looks like I missed that when allocating memory. I will merge this so you can package it for nixpkg!

@robiot
robiot merged commit c99f69a into robiot:master Nov 22, 2023
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