From 55474b81146327e8cfa7702fa9366cc7da6562e7 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Wed, 30 Mar 2022 13:22:57 +0200 Subject: sock api fixed; net reply messages fixed --- fw/esp32/components/eos/cell_ussd.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'fw/esp32/components/eos/cell_ussd.c') diff --git a/fw/esp32/components/eos/cell_ussd.c b/fw/esp32/components/eos/cell_ussd.c index 195feaf..5b90e35 100644 --- a/fw/esp32/components/eos/cell_ussd.c +++ b/fw/esp32/components/eos/cell_ussd.c @@ -14,16 +14,14 @@ static const char *TAG = "EOS USSD"; static char cmd[256]; static int cmd_len; -void eos_cell_ussd_handler(unsigned char mtype, unsigned char *buffer, uint16_t size) { +void eos_cell_ussd_handler(unsigned char mtype, unsigned char *buffer, uint16_t buf_len) { int rv; - buffer += 1; - size -= 1; switch (mtype) { case EOS_CELL_MTYPE_USSD_REQUEST: - if (size == 0) return; + if (buf_len > EOS_CELL_MAX_USSD_STR) return; - buffer[size] = '\0'; + buffer[buf_len] = '\0'; cmd_len = snprintf(cmd, sizeof(cmd), "AT+CUSD=1,\"%s\",15\r", buffer); if ((cmd_len < 0) || (cmd_len >= sizeof(cmd))) return; @@ -89,7 +87,7 @@ static void ussd_reply_handler(char *urc, regmatch_t m[]) { } while (1); if (rv) { - ESP_LOGE(TAG, "USSD error"); + ESP_LOGE(TAG, "error"); eos_net_free(buf); } else { eos_net_send(EOS_NET_MTYPE_CELL, buf, len); -- cgit v1.2.3