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

Attempt to fix buffer overflows with rDNS tags #63

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/parsley.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3510,9 +3510,9 @@ AtomicInfo *APar_reverseDNS_atom_Init(const char *rDNS_atom_name,
0,
ilst_atom->AtomicLevel + 2,
rDNS_mean_atom);
// set atom length to 12 as it was from the beginning before applying
// set atom length to 16 as it was from the beginning before applying
// https://github.com/wez/atomicparsley/issues/44
parsedAtoms[rDNS_name_atom].AtomicLength = 12;
parsedAtoms[rDNS_name_atom].AtomicLength = 16;
Copy link
Contributor

@howyallare howyallare Jun 2, 2023

Choose a reason for hiding this comment

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

I think this was right the first time being initialised to 12. Otherwise you can get a buffer overrun and an invalid "name" atom written to file when the length of its value is 16.

Copy link
Author

Choose a reason for hiding this comment

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

Tried with value 12 instead of 16 on a single file and indeed it seems to work.


parsedAtoms[rDNS_name_atom].ReverseDNSname =
(char *)calloc(1, sizeof(char) * (name_len + 1));
Expand Down