[3.0] Fix SVACE issue - change sscanf(%d) to strtol 85/127185/2 accepted/tizen/3.0/common/20170531.142802 accepted/tizen/3.0/ivi/20170530.235739 accepted/tizen/3.0/mobile/20170530.235644 accepted/tizen/3.0/tv/20170530.235703 accepted/tizen/3.0/wearable/20170530.235723 submit/tizen_3.0/20170526.103846
authorHeeyong Song <heeyong.song@samsung.com>
Wed, 26 Apr 2017 10:18:47 +0000 (19:18 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Wed, 26 Apr 2017 10:19:37 +0000 (10:19 +0000)
Change-Id: I3e6f4ba14415471deaf0211562a33348f217fd0c

dali-toolkit/third-party/nanosvg/nanosvg.cc

index 5ddad99..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 '%31s' here.
+     * To prevent the possible overflow, we replace '%s' with '%31s' and use strtol here
      */
-    sscanf(str + 4, "%d%31[%%, \t]%d%31[%%, \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 {