Skip to content

fix: add read-only check for file size setting and zero new memory in RAMFS - #1411

Merged
skarg merged 1 commit into
masterfrom
bugfix/read-only-file-write-property-file-size
Jun 28, 2026
Merged

fix: add read-only check for file size setting and zero new memory in RAMFS#1411
skarg merged 1 commit into
masterfrom
bugfix/read-only-file-write-property-file-size

Conversation

@skarg

@skarg skarg commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 tightens File Object behavior by enforcing Read_Only semantics when attempting to set File_Size, and improves RAMFS safety by zero-initializing newly allocated bytes when expanding an in-memory file buffer.

Changes:

  • Zero-fill newly allocated memory when RAMFS file size grows to avoid exposing uninitialized heap contents via subsequent reads.
  • Block File_Size writes when the BACnet File object is marked Read_Only, returning write-access-denied to the WriteProperty handler.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/bacnet/basic/sys/bramfs.c Zero-initializes newly added RAMFS buffer bytes after realloc() when a file is expanded.
src/bacnet/basic/object/bacfile.c Adds a Read_Only guard to bacfile_file_size_set() so WriteProperty properly denies PROP_FILE_SIZE updates on read-only objects.

@skarg
skarg merged commit da480b0 into master Jun 28, 2026
37 checks passed
@skarg
skarg deleted the bugfix/read-only-file-write-property-file-size branch July 13, 2026 14:31
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.

2 participants