Fix debug assertion with SSL connections

The code assumed gwbuf_length would accept null buffers.
This commit is contained in:
Markus Mäkelä 2019-05-17 16:12:24 +03:00
parent 1197bd40db
commit c21558315b
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -697,7 +697,7 @@ static int dcb_read_SSL(DCB* dcb, GWBUF** head)
{
GWBUF* buffer;
int nsingleread = 0, nreadtotal = 0;
int start_length = gwbuf_length(*head);
int start_length = *head ? gwbuf_length(*head) : 0;
if (dcb->fd == DCBFD_CLOSED)
{
@ -730,7 +730,7 @@ static int dcb_read_SSL(DCB* dcb, GWBUF** head)
}
}
mxb_assert(gwbuf_length(*head) == (size_t)(start_length + nreadtotal));
mxb_assert((*head ? gwbuf_length(*head) : 0) == (size_t)(start_length + nreadtotal));
return nsingleread < 0 ? nsingleread : nreadtotal;
}