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 42e87bf7d704eb18607e3ead77a5b3ab85cbc3fd
Author: Szymon Janc <[email protected]>
AuthorDate: Wed Oct 7 16:02:39 2026 +0200

    cmd/os_mgmt: Fix datetime write with missing value
    
    Datetime buffer was not initialized and was used uninitialized if
    request did not contain datetime value. Initialize buffer and reject
    requests with missing or empty datetime value.
    
    Assisted-by: Claude:claude-opus-5-5
---
 cmd/os_mgmt/src/os_mgmt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cmd/os_mgmt/src/os_mgmt.c b/cmd/os_mgmt/src/os_mgmt.c
index 0710ee4..b43fa3c 100644
--- a/cmd/os_mgmt/src/os_mgmt.c
+++ b/cmd/os_mgmt/src/os_mgmt.c
@@ -250,8 +250,10 @@ os_mgmt_datetime_write(struct mgmt_ctxt *ctxt)
         [1] = { .attribute = NULL }
     };
 
+    datetime_buf[0] = '\0';
+
     err = cbor_read_object(&ctxt->it, attrs);
-    if (err != 0) {
+    if (err != 0 || datetime_buf[0] == '\0') {
         return MGMT_ERR_EINVAL;
     }
 

Reply via email to