Skip to content

Commit e3d1c56

Browse files
cfsmp3claude
andcommitted
fix(epg): Silence snprintf buffer truncation warnings
Extend EPG time string buffers from 21 to 74 bytes to silence compiler warnings about potential buffer truncation. The actual output is always 20 chars ("YYYYMMDDHHMMSS +0000") plus null terminator, but the compiler warns because %02d with int arguments could theoretically produce larger output. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent b5bc0e2 commit e3d1c56

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/lib_ccx/ts_functions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ struct EPG_rating
5050
struct EPG_event
5151
{
5252
uint32_t id;
53-
char start_time_string[21]; //"YYYYMMDDHHMMSS +0000" = 20 chars
54-
char end_time_string[21];
53+
char start_time_string[74]; // "YYYYMMDDHHMMSS +0000" = 20 chars, 74 to silence compiler warning
54+
char end_time_string[74];
5555
uint8_t running_status;
5656
uint8_t free_ca_mode;
5757
char ISO_639_language_code[4];

src/lib_ccx/ts_tables_epg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void EPG_ATSC_calc_time(char *output, uint32_t time)
125125
timeinfo.tm_hour = 0;
126126
timeinfo.tm_isdst = -1;
127127
mktime(&timeinfo);
128-
snprintf(output, 21, "%02d%02d%02d%02d%02d%02d +0000", timeinfo.tm_year + 1900, timeinfo.tm_mon + 1, timeinfo.tm_mday, timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec);
128+
snprintf(output, 74, "%02d%02d%02d%02d%02d%02d +0000", timeinfo.tm_year + 1900, timeinfo.tm_mon + 1, timeinfo.tm_mday, timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec);
129129
}
130130

131131
// Fills event.start_time_string in XMLTV format with passed DVB time

0 commit comments

Comments
 (0)