Fix nRF firmware minor findings and config-read chunk cap (MJ-14)#4
Open
balloob wants to merge 1 commit into
Open
Fix nRF firmware minor findings and config-read chunk cap (MJ-14)#4balloob wants to merge 1 commit into
balloob wants to merge 1 commit into
Conversation
- MJ-14: derive the config-read chunk cap from MAX_CONFIG_SIZE instead of a magic 10, so a full config is always readable and the cap stays correct if the constants change. - Add the total_size sanity check (0 / > MAX_CONFIG_SIZE) NACK on the chunked-config first packet, mirroring the Silabs firmware. - Size enc_buf to MAX_ENCRYPTED_PACKET_SIZE (542) instead of 512 to remove a latent overflow if a max-size encrypted response is ever produced. - Document why the direct-write END refresh-mode byte is not honored on nRF (driver exposes only a single full-refresh entry point). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012g2e8mr132vcizx92WsgiR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Batch of small nRF firmware fixes, matching the Silabs firmware where a companion behavior exists.
MAX_CONFIG_SIZE.handle_read_configcapped reads at a magic10chunks.MAX_CONFIG_SIZEis 512, so the old cap (~958 B usable) already covered a full config, but the magic number was fragile. The cap is now computed asceil(MAX_CONFIG_SIZE / (MAX_RESPONSE_DATA_SIZE - 6)), guaranteeing a full config is always readable and staying correct if either constant changes. The client already loops until it hastotalbytes.total_sizesanity check. The chunked-config first packet now NACKs an invalidtotal_size(== 0or> MAX_CONFIG_SIZE), mirroring the Silabs firmware (opendisplay_pipe.c). Previously a bogus huge size just never completed (bounded elsewhere, non-exploitable, but now fails fast).enc_bufsized toMAX_ENCRYPTED_PACKET_SIZE(542).send_response'senc_bufwas[512]while the declared max encrypted packet is 542, a latent overflow if a max-size encrypted response were ever produced. Now sized to the constant.payload[0]==1 -> fast). The nRF EPD driver exposes only a single full-refresh entry point (epd_driver_t.refreshtakes no mode argument;SSD16xx_Refresh/UC81xx_Refreshalways do a full refresh with no fast LUT), so this can't be honored without a driver API change. Added a clear comment rather than faking it.Note: MJ-14 also needs the companion config-read cap raise in the Silabs and Arduino firmwares.
Build: no
arm-none-eabi-gcc/SDK available in this environment; changes host syntax-checked and the cap/size arithmetic verified (enc_buf 542 B; derived cap covers 512 B).🤖 Generated with Claude Code
https://claude.ai/code/session_012g2e8mr132vcizx92WsgiR