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
123 if (value.HasValue())123 if (value.HasValue())
124 {124 {
125 const string& strval = value.GetValueOrDefault();125 const string& strval = value.GetValueOrDefault();
126 const int32_t length = strval.size();126 const int32_t length = strval.size() + 1;
127 char* copy = static_cast<char*>(malloc(length + 1));127 char* copy = static_cast<char*>(malloc(length * sizeof(char)));
128 strcpy_s(copy, length, strval.c_str());128 strcpy_s(copy, length, strval.c_str());
129 m_values[index] = copy;129 m_values[index] = copy;
130 }130 }
@@ -213,8 +213,8 @@ void DataRow::SetDecimalValue(int32_t index, const Nullable<decimal_t>& value) · 82 unmodified lines
213 // The boost decimal type has a very complex internal representation,213 // The boost decimal type has a very complex internal representation,
214 // although slower, it's safer just to store this as a string for now214 // although slower, it's safer just to store this as a string for now
215 const string& strval = value.GetValueOrDefault().str();215 const string& strval = value.GetValueOrDefault().str();
216 const int32_t length = strval.size();216 const int32_t length = strval.size() + 1;
217 char* copy = static_cast<char*>(malloc(length + 1));217 char* copy = static_cast<char*>(malloc(length * sizeof(char)));
218 strcpy_s(copy, length, strval.c_str());218 strcpy_s(copy, length, strval.c_str());
219 m_values[index] = copy;219 m_values[index] = copy;
220 }220 }

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