Blame SOURCES/rdpsnd-pulse-Fix-crash-if-device-isn-t-specified.patch

24c59a
From 800c865bd79e3e4437cceb3219246cfad152205b Mon Sep 17 00:00:00 2001
24c59a
From: Ondrej Holy <oholy@redhat.com>
24c59a
Date: Thu, 11 Jun 2015 13:35:21 +0200
24c59a
Subject: [PATCH] rdpsnd/pulse: Fix crash if device isn't specified
24c59a
24c59a
Freerdp crashes if pulseaudio device isn't specified on commandline, i.e.:
24c59a
xfreerdp --plugin rdpsnd --data pulse
24c59a
24c59a
The crash occurs, because data[1] is NULL and it is passed into strlen
24c59a
function. We have to check whether data[1] was set before calling strlen
24c59a
to fix this crash.
24c59a
---
24c59a
 channels/rdpsnd/pulse/rdpsnd_pulse.c | 2 +-
24c59a
 1 file changed, 1 insertion(+), 1 deletion(-)
24c59a
24c59a
diff --git a/channels/rdpsnd/pulse/rdpsnd_pulse.c b/channels/rdpsnd/pulse/rdpsnd_pulse.c
24c59a
index 1a331f0..54892cd 100644
24c59a
--- a/channels/rdpsnd/pulse/rdpsnd_pulse.c
24c59a
+++ b/channels/rdpsnd/pulse/rdpsnd_pulse.c
24c59a
@@ -474,7 +474,7 @@ int FreeRDPRdpsndDeviceEntry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints)
24c59a
 	data = pEntryPoints->plugin_data;
24c59a
 	if (data && strcmp((char*)data->data[0], "pulse") == 0)
24c59a
 	{
24c59a
-		if(strlen((char*)data->data[1]) > 0) 
24c59a
+		if(data->data[1] && strlen((char*)data->data[1]) > 0)
24c59a
 			pulse->device_name = xstrdup((char*)data->data[1]);
24c59a
 		else
24c59a
 			pulse->device_name = NULL;
24c59a
-- 
24c59a
2.5.0
24c59a