Host library for controlling a WiConnect enabled Wi-Fi module.
Dependents: wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more
Diff: NetworkInterface.cpp
- Revision:
- 31:59fac148a8d5
- Parent:
- 29:b6af04b77a56
- Child:
- 40:4b4306f3d829
diff -r fe5d89951afb -r 59fac148a8d5 NetworkInterface.cpp --- a/NetworkInterface.cpp Mon Oct 27 13:44:25 2014 -0700 +++ b/NetworkInterface.cpp Mon Oct 27 13:52:55 2014 -0700 @@ -363,11 +363,12 @@ } uint32_t ip = 0; int i; - char *tok; + const char *tok; for(i = 0; i < 4; ++i, str = tok) { uint8_t nibble; + char buf[4]; tok = strchr(str, '.'); if(tok == NULL) @@ -376,13 +377,15 @@ { return false; } + strcpy(buf, str); } else { - *tok++ = 0; + strncpy(buf, str, tok - str); + ++tok; } - if(!StringUtil::strToUint8(str, &nibble)) + if(!StringUtil::strToUint8(buf, &nibble)) { return false; }