[openssl-dev] [openssl.org #4035] bug and fix - warning about uninitialized variables in ssl_asn1.c, function i2d_SSL_SESSION()

Ivo Raisr via RT rt at openssl.org
Thu Sep 10 21:08:45 UTC 2015


When OpenSSL 1.0.2 is built on Linux with "no-psk" config option, the 
following warnings are emitted by the compiler:

ssl_asn1.c: In function ‘i2d_SSL_SESSION’:
ssl_asn1.c:124:57: warning: unused variable ‘v8’ [-Wunused-variable]
      int v1 = 0, v2 = 0, v3 = 0, v4 = 0, v5 = 0, v7 = 0, v8 = 0;
                                                          ^
ssl_asn1.c:124:49: warning: unused variable ‘v7’ [-Wunused-variable]
      int v1 = 0, v2 = 0, v3 = 0, v4 = 0, v5 = 0, v7 = 0, v8 = 0;
                                                  ^
This is because variables v7 and v8 are defined unconditionally, 
regardless whether OPENSSL_NO_PSK is defined or not.
Similar to existing constructs with OPENSSL_NO_TLSEXT, OPENSSL_NO_COMP
and OPENSSL_NO_SRP, also OPENSSL_NO_PSK needs the following:

+#ifndef OPENSSL_NO_PSK
+    int v7 = 0, v8 = 0;
+#endif

See the attached patch.

Tested by building with and without "no-psk". Builds are clean
and successful.

Kind regards,
Ivo Raisr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ssl_asn1_no-psk.patch
Type: text/x-patch
Size: 694 bytes
Desc: not available
URL: <http://mta.openssl.org/pipermail/openssl-dev/attachments/20150910/6fb6c438/attachment-0001.bin>
-------------- next part --------------
_______________________________________________
openssl-bugs-mod mailing list
openssl-bugs-mod at openssl.org
https://mta.openssl.org/mailman/listinfo/openssl-bugs-mod


More information about the openssl-dev mailing list