From e1d5058489f1a649b3266da5a61eed99c44b7ee5 Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Thu, 11 Jun 2015 09:41:13 +0200 Subject: [PATCH] [Calendar] Fix for prevent issue [Feature] Prevent CID: 447388 Changed strcpy replaced with strncpy. [Verification] TCT 100% passrate. Change-Id: I9ee229f970f4466df02cfd4d592c16b393099397 Signed-off-by: Piotr Kosko --- src/calendar/calendar_item.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calendar/calendar_item.cc b/src/calendar/calendar_item.cc index 4b903d0..ca811b0 100755 --- a/src/calendar/calendar_item.cc +++ b/src/calendar/calendar_item.cc @@ -1886,8 +1886,9 @@ picojson::array CalendarItem::StringToArray(const std::string& string) { LoggerD("Enter"); picojson::array out = picojson::array(); - char* cstr = new char[string.length() + 1]; - strcpy(cstr, string.c_str()); + size_t cstr_length = string.length() + 1; + char* cstr = new char[cstr_length]; + strncpy(cstr, string.c_str(), cstr_length); char* saveptr = NULL; char* pch = strtok_r(cstr, ",", &saveptr); -- 2.7.4