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.10.5~7 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d78ca4883670ce4255ab9f99a735828b0e9e1ed1;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 55209f45..b5eb692f 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; }