Skip to content

Check calloc/strdup return values in GS_FT_get - #126

Open
SAY-5 wants to merge 1 commit into
hackerschoice:masterfrom
SAY-5:fix-gs-ft-get-null-alloc
Open

Check calloc/strdup return values in GS_FT_get#126
SAY-5 wants to merge 1 commit into
hackerschoice:masterfrom
SAY-5:fix-gs-ft-get-null-alloc

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jul 18, 2026

Copy link
Copy Markdown

GS_FT_get() in tools/filetransfer.c dereferences the pointer from calloc() and stores the result of strdup() without checking either for failure (issue #123). If calloc returns NULL the following p->pattern = ... writes through a NULL pointer.

This returns -1 on allocation failure, matching the existing convention in the sibling GS_FT_put(), and frees the partially-built request if strdup fails.

Closes #123

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
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.

calloc/strdup return value unchecked in GS_FT_get

1 participant