Commit 76098ee1 authored by Lorenz Meier's avatar Lorenz Meier
Browse files

Fixed incorrect parameter key/name length termination, was one char too early

parent 0f136442
...@@ -2263,18 +2263,13 @@ void UAS::setParameter(const int component, const QString& id, const QVariant& v ...@@ -2263,18 +2263,13 @@ void UAS::setParameter(const int component, const QString& id, const QVariant& v
for (unsigned int i = 0; i < sizeof(p.param_id); i++) for (unsigned int i = 0; i < sizeof(p.param_id); i++)
{ {
// String characters // String characters
if ((int)i < id.length() && i < (sizeof(p.param_id) - 1)) if ((int)i < id.length())
{ {
p.param_id[i] = id.toAscii()[i]; p.param_id[i] = id.toAscii()[i];
} }
// // Null termination at end of string or end of buffer
// else if ((int)i == id.length() || i == (sizeof(p.param_id) - 1))
// {
// p.param_id[i] = '\0';
// }
// Zero fill
else else
{ {
// Fill rest with zeros
p.param_id[i] = 0; p.param_id[i] = 0;
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment