rtspclientsink: Check return value of sscanf
authorEdward Hervey <bilboed@bilboed.com>
Mon, 7 Mar 2016 13:48:38 +0000 (14:48 +0100)
committerEdward Hervey <bilboed@bilboed.com>
Fri, 29 Apr 2016 09:45:19 +0000 (11:45 +0200)
And just make sure we always have 0/0 if we have an error

CID #1352031

gst/rtsp-sink/gstrtspclientsink.c

index 63cdbc3..cc3aa96 100644 (file)
@@ -1345,11 +1345,9 @@ gst_rtsp_client_sink_set_property (GObject * object, guint prop_id,
       const gchar *str;
 
       str = g_value_get_string (value);
-      if (str) {
-        sscanf (str, "%u-%u",
-            &rtsp_client_sink->client_port_range.min,
-            &rtsp_client_sink->client_port_range.max);
-      } else {
+      if (!str || !sscanf (str, "%u-%u",
+              &rtsp_client_sink->client_port_range.min,
+              &rtsp_client_sink->client_port_range.max)) {
         rtsp_client_sink->client_port_range.min = 0;
         rtsp_client_sink->client_port_range.max = 0;
       }