[SSSD] [PATCH] Variable in sdap_sudo_rules_refresh_send could be used, uninitialised.

Stephen Gallagher sgallagh at redhat.com
Wed Sep 26 17:30:08 UTC 2012


On Wed 26 Sep 2012 01:20:25 PM EDT, Michal Židek wrote:
> Another one liner. If no rules were passed to
> sdap_sudo_rules_refresh_send (if rules[0] was NULL) and no error
> occurred, then variable ret was used uninitialized. This is not very
> likely to happen, but it is safer to have it initialized.
>
> Maybe we should consider adding initialization of all "ret" variables
> to our coding guidelines to avoid these "unlikely but possible" errors
> in new code.
>

Nack. We usually leave ret intentionally uninitialized because we 
always want to set it explicitly under normal operation. This is 
because an uninitialized use is detectable by the compiler or static 
analysis tools. If we pre-initialized it, we could just end up with 
unexpected behavior (falling into the default case).

Please make all assignments to 'ret' be intentional rather than default.



More information about the sssd-devel mailing list