History

TimeSeriesPlatformLibrary: Fixed strcpy_s length parameters and expression tree shared measurement pointer reference.

J. Ritchie Carroll committed 7 years ago

Commit fd2a2941 parent a3106f96 files · +20 −14Browse files

Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Data/DataRow.cpp (1 of 6 files). Show all

Unified · Split

Source/Libraries/TimeSeriesPlatformLibrary/Data/DataRow.cpp+4−4
@@ -123,8 +123,8 @@ void DataRow::SetStringValue(int32_t index, const Nullable<string>& value) · 122 unmodified lines
123123 if (value.HasValue())
124124 {
125125 const string& strval = value.GetValueOrDefault();
126− const int32_t length = strval.size();
127− char* copy = static_cast<char*>(malloc(length + 1));
126+ const int32_t length = strval.size() + 1;
127+ char* copy = static_cast<char*>(malloc(length * sizeof(char)));
128128 strcpy_s(copy, length, strval.c_str());
129129 m_values[index] = copy;
130130 }
@@ -213,8 +213,8 @@ void DataRow::SetDecimalValue(int32_t index, const Nullable<decimal_t>& value) · 82 unmodified lines
213213 // The boost decimal type has a very complex internal representation,
214214 // although slower, it's safer just to store this as a string for now
215215 const string& strval = value.GetValueOrDefault().str();
216− const int32_t length = strval.size();
217− char* copy = static_cast<char*>(malloc(length + 1));
216+ const int32_t length = strval.size() + 1;
217+ char* copy = static_cast<char*>(malloc(length * sizeof(char)));
218218 strcpy_s(copy, length, strval.c_str());
219219 m_values[index] = copy;
220220 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t