From: Todd C. Miller Date: Fri, 12 May 2017 16:02:18 +0000 (-0600) Subject: Avoid a clang analyzer false positive. X-Git-Tag: SUDO_1_8_21^2~79 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7db97c7835086a981c997122998901b4477d53f4;p=sudo Avoid a clang analyzer false positive. --- diff --git a/plugins/sudoers/auth/sudo_auth.c b/plugins/sudoers/auth/sudo_auth.c index 058a12508..4dcb9ef08 100644 --- a/plugins/sudoers/auth/sudo_auth.c +++ b/plugins/sudoers/auth/sudo_auth.c @@ -295,7 +295,7 @@ verify_user(struct passwd *pw, char *prompt, int validated, if (success != AUTH_FAILURE) break; } - if (!standalone) { + if (pass != NULL) { memset_s(pass, SUDO_CONV_REPL_MAX, 0, strlen(pass)); free(pass); } diff --git a/plugins/sudoers/ldap.c b/plugins/sudoers/ldap.c index 9b866ad5e..acd524879 100644 --- a/plugins/sudoers/ldap.c +++ b/plugins/sudoers/ldap.c @@ -1453,6 +1453,11 @@ sudo_netgroup_lookup_nested(LDAP *ld, char *base, struct timeval *timeout, ldap_value_free_len(bv); goto oom; } +#ifdef __clang_analyzer__ + /* clang analyzer false positive */ + if (__builtin_expect(netgroups->stqh_last == NULL, 0)) + __builtin_trap(); +#endif STAILQ_INSERT_TAIL(netgroups, ng, entries); DPRINTF1("Found new netgroup %s for %s", ng->name, base); }