You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/07/23 02:59:19 UTC

incubator-mynewt-core git commit: newtmgr_ble - Oops, fix stupid off-by-one bugs.

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop beab6f23b -> 055eb4aa0


newtmgr_ble - Oops, fix stupid off-by-one bugs.


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/055eb4aa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/055eb4aa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/055eb4aa

Branch: refs/heads/develop
Commit: 055eb4aa0f4ce9280d80cb0ac759280aecb82e2b
Parents: beab6f2
Author: Christopher Collins <cc...@apache.org>
Authored: Fri Jul 22 19:58:28 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Fri Jul 22 19:58:28 2016 -0700

----------------------------------------------------------------------
 libs/newtmgr/transport/ble/src/newtmgr_ble.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/055eb4aa/libs/newtmgr/transport/ble/src/newtmgr_ble.c
----------------------------------------------------------------------
diff --git a/libs/newtmgr/transport/ble/src/newtmgr_ble.c b/libs/newtmgr/transport/ble/src/newtmgr_ble.c
index aff9eb2..14fea3e 100644
--- a/libs/newtmgr/transport/ble/src/newtmgr_ble.c
+++ b/libs/newtmgr/transport/ble/src/newtmgr_ble.c
@@ -94,11 +94,13 @@ gatt_svr_chr_access_newtmgr(uint16_t conn_handle, uint16_t attr_handle,
              * it is not possible to reuse the mbuf, then allocate a new one
              * and copy the request contents.
              */
-            if (OS_MBUF_USRHDR_LEN(ctxt->om) > sizeof (conn_handle)) {
+            if (OS_MBUF_USRHDR_LEN(ctxt->om) >= sizeof (conn_handle)) {
                 /* Sufficient usrhdr space already present. */
                 m_req = ctxt->om;
                 ctxt->om = NULL;
-            } else if (OS_MBUF_LEADINGSPACE(ctxt->om) > sizeof (conn_handle)) {
+            } else if (OS_MBUF_LEADINGSPACE(ctxt->om) >=
+                       sizeof (conn_handle)) {
+
                 /* Usrhdr isn't present, but there is enough leading space to
                  * add one.
                  */