cf.cf_data_u.cf.cfu_status = data_sim_set_cf_cfu_status[0] - '0';
cf.cf_data_u.cf.ton = data_sim_set_cf_ton[0] - '0';
cf.cf_data_u.cf.npi = data_sim_set_cf_npi[0] - '0';
- memcpy(&cf.cf_data_u.cf.cfu_num, data_sim_set_cf_number,
- sizeof(cf.cf_data_u.cf.cfu_num));
+ snprintf(cf.cf_data_u.cf.cfu_num, TAPI_SIM_XDN_DIALING_NUMBER_LEN + 1,
+ "%s", data_sim_set_cf_number);
cf.cf_data_u.cf.cc2_id = data_sim_set_cf_cc2_id[0] - '0';
cf.cf_data_u.cf.ext7_id = data_sim_set_cf_ext7_id[0] - '0';
}
TAPI_SIM_XDN_ALPHA_ID_MAX_LEN);
mb.ton = data_sim_set_mb_ton[0] - '0';
mb.npi = data_sim_set_mb_npi[0] - '0';
- memcpy(&mb.num, data_sim_set_mb_number, sizeof(mb.num));
+ snprintf(mb.num, TAPI_SIM_XDN_DIALING_NUMBER_LEN + 1,
+ "%s", data_sim_set_mb_number);
mb.cc_id = data_sim_set_mb_cc_id[0] - '0';
mb.ext1_id = data_sim_set_mb_ext1_id[0] - '0';
case 1: { /* Set Service Center Number */
TelSmsAddressInfo_t sca = {0, };
unsigned char sca_num[TAPI_SIM_SMSP_ADDRESS_LEN + 1];
+ unsigned char buf[TAPI_SIM_SMSP_ADDRESS_LEN + 2];
unsigned int sca_length = 0;
unsigned int additional_len = 0;
unsigned local_index, j;
RETRY:
msg("Enter the SCA NUMBER:");
- ret = scanf("%s", sca_num);
+ /* Limits input length - TAPI_SIM_SMSP_ADDRESS_LEN + 1 */
+ ret = scanf("%21s", buf);
+ ret = strlen((const char*)buf);
if (ret > TAPI_SIM_SMSP_ADDRESS_LEN) {
+ int c;
msg("Entered SCA is INVALID - SCA length cannot be greater than %d", TAPI_SIM_SMSP_ADDRESS_LEN);
+ /* Flush input buffer */
+ while ((c = getchar()) != '\n' && c != EOF);
goto RETRY;
}
+ snprintf((char*)sca_num, TAPI_SIM_SMSP_ADDRESS_LEN+1, "%s", buf);
sca.Npi = TAPI_SIM_NPI_ISDN_TEL;
sca.Ton = TAPI_SIM_TON_UNKNOWN;
case 5: {
unsigned int sca_length;
unsigned char sca_num[TAPI_SIM_SMSP_ADDRESS_LEN + 1];
+ unsigned char buf[TAPI_SIM_SMSP_ADDRESS_LEN + 2];
const char *name = "AlphaID";
smsParameters.RecordIndex = 0x00;
do {
msg("Enter the SCA NUMBER:");
- ret = scanf("%s", sca_num);
- if (ret > TAPI_SIM_SMSP_ADDRESS_LEN)
+ /* Limits input length - TAPI_SIM_SMSP_ADDRESS_LEN + 1 */
+ ret = scanf("%21s", buf);
+ ret = strlen((const char*)buf);
+ if (ret > TAPI_SIM_SMSP_ADDRESS_LEN) {
+ int c;
msg("Entered SCA is INVALID - SCA length cannot be greater than %d", TAPI_SIM_SMSP_ADDRESS_LEN);
+ /* Flush input buffer */
+ while ((c = getchar()) != '\n' && c != EOF);
+ } else
+ snprintf((char*)sca_num, TAPI_SIM_SMSP_ADDRESS_LEN+1, "%s", buf);
} while (ret > TAPI_SIM_SMSP_ADDRESS_LEN);
sca_length = SmsUtilEncodeSca(&(smsParameters.TpSvcCntrAddr), sca_num);