[UTC][webkit2][NonACR][Replace strcmp with strncmp] 87/247687/1
authoryh106.jung <yh106.jung@samsung.com>
Fri, 13 Nov 2020 09:22:41 +0000 (18:22 +0900)
committeryh106.jung <yh106.jung@samsung.com>
Fri, 13 Nov 2020 10:07:14 +0000 (19:07 +0900)
This patch replaces strcmp with strncmp, and adds checking the
length of target value and expected value.

Change-Id: I0d64978ebc945263670d42dec824a03af886c562
Signed-off-by: yh106.jung <yh106.jung@samsung.com>
src/utc/webkit2/utc_webkit2_ewk_manifest_start_url_get_func.c

index 9fbc8c4d95cd0f23fc54572bb3ceb266a2ec3161..10e72e3fe7350591dd09454252d1b99daec1d7e2 100755 (executable)
@@ -4,6 +4,8 @@
 static Eina_Bool isLoadSucceed = EINA_TRUE;
 static Eina_Bool isSucceed = EINA_FALSE;
 
+static const char manifest_url[] = "https://googlechrome.github.io/samples/web-application-manifest/index.html";
+
 static Eina_Bool loadURL(const char* url)
 {
   return ewk_view_url_set(test_view.webview, url);
@@ -50,10 +52,13 @@ void utc_webkit2_ewk_manifest_start_url_get_func_cleanup(void)
  * @description Callback function for receiving the manifest.
  */
 static void DidReceiveRequestManifest(Evas_Object* view, Ewk_View_Request_Manifest* manifest, void* user_data) {
-  if (manifest != NULL && !strcmp(ewk_manifest_start_url_get(manifest), "https://googlechrome.github.io/samples/web-application-manifest/index.html"))
-    isSucceed = EINA_TRUE;
-  else
-    isSucceed = EINA_FALSE;
+  isSucceed = EINA_FALSE;
+
+  if (manifest) {
+    const char* url = ewk_manifest_start_url_get(manifest);
+    if (url && strlen(url) == strlen(manifest_url) && !strncmp(url, manifest_url, strlen(url)))
+      isSucceed = EINA_TRUE;
+  }
 
   utc_webkit2_main_loop_quit();
 }