Skip to content

RDKEMW-12350: Fix uninitialized missing error checks in timeZoneDST fallback path#324

Open
Copilot wants to merge 8 commits intodevelopfrom
copilot/improve-zone-null-checks
Open

RDKEMW-12350: Fix uninitialized missing error checks in timeZoneDST fallback path#324
Copilot wants to merge 8 commits intodevelopfrom
copilot/improve-zone-null-checks

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 10, 2026

No description provided.

Copilot AI and others added 2 commits April 10, 2026 17:08
- Validate ftell return: reject -1 (error) and 0 (empty file)
- Add malloc NULL check to prevent NULL pointer dereference
- Initialize zone buffer to empty string before fscanf
- Reset zone after each iteration to catch stale data
- Check fscanf return == 1 instead of != EOF to catch
  format errors and whitespace-only files
- Remove impossible 'zone != NULL' check (zone is stack-local
  pointer to heap memory, never NULL inside the loop)
- Don't reset zoneValue to NULL on empty reads (preserve any
  previously read valid value)

Agent-Logs-Url: https://github.com/rdkcentral/telemetry/sessions/45c3e1dc-dc54-4005-8756-3a32aa7fdeef

Co-authored-by: yogeswaransky <166126056+yogeswaransky@users.noreply.github.com>
…d, remove redundant reset

Agent-Logs-Url: https://github.com/rdkcentral/telemetry/sessions/45c3e1dc-dc54-4005-8756-3a32aa7fdeef

Co-authored-by: yogeswaransky <166126056+yogeswaransky@users.noreply.github.com>
@yogeswaransky yogeswaransky changed the title Fix uninitialized zone buffer and missing error checks in timeZoneDST fallback path RDKEMW-12350: Fix uninitialized zone buffer and missing error checks in timeZoneDST fallback path Apr 10, 2026
Copilot AI requested a review from yogeswaransky April 10, 2026 17:19
Agent-Logs-Url: https://github.com/rdkcentral/telemetry/sessions/0e080027-1be4-41cd-afbc-25283b55d93f

Co-authored-by: yogeswaransky <166126056+yogeswaransky@users.noreply.github.com>
@yogeswaransky yogeswaransky changed the title RDKEMW-12350: Fix uninitialized zone buffer and missing error checks in timeZoneDST fallback path RDKEMW-12350: Fix uninitialized missing error checks in timeZoneDST fallback path Apr 13, 2026
@yogeswaransky yogeswaransky marked this pull request as ready for review April 13, 2026 08:39
@yogeswaransky yogeswaransky requested a review from a team as a code owner April 13, 2026 08:39
Copilot AI review requested due to automatic review settings April 13, 2026 08:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the timeZoneDST fallback path in getTimezone() so it safely handles unreadable/empty files and allocation failures, aligning with the goal of fixing uninitialized use and missing error checks in that reader.

Changes:

  • Add handling for ftell() failure (numbytes < 0) and for empty files (numbytes == 0) in the /opt/persistent/timeZoneDST fallback.
  • Add malloc failure handling and initialize the zone buffer before reading.
  • Tighten the read loop condition to only process successful fscanf reads (== 1) and ensure resources are freed/closed on all paths.

Copilot AI review requested due to automatic review settings April 13, 2026 08:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread source/xconf-client/xconfclient.c Outdated
Comment thread source/xconf-client/xconfclient.c
Comment thread source/xconf-client/xconfclient.c
Copilot AI review requested due to automatic review settings April 13, 2026 12:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread source/xconf-client/xconfclient.c
Copilot AI review requested due to automatic review settings April 14, 2026 15:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/L1-tests.yml
@yogeswaransky
Copy link
Copy Markdown
Contributor

@copilot can you address this comment in a separate PR
#324 (comment)

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 14, 2026

@yogeswaransky I've opened a new pull request, #329, to work on those changes. Once the pull request is ready, I'll request review from you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants