Module: kamailio Branch: master Commit: 42b24debb47edfef9229ada6fc7fafe293f530a9 URL: https://github.com/kamailio/kamailio/commit/42b24debb47edfef9229ada6fc7fafe293f530a9
Author: Daniel-Constantin Mierla <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: 2025-10-06T15:05:57+02:00 sms: handle case of unsupported length - GH #4413 --- Modified: src/modules/sms/libsms_getsms.c --- Diff: https://github.com/kamailio/kamailio/commit/42b24debb47edfef9229ada6fc7fafe293f530a9.diff Patch: https://github.com/kamailio/kamailio/commit/42b24debb47edfef9229ada6fc7fafe293f530a9.patch --- diff --git a/src/modules/sms/libsms_getsms.c b/src/modules/sms/libsms_getsms.c index 1909c78bcc9..b7c7daecf1a 100644 --- a/src/modules/sms/libsms_getsms.c +++ b/src/modules/sms/libsms_getsms.c @@ -187,9 +187,9 @@ static int fetchsms(struct modem *mdm, int sim, char *pdu) memcpy(pdu, beginning, clen); pdu[clen] = '\0'; } else { - /* truncate */ - memcpy(pdu, beginning, SMS_BUF_SIZE - 1); - pdu[SMS_BUF_SIZE - 1] = '\0'; + /* unsuppported length */ + LM_ERR("failed storing message for sim %i (len: %d)\n", sim, clen); + return 0; } return sim; @@ -248,7 +248,7 @@ int check_memory(struct modem *mdm, int flag) } } } /* if(strstr) */ - } /* if(put_command) */ + } /* if(put_command) */ /* if we are here -> some error happened */ if(checkmodem(mdm) != 0) { LM_WARN("something happened with the modem -> was reinit -> let's " _______________________________________________ Kamailio - Development Mailing List -- [email protected] To unsubscribe send an email to [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender!
