Fix SVACE issue 05/128305/4 accepted/tizen/unified/20170510.013134 submit/tizen/20170508.135258
authorsooyeon.kim <sooyeon.kim@samsung.com>
Mon, 8 May 2017 12:35:12 +0000 (21:35 +0900)
committersooyeon.kim <sooyeon.kim@samsung.com>
Mon, 8 May 2017 13:43:50 +0000 (22:43 +0900)
Change-Id: If09fea361dbe20aab9bcbaa242b8daa59af1eb8e
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
src/voice_control_webview.cpp

index 8ca572c91b2294b18dae476901624af7f3edecfe..c09a209611c9012254de2d70089f5b80feaf4334 100755 (executable)
@@ -142,15 +142,15 @@ char* VCWebView::vc_webview_load_script(const char* filename)
                return NULL;
        }
        fseek(f, 0, SEEK_END);
-       unsigned int fsize = (unsigned int)ftell(f);
-       if (fsize > 4294967295) {
+       long int fsize = ftell(f);
+       if (fsize < 0) {
                LOGE("Wrong file size");
                fclose(f);
                return NULL;
        }
        fseek(f, 0, SEEK_SET);
 
-       char *script = new char [fsize + 2147483648 + 1];
+       char *script = new char [fsize + 1];
        long int ret = fread(script, 1, fsize, f);
        if (ret != fsize) {
                LOGE("Couldn't read vc-webview.js file %d, %d", fsize, ret);
@@ -662,9 +662,14 @@ static void __js_script_loading_custom_cb(Evas_Object *obj, const char *javascri
        if (m_custom_name.compare(file_name) != 0) {
                fseek(f, 0, SEEK_END);
                long int fsize = ftell(f);
+               if (fsize < 0) {
+                       LOGE("Wrong file size");
+                       fclose(f);
+                       return;
+               }
                fseek(f, 0, SEEK_SET);
 
-               char *script = new char [fsize + 2147483648 + 1];
+               char *script = new char [fsize + 1];
                long int ret = fread(script, 1, fsize, f);
                if (ret != fsize) {
                        LOGE("Couldn't read vc-webview.js file %d, %d", fsize, ret);