This library controls the WNC. There is a derived class for usage from the K64F board.

Fork of WncControllerLibrary by Fred Kellerman

Files at this revision

API Documentation at this revision

Comitter:
fkellermavnet
Date:
Fri Sep 15 23:28:54 2017 +0000
Parent:
36:d1a98d5f2bbd
Commit message:
Fixed benign bug, if string not found for dnsresolve (which means something is broken anyways), code was adding and then looking for string::npos. Which if the string was not correct this would have probably crashed the application, all fixed now.

Changed in this revision

WncController.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r d1a98d5f2bbd -r 92acf8c20e6d WncController.cpp
--- a/WncController.cpp	Thu Apr 06 21:42:30 2017 -0400
+++ b/WncController.cpp	Fri Sep 15 23:28:54 2017 +0000
@@ -1620,10 +1620,12 @@
     str += "\"";
     r = sendWncCmd(str.c_str(), &pRespStr, WNC_DNS_RESOLVE_WAIT_MS);
     if (r == WNC_AT_CMD_OK && pRespStr->size() > 0) {
-        size_t pos_start = pRespStr->find(":\"") + 2;
+        size_t pos_start = pRespStr->find(":\"");
         if (pos_start !=  string::npos) {
-            size_t pos_end = pRespStr->find("\"", pos_start) - 1;
+            pos_start += 2;
+            size_t pos_end = pRespStr->find("\"", pos_start);
             if (pos_end != string::npos) {
+                pos_end -= 1;
                 if (pos_end > pos_start) {
                     // Make a copy for use later (the source string is re-used)
                     *ipStr = pRespStr->substr(pos_start, pos_end - pos_start + 1);