Fahad Mirza
/
Nucleo_HXC900
A demo application for HXC900 LoRaWAN module using Nucleo-L053R8.
Diff: Utilities/utilities.c
- Revision:
- 32:2d0678039a09
- Parent:
- 6:1d09b7960d57
--- a/Utilities/utilities.c Mon Dec 10 19:54:23 2018 +0000 +++ b/Utilities/utilities.c Thu Jan 24 21:57:23 2019 +0000 @@ -94,7 +94,7 @@ } } -uint8_t stringHexToByteArray(const char *hexString, uint8_t *buffer, int8_t bufSize) +uint8_t stringHexToByteArray(const char *hexString, uint8_t *buffer, uint8_t bufSize) { uint8_t count = 0; char hex[3]; @@ -112,7 +112,7 @@ break; } count++; - if (count == bufSize) + if (count == (bufSize - 1)) { // We are out of space break; @@ -121,7 +121,7 @@ hexString += 2; } - buffer[count] = NULL; + buffer[count] = '\0'; return count; }