Skip to content

Commit 4dd5362

Browse files
committed
Adding changes from issue #3
Adding the extras from: sparkfun/SparkFun_LTE_Shield_Arduino_Library#3
1 parent b5ba450 commit 4dd5362

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/SparkFun_u-blox_SARA-R5_Arduino_Library.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ SARA_R5_error_t SARA_R5::enableEcho(boolean enable)
484484
String SARA_R5::imei(void)
485485
{
486486
char *response;
487-
char imeiResponse[16];
487+
char imeiResponse[16] = { 0x00 };
488488
SARA_R5_error_t err;
489489

490490
response = sara_r5_calloc_char(sizeof(imeiResponse) + 16);
@@ -506,7 +506,7 @@ String SARA_R5::imei(void)
506506
String SARA_R5::imsi(void)
507507
{
508508
char *response;
509-
char imsiResponse[16];
509+
char imsiResponse[16] = { 0x00 };
510510
SARA_R5_error_t err;
511511

512512
response = sara_r5_calloc_char(sizeof(imsiResponse) + 16);
@@ -527,7 +527,7 @@ String SARA_R5::imsi(void)
527527
String SARA_R5::ccid(void)
528528
{
529529
char *response;
530-
char ccidResponse[21];
530+
char ccidResponse[21] = { 0x00 };
531531
SARA_R5_error_t err;
532532

533533
response = sara_r5_calloc_char(sizeof(ccidResponse) + 16);
@@ -662,6 +662,7 @@ SARA_R5_error_t SARA_R5::clock(uint8_t *y, uint8_t *mo, uint8_t *d,
662662
*s = is;
663663
*tz = itz;
664664
}
665+
else err = SARA_R5_ERROR_UNEXPECTED_RESPONSE;
665666
}
666667

667668
free(command);
@@ -837,6 +838,10 @@ SARA_R5_error_t SARA_R5::setAPN(String apn, uint8_t cid, SARA_R5_pdp_type pdpTyp
837838
case PDP_TYPE_IPV6:
838839
memcpy(pdpStr, "IPV6", 2);
839840
break;
841+
default:
842+
free(command);
843+
return LTE_SHIELD_ERROR_UNEXPECTED_PARAM;
844+
break;
840845
}
841846
sprintf(command, "%s=%d,\"%s\",\"%s\"", SARA_R5_MESSAGE_PDP_DEF,
842847
cid, pdpStr, apn.c_str());

0 commit comments

Comments
 (0)