Or -as it was suggested by Dimitrios Apostolou- just use strcmp without any
size. And this case it does not matter if it's  char* or char[].



2013/11/25 Edward Welbourne <notifications@github.com>

> In libpromises/locks.c:
>
> > @@ -537,7 +537,7 @@ static void PromiseRuntimeHash(const Promise *pp, const char *salt, unsigned cha
> >      EVP_DigestInit(&context, md);
> >
> >  // multiple packages (promisers) may share same package_list_update_ifelapsed lock
> > -    if (!(salt && (strncmp(salt, PACK_UPIFELAPSED_SALT, sizeof(PACK_UPIFELAPSED_SALT) - 1) == 0)))
>
> It would be better to change the declaration of PACK_UPIFELAPSED_SALT so
> that it's a char [] instead of a char*, making the sizeof code correct.
> (That way, the buffer size is determined at compile-time, rather than by
> strlen at run-time.)
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/cfengine/core/pull/1112/files#r7895036>
> .
>