Fix: dereference of NULL pointer in stream_write()
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 11 Sep 2019 00:35:19 +0000 (20:35 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 19 Sep 2019 19:31:48 +0000 (15:31 -0400)
stream_write() can be used with a NULL packet to write padding only to
a stream. In the case of a metadata stream, packet is assumed to
always be non-NULL which may not always be true.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/stream.c

index c02820d314e04526264555bb12584c40aa8606a0..f98b465572ec880d4730224da7766fe4ce7fc040 100644 (file)
@@ -1015,7 +1015,8 @@ int stream_write(struct relay_stream *stream,
        }
 
        if (stream->is_metadata) {
-               stream->metadata_received += packet->size + padding_len;
+               stream->metadata_received += packet ? packet->size : 0;
+               stream->metadata_received += padding_len;
        }
 
        DBG("Wrote to %sstream %" PRIu64 ": data_length = %zu, padding_length = %zu",
This page took 0.026891 seconds and 4 git commands to generate.