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:
38:bb6d2be4d54c
Child:
92:dffefc450d6c
--- a/source/PassphraseAuthenticator.cpp	Wed Feb 15 16:17:09 2017 +0000
+++ b/source/PassphraseAuthenticator.cpp	Wed Mar 01 16:18:52 2017 +0000
@@ -84,7 +84,13 @@
     if (coap_data_ptr != NULL && coap_data_ptr_length > 0) {
         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("PassphraseAuthenticator::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);
     }
     return string("");