MQTT packet_length_encode function accepts NULL buf argument, therefore it cannot be dereferenced without a check. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>