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

Fix: setting stack buffer to NULL #1733

Merged
merged 1 commit into from
Oct 3, 2024
Merged

Fix: setting stack buffer to NULL #1733

merged 1 commit into from
Oct 3, 2024

Conversation

nichtsfrei
Copy link
Member

Since buffer within pluginlaunch.c is within the stack it cannot be NULL. This fixes that oversight.

I'm unsure why we even double check for the buffer to be empty when it is already indicated by len of fread.

@nichtsfrei nichtsfrei requested a review from a team as a code owner October 3, 2024 09:31
@github-actions github-actions bot added the patch_release creates a patch release label Oct 3, 2024
Since buffer within pluginlaunch.c is within the stack it cannot be
NULL. This fixes that oversight.

I'm unsure why we even double check for the buffer to be empty when it
is already indicated by len of fread.
@github-actions github-actions bot added patch_release creates a patch release and removed patch_release creates a patch release labels Oct 3, 2024
@nichtsfrei nichtsfrei merged commit a802306 into main Oct 3, 2024
17 of 19 checks passed
@nichtsfrei nichtsfrei deleted the fix-broken-pr branch October 3, 2024 11:07
@@ -411,7 +412,11 @@ get_available_memory ()
}
len = fread (buf, 1, sizeof (buf) - 1, fd);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi there, @nichtsfrei
IMHO - Rather than just reading the file, I think it would be better to get the file size from the offset and then make sure that the fread() reads and check as normally as the file size 😆

How about you?

Copy link
Contributor

Choose a reason for hiding this comment

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

It may not be too important, but char buf is using around 8192 of arbitrary unnecessary memory.
so I think it's good to get the file size and then read it that much.

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

Successfully merging this pull request may close these issues.

3 participants