[3.0] Fix the buffer overflow issue in nanosvg 54/67654/1 accepted/tizen/common/20160428.144545 accepted/tizen/ivi/20160428.081545 accepted/tizen/mobile/20160428.081611 accepted/tizen/tv/20160428.081527 accepted/tizen/wearable/20160428.081509 submit/tizen/20160428.014312
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Thu, 28 Apr 2016 01:34:27 +0000 (10:34 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Thu, 28 Apr 2016 01:35:41 +0000 (10:35 +0900)
Change-Id: I89d0e386dd3caec1ded02325a3886cbec48c2a7b
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
dali-toolkit/internal/controls/renderers/svg/nanosvg/nanosvg.cc

index 820e619..e52cb15 100644 (file)
@@ -1244,7 +1244,12 @@ static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str)
 {
     NSVGcoordinate coord = {0, NSVG_UNITS_USER};
     char units[32]="";
-    sscanf(str, "%f%s", &coord.value, units);
+
+    /**
+     * 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.
+     */
+    sscanf(str, "%f%32s", &coord.value, units);
     coord.units = nsvg__parseUnits(units);
     return coord;
 }