net/mqtt: Validate null or app level zero-length rx buffers

Don't try to process null or zero-length buffers generated by
the IP stack. Zero-length buffers are valid at the TCP layer but
contain no information for applications.

Change-Id: If66d301527f56ca8e8761789b7fd6931fc37b8e0
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
diff --git a/subsys/net/lib/mqtt/mqtt.c b/subsys/net/lib/mqtt/mqtt.c
index d3c5863..679629b 100644
--- a/subsys/net/lib/mqtt/mqtt.c
+++ b/subsys/net/lib/mqtt/mqtt.c
@@ -812,11 +812,17 @@
 	/* net_ctx is already referenced to by the mqtt_ctx struct */
 	ARG_UNUSED(net_ctx);
 
-	if (status != 0) {
+	if (status || !buf) {
 		return;
 	}
 
+	if (net_nbuf_appdatalen(buf) == 0) {
+		goto lb_exit;
+	}
+
 	mqtt->rcv(mqtt, buf);
+
+lb_exit:
 	net_nbuf_unref(buf);
 }