Skip to content

Commit

Permalink
Fix FMIParseValues() for String values (#403)
Browse files Browse the repository at this point in the history
fixes #402
  • Loading branch information
t-sommer authored Sep 13, 2023
1 parent 4cf5c36 commit 2c6cd83
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fmusim/FMIUtil.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,11 @@ FMIStatus FMIParseValues(FMIVersion fmiVersion, FMIVariableType type, const char
PARSE_VALUES(fmi3UInt64, strtoull, 10);
break;
case FMIStringType: {
CALL(FMIRealloc(values, sizeof(fmi3String)));
const size_t len = strlen(literal);
CALL(FMIRealloc(values, sizeof(fmi3String*) + len + 1));
fmi3String* v = *values;
v[0] = literal;
v[0] = &v[1];
strncpy(&v[1], literal, len + 1);
*nValues = 1;
break;
}
Expand Down

0 comments on commit 2c6cd83

Please sign in to comment.