-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fixed strcasestr() #3076
Fixed strcasestr() #3076
Conversation
iskraman
commented
Sep 25, 2022
- Source : sdp.c
- Problem : strncasecmp() function -> This function may fail to find matches on some platforms
- Reference : https://www.gnu.org/software/gnulib/manual/html_node/strcasestr.html
- It has caused problems in our system and it would be good to solve them in a safe way.
- My System info
- Test code
Is |
@iskraman ping... |
@pong~
Hi~ Lorenzo.
We were conducting a modular test based on Janus gateway's source.
During the test process, it was found that the function of the strcasestr()
function did not operate normally.
And we find that _GNU_SOURCE must be defined to use this.
Because strcasestr() function is a nonstandard extention.
This can lead to unintended problems.
It needs to be replaced by safe features supported by the standard.
However, if you think there is no problem, you can reject my offer.
I respect and like your team.
Thank you.
2022년 10월 3일 (월) 오후 7:21, Lorenzo Miniero ***@***.***>님이 작성:
… @iskraman <https://github.com/iskraman> ping...
—
Reply to this email directly, view it on GitHub
<#3076 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIOL7IJEPXPSUBZ6ECK2MI3WBKXRZANCNFSM6AAAAAAQVEX7EI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
TL;DR: I agree with this proposal.
As @iskraman mentioned, being If that macro is not defined, the shared C snippet will successfully build, but with the following warning:
and the output will not be the expected one -> matching failed. I didn't check, but I guess the compiler is replacing Since we are basically using |
TL;DR: checked through gdb and assembly why this is happening, and I am still strongly convinced that a patch is needed here. When The actual return value of This is confirmed by inspecting the assembly, due to the code fetching the result of mov eax, 0
call strcasestr ; save the output in rax/eax
cdqe ; extend eax in rax
cmp QWORD PTR [rbp-8], rax ; compare rax and the ptr to the string In the version with call strcasestr ; save the output in rax/eax
cmp QWORD PTR [rbp-8], rax ; compare rax and the ptr to the string |
4e15b84
to
f0d0db2
Compare
@@ -357,6 +357,7 @@ int janus_sdp_process_remote(void *ice_handle, janus_sdp *remote_sdp, gboolean r | |||
/* FIXME We should handle this somehow anyway... OpenSSL supports them all */ | |||
JANUS_LOG(LOG_WARN, "[%"SCNu64"] Hashing algorithm not the one we expected (sha-256), *NOT* cool\n", handle->handle_id); | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this empty line
Thanks! Merging then (I'll remove the extra line myself). I'll also take care of porting the fix to |
BTW in case anyone was curious, calling |