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.12.0-rc1~34 X-Git-Url: http://git.liburcu.org/?p=lttng-ust.git;a=commitdiff_plain;h=3e1db88df7cc11a1340fc2ce3ef8a1124fd350a3 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 ab472352..7078938d 100644 --- a/liblttng-ust/lttng-ring-buffer-client.h +++ b/liblttng-ust/lttng-ring-buffer-client.h @@ -607,6 +607,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; }