From: Mathieu Desnoyers Date: Tue, 4 Jun 2019 18:36:44 +0000 (-0400) Subject: Fix: client_sequence_number may dereference NULL pointer X-Git-Tag: v2.9.6~7 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=be310750c31f2ffbb9ce9c8f4eeb0fc33ed094ae;p=lttng-ust.git Fix: client_sequence_number may dereference NULL pointer Found by Coverity: CID 1400710 (#1 of 1): Dereference null return value (NULL_RETURNS) 3. dereference: Dereferencing a null pointer header. Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/lttng-ring-buffer-client.h b/liblttng-ust/lttng-ring-buffer-client.h index a261dcfe..f02d2808 100644 --- a/liblttng-ust/lttng-ring-buffer-client.h +++ b/liblttng-ust/lttng-ring-buffer-client.h @@ -583,6 +583,8 @@ static int client_sequence_number(struct lttng_ust_lib_ring_buffer *buf, struct packet_header *header; header = client_packet_header(buf, handle); + if (!header) + return -1; *seq = header->ctx.packet_seq_num; return 0; }