summaryrefslogtreecommitdiff
path: root/fw/esp32/components/eos/cell_pdp.c
diff options
context:
space:
mode:
Diffstat (limited to 'fw/esp32/components/eos/cell_pdp.c')
-rw-r--r--fw/esp32/components/eos/cell_pdp.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fw/esp32/components/eos/cell_pdp.c b/fw/esp32/components/eos/cell_pdp.c
index fc4739a..d04b66b 100644
--- a/fw/esp32/components/eos/cell_pdp.c
+++ b/fw/esp32/components/eos/cell_pdp.c
@@ -13,16 +13,14 @@ void eos_cell_pdp_handler(unsigned char mtype, unsigned char *buffer, uint16_t b
case EOS_CELL_MTYPE_PDP_SET_USR:
case EOS_CELL_MTYPE_PDP_SET_PWD: {
char *arg;
- size_t arg_len;
buffer++;
buf_len--;
arg = (char *)buffer;
- arg_len = strnlen(arg, buf_len);
- if (arg_len == buf_len) break;
- if (arg_len >= EOS_CELL_PDP_SIZE_ARG) break;
+ if (buf_len > EOS_CELL_PDP_SIZE_ARG) break;
+ buffer[buf_len] = '\0';
switch (mtype) {
case EOS_CELL_MTYPE_PDP_SET_APN: {
eos_ppp_set_apn(arg);
@@ -66,7 +64,7 @@ void eos_cell_pdp_handler(unsigned char mtype, unsigned char *buffer, uint16_t b
}
}
- eos_net_reply(EOS_NET_MTYPE_CELL, buffer, 1 + strlen(arg));
+ eos_net_reply(EOS_NET_MTYPE_CELL, buffer, strlen(arg) + 1);
break;
}