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 buffer overflow in wcstombs_s() function #59

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dhmhd
Copy link

@dhmhd dhmhd commented Dec 4, 2023

Closes #58

Fix failure in case when domain name (dataVal variable) contains error message "getaddrinfo failed: 0xfffffffd Temporary failure in name resolution", or when domain name widechar representation is loo long.

dhmhd added 6 commits December 4, 2023 18:24
I've never seen such syntax, consider this a mistake.
Exception occurs in two cases:
1. Widechar representation of domain name is too long and not fit multibyte buffer after conversion;
2. Domain name contains resolve error message.

I think it makes sense to use the _TRUNCATE constant

https://learn.microsoft.com/en-us/cpp/c-runtime-library/truncate?view=msvc-170
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/wcstombs-s-wcstombs-s-l?view=msvc-170
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.

Issues running host-sflow on Windows hyper-v
1 participant