Possible null-pointer dereference

The value should be dereferenced after
assertion is performed. This can lead
to crash
This commit is contained in:
Mikhail Lappo 2017-03-22 22:06:21 +01:00 committed by goldsimon
parent 08cb949aea
commit 7eba14cb76

View File

@ -360,8 +360,9 @@ mqtt_take_request(struct mqtt_request_t **tail, u16_t pkt_id)
static void
mqtt_request_time_elapsed(struct mqtt_request_t **tail, u8_t t)
{
struct mqtt_request_t *r = *tail;
struct mqtt_request_t *r;
LWIP_ASSERT("mqtt_request_time_elapsed: tail != NULL", tail != NULL);
r = *tail;
while (t > 0 && r != NULL) {
if (t >= r->timeout_diff) {
t -= (u8_t)r->timeout_diff;