MYNEWT-654 datetime command may crash device There are two issues here:
1. newtmgr tool always includes an extraneous rc:0 key-value pair in its outgoing datetime commands. 2. Server-side, the firmware parses the "rc" value and writes the result to null. This commit addresses the second issue as follows: Don't attempt to parse the rc entry in incoming requests. Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/0dc1c2b8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/0dc1c2b8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/0dc1c2b8 Branch: refs/heads/1_0_0_dev Commit: 0dc1c2b85664cdde99c48f8628cacdc0c52e4852 Parents: e85707d Author: Christopher Collins <[email protected]> Authored: Sat Mar 4 14:24:38 2017 -0800 Committer: Marko Kiiskila <[email protected]> Committed: Mon Mar 6 15:54:14 2017 -0800 ---------------------------------------------------------------------- mgmt/newtmgr/nmgr_os/src/newtmgr_os.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0dc1c2b8/mgmt/newtmgr/nmgr_os/src/newtmgr_os.c ---------------------------------------------------------------------- diff --git a/mgmt/newtmgr/nmgr_os/src/newtmgr_os.c b/mgmt/newtmgr/nmgr_os/src/newtmgr_os.c index 2a75d47..b69766e 100644 --- a/mgmt/newtmgr/nmgr_os/src/newtmgr_os.c +++ b/mgmt/newtmgr/nmgr_os/src/newtmgr_os.c @@ -271,17 +271,13 @@ nmgr_datetime_set(struct mgmt_cbuf *cb) struct os_timezone tz; char buf[DATETIME_BUFSIZE]; int rc = 0; - const struct cbor_attr_t datetime_write_attr[3] = { + const struct cbor_attr_t datetime_write_attr[] = { [0] = { .attribute = "datetime", .type = CborAttrTextStringType, .addr.string = buf, .len = sizeof(buf), }, - [1] = { - .attribute = "rc", - .type = CborAttrIntegerType, - }, { 0 }, };
