This is an automated email from the ASF dual-hosted git repository. sjanc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git
commit 8d1cd63a989d213a18f3d6fda3a22fa790b05dd0 Author: Szymon Janc <[email protected]> AuthorDate: Wed Oct 7 15:46:20 2026 +0200 cmd/fs_mgmt: Add missing data length check Make sure that file upload data length does not exceed data buffer size before writing it to file. Assisted-by: Claude:claude-opus-5-5 --- cmd/fs_mgmt/src/fs_mgmt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/fs_mgmt/src/fs_mgmt.c b/cmd/fs_mgmt/src/fs_mgmt.c index 0904795..95a283f 100644 --- a/cmd/fs_mgmt/src/fs_mgmt.c +++ b/cmd/fs_mgmt/src/fs_mgmt.c @@ -219,6 +219,10 @@ fs_mgmt_file_upload(struct mgmt_ctxt *ctxt) } } + if (data_len > sizeof(file_data)) { + return MGMT_ERR_EINVAL; + } + new_off = fs_mgmt_ctxt.off + data_len; if (new_off > fs_mgmt_ctxt.len) { /* Data exceeds image length. */
