Open mfrey opened 5 years ago
theoretically yes, but once the function ccnl_mkInterest()
returns, the opts
value is never used again. It's only used for marshalling the packet in ccnl_ndntlv_prependInterest
. No references are saved for later use.
theoretically yes, but once the function ccnl_mkInterest() returns, the opts value is never used again. It's only used for marshalling the packet in ccnl_ndntlv_prependInterest. No references are saved for later use.
Thanks for the heads up. Honestly, I don't really like it. I've stumbled a couple times in false positives of the static analyzer where e.g. a parameter was used in a subsequent call, etc.
We probably should check how we can silence these false positives or think about if we should clarify/fix these "issues". We also should probably add a new label which allows for easy filtering of these things (check if an issue identified by the static analyzer has been discussed before).
Any thoughts?
Description
In case a
NULL
pointer is passed for parameteropts
of typeccnl_interest_opts_u
in functionccnl_mkInterest
a default value is assigned. Unfortunately, the default value is local and thus resides on the stack. Hence, the value ofopts
is garbage after exiting the function, i.e.Or am I missing something?