lib: check hostname in resolver_resolve #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
resolver_resolve should check hostname is null or not.
if ares_gethostbyname() get a null hostname string, it will access a null pointer and crash.
test result:
![null](https://user-images.githubusercontent.com/57648884/177693893-d7ed392b-761d-4d1b-a606-5fcfb8ab084d.png)
trace code:
![log1](https://user-images.githubusercontent.com/57648884/177693878-429fccce-2aa8-4e33-9637-a8ea8a388c0f.png)
![log1-1](https://user-images.githubusercontent.com/57648884/177693884-cef1f1f1-8dbe-45d7-8100-b5b94ed8b378.png)