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

Introduced fix for defect IOTSFW-1058 #79

Merged
merged 2 commits into from
Oct 22, 2015
Merged

Introduced fix for defect IOTSFW-1058 #79

merged 2 commits into from
Oct 22, 2015

Conversation

andresag01
Copy link

Introduced a fix for defect IOTSFW-1058 that caused the
BLE_EddystoneBeaconConfigService example in ARMmbed/ble-examples repo to fail.
Refer to JIRA defect for more details.

Introduced a fix for defect IOTSFW-1058 that caused the
BLE_EddystoneBeaconConfigService example in ARMmbed/ble-examples repo to fail.
Refer to JIRA defect for more details.
return false;
}
defaultUrlPower = power;
memcpy(defaultUriData, encodedUrlIn, URI_DATA_MAX);
Copy link
Contributor

Choose a reason for hiding this comment

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

would strncpy() be better here? I don't like to use memcpy() because it is unconditional. It might be copying memory which isn't related to the encoded URL. This is not an issue; but just an sanity booster.

Copy link
Author

Choose a reason for hiding this comment

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

I think this would introduce a bug. Recall that the encoding for ".com/" is 0x0, which is equivalent to "\0" then with the encoding of a URL like "http://mbed.com/hello" the last 5 characters will be dropped. This is because according to the documentation for strncpy():

If the end of the source C string (which is signaled by a null-character) is found before num characters have been copied, destination is padded with zeros until a total of num characters have been written to it.

Introduced fixes after review of previous commit with regards to JIRA defect
IOTSFW-1058.
rgrover added a commit that referenced this pull request Oct 22, 2015
Introduced fix for defect IOTSFW-1058
@rgrover rgrover merged commit 4c76373 into ARMmbed:develop Oct 22, 2015
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.

2 participants