-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
Replace to strncmp from strcmp on examples/bluetoot/gatt_client #502
Replace to strncmp from strcmp on examples/bluetoot/gatt_client #502
Conversation
|
||
if (adv_name != NULL) { | ||
if (strcmp((char *)adv_name, device_name) == 0) { | ||
if (strcmp(adv_name_chars, device_name) == 0) { |
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.
Am I right to think that it would be sufficient to replace this strcmp
with strncmp((char *)adv_name, device_name, adv_name_len)
?
Allocating a 256 byte array on the stack may cause stack overflow issues...
@igrr Is ts ok that I commited 2 times for this pull request? Thanks. |
If you can squash two commits and force-push to this branch, that would be perfect. |
Done, how about it? |
Thanks, looks good. Copying this into the internal review and merge queue. |
Thanks. |
…ooth/gatt_client (Amended slightly from version in #502 to account for differences when adv_name is a prefix of device_name.)
Fix device_name check in gatt_client example `strcmp` was used against `adv_name` array, which was not a zero terminated string, causing `strcmp` check to fail for valid names. Ref. #502 See merge request !652
Cherry-picked in a797dca. This merge took a little longer than expected because we ended up tweaking the commit a bit (for the case where device name is a prefix of adv_name, or vice versa.) Thanks for identifying the problem and sending the fix. :) |
@projectgus |
* Add files via upload Calls to writePattern() don't send the desired number of bytes when the pattern size doesn't divide evenly into the hardware FIFO size (e.g. sending 18-bit RGB data, 11 patterns take 63 bytes, so 1/64th of the data is never sent). * Add files via upload Remove white space changes.
Thanks for useful example projects.
I tried to use GATT client project but I cannot establish connection between server and the client.
I found that
strcmp
does not return expected result on my environment so I changed the value.My environment
After this modification, GATT client proceed connection to found server device.
Thanks.