summaryrefslogtreecommitdiffstats
path: root/crypto/bio
diff options
context:
space:
mode:
authorJan Hykel <jan.hykel@acision.com>2014-11-16 16:51:17 +0000
committerDr. Stephen Henson <steve@openssl.org>2014-11-17 12:42:15 +0000
commite5cf62b04d39042d7d2b1464a4c62736ec3f2ce7 (patch)
tree9e3a3c1db06272b08bd81d9abd2ce20682ec1df1 /crypto/bio
parentb1edca2a4c11da51de0840233fa16a420177e4fc (diff)
Don't use msg on error.
Don't attempt to access msg structure if recvmsg returns an error. PR#3483 Reviewed-by: Stephen Henson <steve@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 012aa9ec76b158179b4de44bb5de8b8472045eac)
Diffstat (limited to 'crypto/bio')
-rw-r--r--crypto/bio/bss_dgram.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c
index d9967e7272..8cad5b41db 100644
--- a/crypto/bio/bss_dgram.c
+++ b/crypto/bio/bss_dgram.c
@@ -1034,6 +1034,13 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
msg.msg_flags = 0;
n = recvmsg(b->num, &msg, 0);
+ if (n <= 0)
+ {
+ if (n < 0)
+ ret = n;
+ break;
+ }
+
if (msg.msg_controllen > 0)
{
for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg))
@@ -1073,13 +1080,6 @@ static int dgram_sctp_read(BIO *b, char *out, int outl)
}
}
- if (n <= 0)
- {
- if (n < 0)
- ret = n;
- break;
- }
-
if (msg.msg_flags & MSG_NOTIFICATION)
{
snp = (union sctp_notification*) out;