summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bio/bss_dgram.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bio/bss_dgram.c')
-rw-r--r--src/lib/libcrypto/bio/bss_dgram.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/lib/libcrypto/bio/bss_dgram.c b/src/lib/libcrypto/bio/bss_dgram.c
index 79a6c2aa67..72cb19d135 100644
--- a/src/lib/libcrypto/bio/bss_dgram.c
+++ b/src/lib/libcrypto/bio/bss_dgram.c
@@ -211,10 +211,9 @@ dgram_new(BIO *bi)
211 211
212 bi->init = 0; 212 bi->init = 0;
213 bi->num = 0; 213 bi->num = 0;
214 data = malloc(sizeof(bio_dgram_data)); 214 data = calloc(1, sizeof(bio_dgram_data));
215 if (data == NULL) 215 if (data == NULL)
216 return 0; 216 return 0;
217 memset(data, 0x00, sizeof(bio_dgram_data));
218 bi->ptr = data; 217 bi->ptr = data;
219 218
220 bi->flags = 0; 219 bi->flags = 0;
@@ -773,8 +772,7 @@ BIO_new_dgram_sctp(int fd, int close_flag)
773 * SCTP-AUTH has to be activated for the listening socket 772 * SCTP-AUTH has to be activated for the listening socket
774 * already, otherwise the connected socket won't use it. */ 773 * already, otherwise the connected socket won't use it. */
775 sockopt_len = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t)); 774 sockopt_len = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t));
776 authchunks = malloc(sockopt_len); 775 authchunks = calloc(1, sockopt_len);
777 memset(authchunks, 0, sizeof(sockopt_len));
778 ret = getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks, &sockopt_len); 776 ret = getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks, &sockopt_len);
779 OPENSSL_assert(ret >= 0); 777 OPENSSL_assert(ret >= 0);
780 778
@@ -834,10 +832,9 @@ dgram_sctp_new(BIO *bi)
834 832
835 bi->init = 0; 833 bi->init = 0;
836 bi->num = 0; 834 bi->num = 0;
837 data = malloc(sizeof(bio_dgram_sctp_data)); 835 data = calloc(1, sizeof(bio_dgram_sctp_data));
838 if (data == NULL) 836 if (data == NULL)
839 return 0; 837 return 0;
840 memset(data, 0x00, sizeof(bio_dgram_sctp_data));
841#ifdef SCTP_PR_SCTP_NONE 838#ifdef SCTP_PR_SCTP_NONE
842 data->prinfo.pr_policy = SCTP_PR_SCTP_NONE; 839 data->prinfo.pr_policy = SCTP_PR_SCTP_NONE;
843#endif 840#endif
@@ -1055,8 +1052,7 @@ dgram_sctp_read(BIO *b, char *out, int outl)
1055 struct sctp_authchunks *authchunks; 1052 struct sctp_authchunks *authchunks;
1056 1053
1057 optlen = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t)); 1054 optlen = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t));
1058 authchunks = malloc(optlen); 1055 authchunks = calloc(1, optlen);
1059 memset(authchunks, 0, sizeof(optlen));
1060 ii = getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS, authchunks, &optlen); 1056 ii = getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS, authchunks, &optlen);
1061 OPENSSL_assert(ii >= 0); 1057 OPENSSL_assert(ii >= 0);
1062 1058
@@ -1122,8 +1118,7 @@ dgram_sctp_write(BIO *b, const char *in, int inl)
1122 if (data->save_shutdown && !BIO_dgram_sctp_wait_for_dry(b)) { 1118 if (data->save_shutdown && !BIO_dgram_sctp_wait_for_dry(b)) {
1123 data->saved_message.bio = b; 1119 data->saved_message.bio = b;
1124 data->saved_message.length = inl; 1120 data->saved_message.length = inl;
1125 data->saved_message.data = malloc(inl); 1121 data->saved_message.data = calloc(1, inl);
1126 memcpy(data->saved_message.data, in, inl);
1127 return inl; 1122 return inl;
1128 } 1123 }
1129 1124
@@ -1250,8 +1245,7 @@ dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr)
1250 1245
1251 /* Add new key */ 1246 /* Add new key */
1252 sockopt_len = sizeof(struct sctp_authkey) + 64 * sizeof(uint8_t); 1247 sockopt_len = sizeof(struct sctp_authkey) + 64 * sizeof(uint8_t);
1253 authkey = malloc(sockopt_len); 1248 authkey = calloc(1, sockopt_len);
1254 memset(authkey, 0x00, sockopt_len);
1255 authkey->sca_keynumber = authkeyid.scact_keynumber + 1; 1249 authkey->sca_keynumber = authkeyid.scact_keynumber + 1;
1256#ifndef __FreeBSD__ 1250#ifndef __FreeBSD__
1257 /* This field is missing in FreeBSD 8.2 and earlier, 1251 /* This field is missing in FreeBSD 8.2 and earlier,