[PR #1981] [MERGED] fix(epg): Silence snprintf buffer truncation warnings #2780

Open
opened 2026-01-29 17:23:52 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1981
Author: @cfsmp3
Created: 1/5/2026
Status: Merged
Merged: 1/5/2026
Merged by: @cfsmp3

Base: masterHead: fix/epg-snprintf-buffer-warning


📝 Commits (1)

  • e3d1c56 fix(epg): Silence snprintf buffer truncation warnings

📊 Changes

2 files changed (+3 additions, -3 deletions)

View changed files

📝 src/lib_ccx/ts_functions.h (+2 -2)
📝 src/lib_ccx/ts_tables_epg.c (+1 -1)

📄 Description

Summary

Extends EPG time string buffers from 21 to 74 bytes to silence compiler warnings about potential buffer truncation.

Problem

Every build showed warnings like:

ts_tables_epg.c:128:35: warning: '%02d' directive output may be truncated writing between 2 and 11 bytes into a region of size between 10 and 19 [-Wformat-truncation=]
ts_tables_epg.c:128:9: note: 'snprintf' output between 19 and 73 bytes into a destination of size 21

Solution

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 (e.g., if year were somehow negative or very large).

Extended buffers to 74 bytes to match the compiler's calculated maximum, eliminating the warning while maintaining correct functionality.

Changes

  • ts_functions.h: start_time_string[21]start_time_string[74]
  • ts_functions.h: end_time_string[21]end_time_string[74]
  • ts_tables_epg.c: snprintf(output, 21, ...)snprintf(output, 74, ...)

Test Plan

  • Build completes with no warnings
  • No functional changes - output format remains the same

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/1981 **Author:** [@cfsmp3](https://github.com/cfsmp3) **Created:** 1/5/2026 **Status:** ✅ Merged **Merged:** 1/5/2026 **Merged by:** [@cfsmp3](https://github.com/cfsmp3) **Base:** `master` ← **Head:** `fix/epg-snprintf-buffer-warning` --- ### 📝 Commits (1) - [`e3d1c56`](https://github.com/CCExtractor/ccextractor/commit/e3d1c56ad0374eaa51bf09eb9a1218ebe97f165f) fix(epg): Silence snprintf buffer truncation warnings ### 📊 Changes **2 files changed** (+3 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/lib_ccx/ts_functions.h` (+2 -2) 📝 `src/lib_ccx/ts_tables_epg.c` (+1 -1) </details> ### 📄 Description ## Summary Extends EPG time string buffers from 21 to 74 bytes to silence compiler warnings about potential buffer truncation. ## Problem Every build showed warnings like: ``` ts_tables_epg.c:128:35: warning: '%02d' directive output may be truncated writing between 2 and 11 bytes into a region of size between 10 and 19 [-Wformat-truncation=] ts_tables_epg.c:128:9: note: 'snprintf' output between 19 and 73 bytes into a destination of size 21 ``` ## Solution 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 (e.g., if year were somehow negative or very large). Extended buffers to 74 bytes to match the compiler's calculated maximum, eliminating the warning while maintaining correct functionality. ## Changes - `ts_functions.h`: `start_time_string[21]` → `start_time_string[74]` - `ts_functions.h`: `end_time_string[21]` → `end_time_string[74]` - `ts_tables_epg.c`: `snprintf(output, 21, ...)` → `snprintf(output, 74, ...)` ## Test Plan - [x] Build completes with no warnings - [x] No functional changes - output format remains the same 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:23:52 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2780