mbed Connector Interface simplification API on top of mbed-client

Fork of mbedConnectorInterfaceV3 by Doug Anson

NOTE:

This repo has been replaced with https://github.com/ARMmbed/mbedConnectorInterface. No further updates will occur with this repo. Please use the github repo instead. Thanks!

Revision:
91:179b5cb420de
Parent:
54:dfee8691c83a
Child:
118:bee40e9f18ff
diff -r cff3317ad4b0 -r 179b5cb420de source/DynamicResource.cpp
--- a/source/DynamicResource.cpp	Wed Feb 15 16:17:09 2017 +0000
+++ b/source/DynamicResource.cpp	Wed Mar 01 16:18:52 2017 +0000
@@ -376,7 +376,13 @@
             // no unwrap of the data...
             char buf[MAX_VALUE_BUFFER_LENGTH+1];
             memset(buf,0,MAX_VALUE_BUFFER_LENGTH+1);
-            memcpy(buf,(char *)coap_data_ptr,coap_data_ptr_length);
+            int length = coap_data_ptr_length;
+            if (length > MAX_VALUE_BUFFER_LENGTH) {
+            	length = MAX_VALUE_BUFFER_LENGTH;
+            	this->logger()->log("DynamicResource::coapDataToString: WARNING clipped data: %d bytes to %d bytes. Increase MAX_VALUE_BUFFER_LENGTH",
+            					    coap_data_ptr_length,length);
+            }
+            memcpy(buf,(char *)coap_data_ptr,length);
             return string(buf);
         }
     }