-
Notifications
You must be signed in to change notification settings - Fork 68
Fix coverity issues #659
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 coverity issues #659
Conversation
WalkthroughThe changes reorder resource cleanup calls in cloud deregistration error handling and simplify event callback timer polling by removing an unnecessary variable and explicitly resetting a global pointer before callbacks. Additionally, message reference counting and deallocation are refactored to separate concerns, with related updates in CoAP message handling and OSCORE message processing. Minor code style refinements were made in IP adapter source files. TLS handshake retry logic and certificate addition were refactored for clarity. Dockerfiles were reformatted for readability and package order adjusted. Changes
Sequence Diagram(s)sequenceDiagram
participant CloudDeregister
participant CloudContext
participant ApiParam
CloudDeregister->>CloudContext: clear (on error)
CloudDeregister->>ApiParam: free (after context cleared)
sequenceDiagram
participant EventCallbackPoll
participant EventCallback
participant GlobalPointer
loop For each event callback
EventCallbackPoll->>GlobalPointer: reset to NULL
alt Timer expired
EventCallbackPoll->>EventCallback: invoke callback
EventCallbackPoll->>EventCallback: remove and free if needed
else Timer not expired
EventCallbackPoll->>EventCallback: continue to next
end
end
sequenceDiagram
participant CoapEngine
participant Message
CoapEngine->>Message: oc_message_refcount()
alt refcount == 0
CoapEngine->>Message: oc_message_deallocate()
else
CoapEngine->>Message: retain message
end
sequenceDiagram
participant OSCOREEngine
participant OSCOREContext
participant Message
participant CoapPacket
OSCOREEngine->>OSCOREContext: find context for peer UUID
alt no context
OSCOREEngine->>OSCOREEngine: early exit to dispatch
else
OSCOREEngine->>Message: oc_message_unref2()
alt message not deallocated
OSCOREEngine->>CoapPacket: parse message (stack struct)
OSCOREEngine->>OSCOREEngine: process request or response with partial IV handling
OSCOREEngine->>Message: copy partial IV if needed
OSCOREEngine->>OSCOREEngine: serialize and encrypt OSCORE message
end
end
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (13)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (12)
⏰ Context from checks skipped due to timeout of 90000ms (50)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
🎉 Thank you for your code contribution! To guarantee the change/addition is conformant to the OCF Specification, we would like to ask you to execute OCF Conformance Testing of your change ☝️ when your work is ready to be reviewed. ℹ️ To verify your latest change (b893536), label this PR with |
Fix issue 525174: Read from pointer after free in oc_cloud_deregister.c Fix issue 525173: Read from pointer after free in oc_event_callback.c Fix issue 525172: Read from pointer after free in oc_oscore_engine.c
c69a248 to
5c08316
Compare
|


Fixes #654