Skip to content

Fix out-of-bounds write when updating a record array without an element index - #80

Merged
garethpotter merged 4 commits into
mainfrom
fix-record-update-without-index
Nov 25, 2026
Merged

garethpotter merged 4 commits into
mainfrom
fix-record-update-without-index

Conversation

@amitchone

Copy link
Copy Markdown
Collaborator

Updates addressed to a record array itself (by ID, or by name with no /N) already returned badRequest but still decoded into value[SIZE_MAX]; the handler now returns first. A failed element decode is also reported as badRequest instead of changed. Claude added some tests.

@amitchone

Copy link
Copy Markdown
Collaborator Author

@garethpotter the implementation in its current form rejected whole array updates, so I've stuck with that theme here. AFAICT the spec doesn't state either way so this aligns with the current implementation but we could discuss it if you have opinions

@amitchone

amitchone commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator Author

CI is my enemy here. Will retry the failures again later.

Edit: it's a recurring issue

Comment thread tests/TestServer.cpp Outdated

/// @brief Sends a binary request given as hex bytes and returns the response length; the
/// response is left in `response`.
static int sendBinary(TestableServer &server, const char *hex, uint8_t *response, size_t responseSize)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I feel like this should be reused from TestServerProtocol.cpp, where most of it is found in the method named fromHex.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Apologies, had a lot on. I've now done this, and we also now share TestableServer

@amitchone
amitchone force-pushed the fix-record-update-without-index branch from 82ee154 to 953c391 Compare November 25, 2026 16:22
@garethpotter
garethpotter merged commit 47d7c45 into main Nov 25, 2026
6 checks passed
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