summaryrefslogtreecommitdiff
path: root/fw/esp32/components/eos/cell_pdp.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2022-03-30 13:22:57 +0200
committerUros Majstorovic <majstor@majstor.org>2022-03-30 13:22:57 +0200
commit55474b81146327e8cfa7702fa9366cc7da6562e7 (patch)
treeb6bf9fe0258ab88d12717bb31ecdf4eda0ffa073 /fw/esp32/components/eos/cell_pdp.c
parentc6962c5700f99441538dafa346626bb7e6d12488 (diff)
sock api fixed; net reply messages fixed
Diffstat (limited to 'fw/esp32/components/eos/cell_pdp.c')
-rw-r--r--fw/esp32/components/eos/cell_pdp.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/fw/esp32/components/eos/cell_pdp.c b/fw/esp32/components/eos/cell_pdp.c
index 1aa0575..4c5321a 100644
--- a/fw/esp32/components/eos/cell_pdp.c
+++ b/fw/esp32/components/eos/cell_pdp.c
@@ -6,16 +6,33 @@
#include "eos.h"
#include "cell.h"
-void eos_cell_pdp_handler(unsigned char mtype, unsigned char *buffer, uint16_t size) {
- char *apn, *user, *pass;
+void eos_cell_pdp_handler(unsigned char mtype, unsigned char *buffer, uint16_t buf_len) {
+ char *apn, *user, *pass, *_buf;
+ uint16_t _buf_len;
- buffer += 1;
- size -= 1;
switch (mtype) {
case EOS_CELL_MTYPE_PDP_CONFIG:
- apn = (char *)buffer;
- user = apn + strlen(apn) + 1;
- pass = user + strlen(user) + 1;
+ _buf = (char *)buffer;
+ _buf_len = 0;
+
+ apn = _buf;
+ _buf_len = strnlen(_buf, buf_len);
+ if (_buf_len == buf_len) break;
+ _buf += _buf_len + 1;
+ buf_len -= _buf_len + 1;
+
+ user = _buf;
+ _buf_len = strnlen(_buf, buf_len);
+ if (_buf_len == buf_len) break;
+ _buf += _buf_len + 1;
+ buf_len -= _buf_len + 1;
+
+ pass = _buf;
+ _buf_len = strnlen(_buf, buf_len);
+ if (_buf_len == buf_len) break;
+ _buf += _buf_len + 1;
+ buf_len -= _buf_len + 1;
+
eos_ppp_set_apn(apn);
eos_ppp_set_auth(user, pass);
break;