Check dgram_sctp_write() return value.
authorKurt Roeckx <kurt@roeckx.be>
Sat, 20 Jun 2015 14:46:33 +0000 (16:46 +0200)
committerKurt Roeckx <kurt@roeckx.be>
Sun, 28 Jun 2015 16:21:06 +0000 (18:21 +0200)
Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/bio/bss_dgram.c

index 089a95209646e4b5b368a64b17b493841847e5de..dabfea35c040b1bf1b72e0ed65d1a527c805e1ff 100644 (file)
@@ -1219,9 +1219,13 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
                      * it can be sent now.
                      */
                     if (data->saved_message.length > 0) {
                      * it can be sent now.
                      */
                     if (data->saved_message.length > 0) {
-                        dgram_sctp_write(data->saved_message.bio,
+                        i = dgram_sctp_write(data->saved_message.bio,
                                          data->saved_message.data,
                                          data->saved_message.length);
                                          data->saved_message.data,
                                          data->saved_message.length);
+                        if (i < 0) {
+                            ret = i;
+                            break;
+                        }
                         OPENSSL_free(data->saved_message.data);
                         data->saved_message.data = NULL;
                         data->saved_message.length = 0;
                         OPENSSL_free(data->saved_message.data);
                         data->saved_message.data = NULL;
                         data->saved_message.length = 0;
@@ -1366,6 +1370,14 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
     return (ret);
 }
 
     return (ret);
 }
 
+/*
+ * dgram_sctp_write - send message on SCTP socket
+ * @b: BIO to write to
+ * @in: data to send
+ * @inl: amount of bytes in @in to send
+ *
+ * Returns -1 on error or the sent amount of bytes on success
+ */
 static int dgram_sctp_write(BIO *b, const char *in, int inl)
 {
     int ret;
 static int dgram_sctp_write(BIO *b, const char *in, int inl)
 {
     int ret;