summaryrefslogtreecommitdiff
path: root/fw/esp32/components/eos/cell_pdp.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2024-09-04 21:07:29 +0200
committerUros Majstorovic <majstor@majstor.org>2024-09-04 21:07:29 +0200
commit9da5f8409c85637361d7bc69b721f6d9d3087b7b (patch)
treef53bd2d8f9f59b683519ce87551db6ee23be2062 /fw/esp32/components/eos/cell_pdp.c
parentec892bf2e7620fb58e635b900ab4a0e44e3488bd (diff)
esp32 cellular modem driver fix
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;
}