Hi,

On 15-03-17 22:00, Gert Doering wrote:
> On Tue, Mar 14, 2017 at 09:26:52AM +1100, Eric Thorpe wrote:
>>   #ifdef HAVE_CONFIG_MSVC_LOCAL_H
>>   #include <config-msvc-local.h>
>> diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c
>> index 5549d70..bed39f3 100644
>> --- a/src/openvpn/crypto_openssl.c
>> +++ b/src/openvpn/crypto_openssl.c
>> @@ -287,7 +287,12 @@ show_available_ciphers()
>>
>>       /* If we ever exceed this, we must be more selective */
>>       const size_t cipher_list_len = 1000;
>> +#ifdef _MSC_VER
>> +    //While GCC will allow you to use a const, MSVC won't (at least 
>> with a simple declaration). Use a compile time constant for now
>> +    const EVP_CIPHER *cipher_list[1000];
>> +#else
>>       const EVP_CIPHER *cipher_list[cipher_list_len];
>> +#endif
>>       size_t num_ciphers = 0;
> 
> I don't think we should do this.  If we have a length, use it.  If
> the compiler is too daft to understand consts, maybe we should go
> for "#define CIPHER_LIST_LEN 1000" instead - indeed, more changes,
> but no magic numbers.  Or abandon the definition, use [1000], and
> sizeof() in the out of bounds check below.
> 
> Steffan, your code, what would you say?

Hm, this is somewhat chewing on our decision that 'we now only support
compilers that do C99', but I can see that this is easily fixed so I can
live with just begin pragmatic.  In that case, let's go for the
sizeof().  Adding a define of course works, but I find it somewhat clunky.

-Steffan

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to