Fix crash by misusing strtok_r 42/54842/1 accepted/tizen/mobile/20151222.024654 accepted/tizen/tv/20151222.024710 accepted/tizen/wearable/20151222.024735 submit/tizen/20151222.022334 submit/tizen_common/20151229.142028 submit/tizen_common/20151229.144031 submit/tizen_common/20151229.154718
authorHyunjun Ko <zzoon.ko@samsung.com>
Fri, 18 Dec 2015 06:56:02 +0000 (15:56 +0900)
committerHyunjun Ko <zzoon.ko@samsung.com>
Fri, 18 Dec 2015 06:56:02 +0000 (15:56 +0900)
Change-Id: I7f4a4e6728efb4651abe076621d139329b4bbb8d

gst/rtsp-server/gstwfdmessage.c

index 3dbd6db..9aa873e 100755 (executable)
@@ -1808,7 +1808,7 @@ gst_wfd_message_get_contentprotection_type (GstWFDMessage * msg,
   g_return_val_if_fail (msg != NULL, GST_WFD_EINVAL);
   if (msg->content_protection && msg->content_protection->hdcp2_spec) {
     char *result = NULL;
-    char *ptr[2] = {0, };
+    char *ptr = NULL;
     if (!g_strcmp0 (msg->content_protection->hdcp2_spec->hdcpversion, "none")) {
       *hdcpversion = GST_WFD_HDCP_NONE;
       *TCPPort = 0;
@@ -1827,9 +1827,9 @@ gst_wfd_message_get_contentprotection_type (GstWFDMessage * msg,
     }
 
     if (msg->content_protection->hdcp2_spec->TCPPort) {
-      result = strtok_r (msg->content_protection->hdcp2_spec->TCPPort, "=", &ptr[0]);
-      while (result != NULL) {
-        result = strtok_r (NULL, "=", &ptr[1]);
+      result = strtok_r (msg->content_protection->hdcp2_spec->TCPPort, "=", &ptr);
+      while (result != NULL && ptr != NULL) {
+        result = strtok_r (NULL, "=", &ptr);
         *TCPPort = atoi (result);
         break;
       }