diff options
author | Uros Majstorovic <majstor@majstor.org> | 2024-09-04 21:07:29 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2024-09-04 21:07:29 +0200 |
commit | 9da5f8409c85637361d7bc69b721f6d9d3087b7b (patch) | |
tree | f53bd2d8f9f59b683519ce87551db6ee23be2062 /fw/esp32/components/eos/cell_pdp.c | |
parent | ec892bf2e7620fb58e635b900ab4a0e44e3488bd (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.c | 8 |
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; } |