[Bugfix][T108][bug-view-1616]Fix the issue of being able to send text messages even when the length does not match
Only Configure: No
Affected branch: GSW_V1453
Affected module: sms
Is it affected on IC: only ASR
Self-test: yes
Doc Update: no
Change-Id: I8b02c242e470e8be892853512dbb0a09079083d7
diff --git a/mbtk/libgsw_lib/gsw_sms_interface.c b/mbtk/libgsw_lib/gsw_sms_interface.c
index ba26614..ecb8229 100755
--- a/mbtk/libgsw_lib/gsw_sms_interface.c
+++ b/mbtk/libgsw_lib/gsw_sms_interface.c
@@ -280,7 +280,7 @@
for(i = 0; i<BuffLen;i++)
{
sprintf(TempBuff,"%02x",(unsigned char)Buff[i]);
- strncat(strBuff,TempBuff,BuffLen*2);
+ strncat(strBuff,TempBuff,2);
}
strncpy(OutputStr, strBuff, BuffLen*2);
return;
@@ -522,12 +522,18 @@
return GSW_HAL_ARG_INVALID;
}
- if(strlen((char *)msg) > GSW_SMS_RECV_CONT_MAX || strlen((char *)msg) == 0 || strlen((char *)phone_num) == 0)
+ if(strlen((char *)msg) == 0 || strlen((char *)phone_num) == 0)
{
LOGE(GSW_SMS,"strlen(telephony_num):%d", strlen((char *)phone_num));
LOGE(GSW_SMS,"strlen(msg):%d", strlen((char *)msg));
return GSW_HAL_ARG_INVALID;
}
+ if(strlen((char *)msg) > MSG_MAX_LEN || msg_len > MSG_MAX_LEN || strlen((char *)msg) != msg_len)
+ {
+ LOGE(GSW_SMS,"stelen is %d\n",strlen((char *)msg));
+ LOGE(GSW_SMS,"the lenth is error\n");
+ return GSW_HAL_NORMAL_FAIL;
+ }
int err = -1;