Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #730 - adds null to FILEDEFs #738

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix #730 - adds null to FILEDEFs
  • Loading branch information
CDKnightNASA committed Jun 5, 2020
commit c37197ea5eda6b17c6b38a8f1326e1b582aff6bd
8 changes: 7 additions & 1 deletion fsw/cfe-core/src/inc/cfe_tbl_filedef.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ typedef struct
} CFE_TBL_FileDef_t;

/** The CFE_TBL_FILEDEF macro can be used to simplify the declaration of a table image when using the elf2cfetbl utility.
**
** Note that the macro adds a NULL at the end to ensure that it is null-terminated. (C allows
** a struct to be statically initialized with a string exactly the length of the array, which
** loses the null terminator.) This means the actual length limit of the fields are the above
** LEN - 1.
**
** An example of the source code and how this macro would be used is as follows: \code

#include "cfe_tbl_filedef.h"
Expand All @@ -87,7 +93,7 @@ typedef struct
\endcode
*/

#define CFE_TBL_FILEDEF(ObjName, TblName, Desc, Filename) static OS_USED CFE_TBL_FileDef_t CFE_TBL_FileDef={#ObjName, #TblName, #Desc, #Filename, sizeof(ObjName)};
#define CFE_TBL_FILEDEF(ObjName, TblName, Desc, Filename) static OS_USED CFE_TBL_FileDef_t CFE_TBL_FileDef={#ObjName "\0", #TblName "\0", #Desc "\0", #Filename "\0", sizeof(ObjName)};

/*************************************************************************/

Expand Down