[SSSD] [PATCH] mmap_cache: Check data->name value in client code

Simo Sorce simo at redhat.com
Thu Aug 15 15:31:07 UTC 2013


On Thu, 2013-08-15 at 17:08 +0200, Michal Židek wrote:
> +static size_t sss_mc_get_strs_offset(struct sss_mc_ctx *mcc)
> +{
> +    if (mcc->type == SSS_MC_PASSWD) {
> +        return offsetof(struct sss_mc_pwd_data, strs);
> +    }
> +
> +    return offsetof(struct sss_mc_grp_data, strs);
> +}

Can you use a switch()/case: here?

I know it looks a lot more boilerplate but if we start adding other maps
we'll not risk returning a completely bogus pointer by mistake.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York




More information about the sssd-devel mailing list