You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/10/08 11:35:26 UTC

[GitHub] rymanluk closed pull request #197: Fix the wrong way to detect the trailing space

rymanluk closed pull request #197: Fix the wrong way to detect the trailing space
URL: https://github.com/apache/mynewt-nimble/pull/197
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/nimble/host/mesh/src/prov.c b/nimble/host/mesh/src/prov.c
index 5943f0d2..f9830d34 100644
--- a/nimble/host/mesh/src/prov.c
+++ b/nimble/host/mesh/src/prov.c
@@ -1375,6 +1375,8 @@ static void gen_prov_ack(struct prov_rx *rx, struct os_mbuf *buf)
 
 static void gen_prov_start(struct prov_rx *rx, struct os_mbuf *buf)
 {
+	u16_t trailing_space = 0;
+	
 	if (link.rx.seg) {
 		BT_WARN("Got Start while there are unreceived segments");
 		return;
@@ -1385,6 +1387,8 @@ static void gen_prov_start(struct prov_rx *rx, struct os_mbuf *buf)
 		gen_prov_ack_send(rx->xact_id);
 		return;
 	}
+	
+	trailing_space = OS_MBUF_TRAILINGSPACE(link.rx.buf);
 
 	link.rx.buf->om_len = net_buf_simple_pull_be16(buf);
 	link.rx.id  = rx->xact_id;
@@ -1399,7 +1403,7 @@ static void gen_prov_start(struct prov_rx *rx, struct os_mbuf *buf)
 		return;
 	}
 
-	if (link.rx.buf->om_len > OS_MBUF_TRAILINGSPACE(link.rx.buf)) {
+	if (link.rx.buf->om_len > trailing_space) {
 		BT_ERR("Too large provisioning PDU (%u bytes)",
 		       link.rx.buf->om_len);
 		close_link(PROV_ERR_NVAL_FMT, CLOSE_REASON_FAILED);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services