From be0b08770e9214592e89589b2dc069426c0d9b91 Mon Sep 17 00:00:00 2001 From: Roman Smirnov Date: Sat, 29 Jun 2024 11:36:18 +0300 Subject: [PATCH] avdtp: add NULL checks to avdtp_has_stream() Make avdtp_has_stream() safe for passing NULL pointers. Found with the SVACE static analysis tool. --- profiles/audio/avdtp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c index 3667e0840..64735c5ee 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -3918,6 +3918,9 @@ struct btd_device *avdtp_get_device(struct avdtp *session) gboolean avdtp_has_stream(struct avdtp *session, struct avdtp_stream *stream) { + if (!session || !stream) + return FALSE; + return g_slist_find(session->streams, stream) ? TRUE : FALSE; } -- 2.47.3