[Openswan dev] Re: PATCH: X.509 Off by one bug in crl processing (aka crl.pem crash bug)

Henrik Nordstrom hno at marasystems.com
Thu Apr 22 01:57:40 CEST 2004


On Tue, 20 Apr 2004, Andreas Steffen wrote:

> I don't know if sizeof(CRL_PATH) will still give the correct result
> because the content of plutopaths.crls.path is assigned dynamically in log.c
> during runtime. Probably a safer approach would be
> 
> -		    crl_uri.len = 7 + sizeof(CRL_PATH) + strlen(filename);
> +		    crl_uri.len = 8 + strlen(CRL_PATH) + strlen(filename);

For us other numb people who can not sum or count letters better make that

		    crl_uri.len = 7 + strlen(CRL_PATH) + 1 + strlen(filename);

so it more closely represents the actual sequence of things. And for
readability I would recommend doing so in both trees even if CRL_PATH is a
constant in OpenSWAN 1. The compiler will automatically detect the
constant string length making sizeof and strlen + 1 the same code, at
least if -O is used.

Regards
Henrik



More information about the Dev mailing list