From: Hermet Park Date: Mon, 9 Aug 2021 04:20:27 +0000 (+0900) Subject: common initializer: fix out of buffer access by the version info string. X-Git-Tag: accepted/tizen/unified/20210810.135318~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3bb2666c95ad83bdef06d5cbc51882670a88f0e3;p=platform%2Fcore%2Fgraphics%2Ftizenvg.git common initializer: fix out of buffer access by the version info string. String must be finished at termination charactor, previous logic missed that handling, now fixed. @Issue: https://github.com/Samsung/thorvg/issues/690 --- diff --git a/src/lib/tvgInitializer.cpp b/src/lib/tvgInitializer.cpp index 0b63cf3..5dd5800 100644 --- a/src/lib/tvgInitializer.cpp +++ b/src/lib/tvgInitializer.cpp @@ -50,18 +50,21 @@ static bool _buildVersionInfo() x = strchr(p, '.'); if (!x) return false; strncpy(major, p, x - p); + major[x - p] = '\0'; p = x + 1; char minor[3]; x = strchr(p, '.'); if (!x) return false; strncpy(minor, p, x - p); + minor[x - p] = '\0'; p = x + 1; char micro[3]; x = SRC + strlen(THORVG_VERSION_STRING); if (!x) return false; strncpy(micro, p, x - p); + micro[x - p] = '\0'; char sum[7]; snprintf(sum, sizeof(sum), "%s%s%s", major, minor, micro);