You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some build warnings showing up on a GCC 9.3.0 build (Ubuntu 20.04)
String length warning
In file included from /usr/include/string.h:495,
from /third_party/FMI/main.c:31:
In function ‘strncpy’,
inlined from ‘getfmiEPlusVersion’ at /third_party/FMI/main.c:473:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/third_party/FMI/main.c: In function ‘getfmiEPlusVersion’:
/third_party/FMI/main.c:473:36: note: length computed here
473 | strncpy(fmiVersionNumber, verID, strlen (verID)+ 1);
| ^~~~~~~~~~~~~~
The warning is about the use of strncpy. When using this function, the third argument is supposed to indicate the maximum number of characters to copy. In these usages, the warning is emitted because we are simply copying the entire string anyway -- the "maximum" length we are passing in is always the length of the string. So we should just be using strcpy or memcpy if we know the length ahead of time.
The usages are a little vague because the error message for each is like 10 lines long, and state that there is an inlined call in the calling structure to get to these warnings. Anyway, usages in develop with line numbers as of the time of writing:
third_party/FMI/main.c:473:36
third_party/FMI/main.c:983:4
third_party/FMI/main.c:979:4
third_party/FMI/main.c:974:5
third_party/FMI/main.c:1064:3
third_party/FMUParser/parser.c:252:16
The text was updated successfully, but these errors were encountered:
There are some build warnings showing up on a GCC 9.3.0 build (Ubuntu 20.04)
String length warning
The warning is about the use of
strncpy
. When using this function, the third argument is supposed to indicate the maximum number of characters to copy. In these usages, the warning is emitted because we are simply copying the entire string anyway -- the "maximum" length we are passing in is always the length of the string. So we should just be usingstrcpy
ormemcpy
if we know the length ahead of time.The usages are a little vague because the error message for each is like 10 lines long, and state that there is an inlined call in the calling structure to get to these warnings. Anyway, usages in develop with line numbers as of the time of writing:
The text was updated successfully, but these errors were encountered: