-
Notifications
You must be signed in to change notification settings - Fork 9
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 _cbor_value_copy_string #7
Fix buffer overflow in _cbor_value_copy_string #7
Conversation
The function is documented to only null-terminate when the buffer is big enough to allow it. Both upstream intel/tinycbor and mynewt's version do this correctly.
Because this repo has diverged significantly from intel/tinycbor due to PR #1: |
It looks like that PR aligned this repository with the mynewt version of the library. Since you say mynewt's version also contains the fix, can we do another update to the latest mynewt code? I'm concerned about this project diverging so significantly from its upstreams that it becomes a hard fork. |
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.
I would merge this ASAP. We can glue the history (git merge --allow-unrelated-histories)) after that. This merge is urgent IMO.
The fix is not in mynewt because they never had the bug. This bug was created by the huge code changes in PR #1, most of which appear to have been brand new Zephyr-specific code.
It already has. The commit message for PR #1 has 18 bullet points, and only the first one menitioned syncing with upstream mynewt tinycbor (which version, I have no idea -- I have a hard time finding matching code). This repository is vastly different from both intel/tinycbor and the copy in apache/mynewt-core. |
@nvlsianpu it's a small fix and I'm fine with merging it, but it looks like we have a big problem with this project based on information from @jimparis:
How are we going to fix this? We shouldn't have modules that diverge this much from upstream IMO. Maybe PR #1 should never have been merged? @nashif @carlescufi thoughts on what to do? |
I found some more history behind these changes in these PRs: Original commit to zephyr with the buffer overflow introduced was this: Which was from this commit FYI someone else will have to take over untangling this -- I will be basically unavailable from around Oct 10 - Nov 20. |
This also isn't just a clerical matter of "gluing" histories together. It's about the code base not accumulating technical debt and forcing our users to find and fix bugs that should have been managed upstream. |
Maybe we should align with the copy in mynewt then. The reason we took the changes that diverged from upstream TinyCBOR was for this to work correctly with mcumgr, which is a cross-platform library that both Zephyr and Mynewt use as a DFU protocol. |
^^Will check |
I have looked into the fix and it should be fine, with one remark I agree on the need to align with one of upstreams. |
@nvlsianpu I have no strong opinion. I have just used it once. I agree that we should rather stick to one version and not create our own. |
There was a trial to push the patche required by the zephyr mcumgr fork (both were libraries in the zephyr's directories in those-days) library to the intel fork, but without success as PR stall. [the zephyr tinycbor] was modified in order to made it OS agnostic (as far I can remember). |
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.
Lets get it done. The fix is fine for now, until we sync/align with newt or intel version.
Point to the current revision at the tip of the tinycbor repo after merging zephyrproject-rtos/tinycbor#7. Fixes zephyrproject-rtos#19629. Signed-off-by: Carles Cufi <[email protected]>
Point to the current revision at the tip of the tinycbor repo after merging zephyrproject-rtos/tinycbor#7. Fixes #19629. Signed-off-by: Carles Cufi <[email protected]>
The function is documented to only null-terminate when the buffer is big enough to allow it. Both upstream intel/tinycbor and mynewt's version do this correctly.
See zephyrproject-rtos/zephyr#19629 for details.