The Hiking Pal tracking device firmware. See full description on the detail page: https://www.hackster.io/bowenfeng/hiking-pal-v1-07c02d

Dependencies:   FXOS8700CQ MODSERIAL mbed

Fork of Avnet_ATT_Cellular_IOT by Avnet

Revision:
52:9dafcb7f320f
Parent:
50:8ac42961458c
Child:
53:dcccf2881fa0
--- a/main.cpp	Sun Jul 24 21:56:14 2016 +0000
+++ b/main.cpp	Sun Jul 24 22:10:12 2016 +0000
@@ -518,12 +518,17 @@
                 printf(YEL "Read back : %s" DEF "\r\n", &MySocketData[0]);
                 char myJsonResponse[512];
                 char stringToCharBuf[BUF_SIZE_FOR_N_MAX_SOCKREAD*MAX_WNC_SOCKREAD_PAYLOAD+1]; // WNC can return max of 1500 (per sockread)
-                strcpy(stringToCharBuf, MySocketData.c_str());
-                if (extract_JSON(stringToCharBuf, &myJsonResponse[0]))
+                if ((MySocketData.length() + 1) < sizeof(stringToCharBuf))
                 {
-                    printf(GRN "JSON : %s" DEF "\n", &myJsonResponse[0]);
-                    parse_JSON(&myJsonResponse[0]);
+                    strcpy(stringToCharBuf, MySocketData.c_str());
+                    if (extract_JSON(stringToCharBuf, &myJsonResponse[0]))
+                    {
+                        printf(GRN "JSON : %s" DEF "\n", &myJsonResponse[0]);
+                        parse_JSON(&myJsonResponse[0]);
+                    }
                 }
+                else
+                    puts("BUFFER not big enough for sock data!\r\n");
             }
             else
             {