From 390e87a22587750b3cc7b7a2b05ce33c64c41729 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 31 Mar 2026 08:22:12 -0400 Subject: [PATCH] Fix #32, adjust buffer termination Subtract one byte to account for the null terminator, if the string length is equal to the buffer size. --- fsw/src/cs_table_processing.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fsw/src/cs_table_processing.c b/fsw/src/cs_table_processing.c index 617985e..e0f651a 100644 --- a/fsw/src/cs_table_processing.c +++ b/fsw/src/cs_table_processing.c @@ -588,13 +588,13 @@ void CS_ExtractNames(const CS_Def_Tables_Table_Entry_t *DefEntry, TableNameLen -= AppNameLen; - if (AppNameLen > AppSz) + if (AppNameLen >= AppSz) { - AppNameLen = AppSz; + AppNameLen = AppSz - 1; } - if (TableNameLen > TableSz) + if (TableNameLen >= TableSz) { - TableNameLen = TableSz; + TableNameLen = TableSz - 1; } memcpy(AppBuf, DefEntry->Name, AppNameLen);