[Tizen] Fix SVACE issue - change sscanf(%d) to strtol 59/132659/1
authorminho.sun <minho.sun@samsung.com>
Wed, 7 Jun 2017 05:56:39 +0000 (14:56 +0900)
committerminho.sun <minho.sun@samsung.com>
Wed, 7 Jun 2017 05:56:41 +0000 (14:56 +0900)
This reverts commit 22b429f142e1130bc3db8e5b730ae559ba5635fb.

Change-Id: I93e194ace1b6177a8082fce5b80b16e5d26c9f9f

dali-toolkit/devel-api/controls/control-devel.h [changed mode: 0644->0755]
dali-toolkit/third-party/nanosvg/nanosvg.cc

old mode 100644 (file)
new mode 100755 (executable)
index d3ffc40..601413c 100644 (file)
@@ -1038,9 +1038,15 @@ static unsigned int nsvg__parseColorRGB(const char* str)
 
     /**
      * In the original file, the formatted data reading did not specify the string with width limitation.
-     * To prevent the possible overflow, we replace '%s' with '%32s' here.
+     * To prevent the possible overflow, we replace '%s' with '%31s' and use strtol here
      */
-    sscanf(str + 4, "%d%32[%%, \t]%d%32[%%, \t]%d", &r, s1, &g, s2, &b);
+    char* end;
+    r = strtol(str + 4, &end, 10);
+    sscanf(end, "%31[%%, \t]", s1);
+    g = strtol(end + strlen(s1), &end, 10);
+    sscanf(end, "%31[%%, \t]", s2);
+    b = strtol(end + strlen(s2), &end, 10);
+
     if (strchr(s1, '%')) {
         return NSVG_RGB((r*255)/100,(g*255)/100,(b*255)/100);
     } else {
@@ -1269,9 +1275,9 @@ static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str)
 
     /**
      * In the original file, the formatted data reading did not specify the string with width limitation.
-     * To prevent the possible overflow, we replace '%s' with '%32s' here.
+     * To prevent the possible overflow, we replace '%s' with '%31s' here.
      */
-    sscanf(str, "%f%32s", &coord.value, units);
+    sscanf(str, "%f%31s", &coord.value, units);
     coord.units = nsvg__parseUnits(units);
     return coord;
 }