apps/smtp: Avoid NULL pointer dereference in smtp_send_body_data_handler

Move the code to have NULL test before dereference.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
Axel Lin 2017-12-05 21:51:13 +08:00 committed by goldsimon
parent df563e74f9
commit 0527c1bdf5

View File

@ -1496,9 +1496,10 @@ smtp_send_mail_bodycback(const char *from, const char* to, const char* subject,
static void
smtp_send_body_data_handler(struct smtp_session *s, struct altcp_pcb *pcb)
{
struct smtp_bodydh_state *bdh = s->bodydh;
struct smtp_bodydh_state *bdh;
int res = 0, ret;
LWIP_ASSERT("s != NULL", s != NULL);
bdh = s->bodydh;
LWIP_ASSERT("bodydh != NULL", bdh != NULL);
/* resume any leftovers from prior memory constraints */