Ensure that the struct msghdr is properly zeroed.
authorPauli <paul.dale@oracle.com>
Fri, 29 Mar 2019 08:17:38 +0000 (18:17 +1000)
committerPauli <paul.dale@oracle.com>
Fri, 29 Mar 2019 10:52:00 +0000 (20:52 +1000)
This is probably harmless but best to properly initialise things.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8611)

engines/e_afalg.c
include/internal/ktls.h

index 19d98d897b0bdc74c45b36f73aedec3a8da47e54..c3f622e7521c71fa92da793a096bfd9273692403 100644 (file)
@@ -412,7 +412,7 @@ static int afalg_start_cipher_sk(afalg_ctx *actx, const unsigned char *in,
                                  size_t inl, const unsigned char *iv,
                                  unsigned int enc)
 {
-    struct msghdr msg = { 0 };
+    struct msghdr msg;
     struct cmsghdr *cmsg;
     struct iovec iov;
     ssize_t sbytes;
@@ -421,6 +421,7 @@ static int afalg_start_cipher_sk(afalg_ctx *actx, const unsigned char *in,
 # endif
     char cbuf[CMSG_SPACE(ALG_IV_LEN(ALG_AES_IV_LEN)) + CMSG_SPACE(ALG_OP_LEN)];
 
+    memset(&msg, 0, sizeof(msg));
     memset(cbuf, 0, sizeof(cbuf));
     msg.msg_control = cbuf;
     msg.msg_controllen = sizeof(cbuf);
index 542acf3785df714d6a2c155cb01ad4b2a34de276..23a0397a0a6c88bab4faab2b2d5f832daf5bf0c0 100644 (file)
@@ -118,12 +118,13 @@ static ossl_inline int ktls_start(int fd,
 static ossl_inline int ktls_send_ctrl_message(int fd, unsigned char record_type,
                                               const void *data, size_t length)
 {
-    struct msghdr msg = { 0 };
+    struct msghdr msg;
     int cmsg_len = sizeof(record_type);
     struct cmsghdr *cmsg;
     char buf[CMSG_SPACE(cmsg_len)];
     struct iovec msg_iov;       /* Vector of data to send/receive into */
 
+    memset(&msg, 0, sizeof(msg));
     msg.msg_control = buf;
     msg.msg_controllen = sizeof(buf);
     cmsg = CMSG_FIRSTHDR(&msg);