[pulseaudio-discuss] [PATCH 5/6] sink-input: Avoid potential NULL dereference
Peter Meerwald-Stadler
pmeerw at pmeerw.net
Thu Aug 18 16:17:10 UTC 2016
if data->sink is NULL, pa_sink_input_new_data_set_sink() may fail to set data->sink;
the false retval is ignored, leading to a NULL dereference in pa_sink_get_state(data->sink) below
CID 1323591
---
src/pulsecore/sink-input.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 435e63e..36f4aa8 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -329,7 +329,8 @@ int pa_sink_input_new(
if (!data->sink) {
pa_sink *sink = pa_namereg_get(core, NULL, PA_NAMEREG_SINK);
pa_return_val_if_fail(sink, -PA_ERR_NOENTITY);
- pa_sink_input_new_data_set_sink(data, sink, false);
+ if (!pa_sink_input_new_data_set_sink(data, sink, false))
+ return -PA_ERR_NOTSUPPORTED;
}
/* If something didn't pick a format for us, pick the top-most format since
--
2.7.4
More information about the pulseaudio-discuss
mailing list