SMS_TON_T ton;
- *ppParam = new char[MAX_ADD_PARAM_LEN];
+ char *tempParam = new char[MAX_ADD_PARAM_LEN];
+ if (tempParam == NULL)
+ return 0;
+
+ memset(tempParam, 0x00, sizeof(char)*MAX_ADD_PARAM_LEN);
/* Set Address Length */
if (temp[0] == '+') {
- (*ppParam)[offset++] = strlen(temp) - 1;
+ tempParam[offset++] = strlen(temp) - 1;
temp++;
ton = SMS_TON_INTERNATIONAL;
} else {
- (*ppParam)[offset++] = strlen(temp);
+ tempParam[offset++] = strlen(temp);
ton = pAddress->ton;
}
/* Set TON, NPI */
- (*ppParam)[offset++] = 0x80 + (ton << 4) + pAddress->npi;
+ tempParam[offset++] = 0x80 + (ton << 4) + pAddress->npi;
- MSG_DEBUG("Address length is %d.", (*ppParam)[0]);
+ MSG_DEBUG("Address length is %d.", tempParam[0]);
MSG_DEBUG("pAddress->ton : %d.", ton);
MSG_DEBUG("pAddress->npi : %d.", pAddress->npi);
- length = convertDigitToBcd(temp, strlen(temp), (unsigned char *) &((*ppParam)[offset]));
+ length = convertDigitToBcd(temp, strlen(temp), (unsigned char *) &(tempParam[offset]));
offset += length;
+ *ppParam = tempParam;
+
return offset ;
}
int SmsPluginParamCodec::encodeDCS(const SMS_DCS_S *pDCS, char **ppParam)
{
- *ppParam = new char;
+ *ppParam = new char[MAX_DCS_PARAM_LEN];
**ppParam = 0x00;
return 0;
}
- return 1;
+ return MAX_DCS_PARAM_LEN;
}
convertBcdToDigit(&(pTpdu[offset]), bcdLen, &((pAddress->address)[0]));
}
- offset += bcdLen;
+ offset += bcdLen;
/* MSG_DEBUG("address [%s]", pAddress->address);
*/
MSG_DEBUG("timezone : %d", time_stamp->time.absolute.timeZone);
char displayTime[32];
- struct tm * timeTM;
+ struct tm timeTM;
+ memset(&timeTM, 0x00, sizeof(tm));
struct tm timeinfo;
memset(&timeinfo, 0x00, sizeof(tm));
rawtime -= (time_stamp->time.absolute.timeZone * (3600/4));
- timeTM = localtime(&rawtime);
+ localtime_r(&rawtime, &timeTM);
memset(displayTime, 0x00, sizeof(displayTime));
- strftime(displayTime, 32, "%Y-%02m-%02d %T %z", timeTM);
+ strftime(displayTime, 32, "%Y-%02m-%02d %T %z", &timeTM);
MSG_DEBUG("displayTime [%s]", displayTime);
/* timezone value is tiemzone + daylight. So should not add daylight */
rawtime -= timezone;
#endif
- timeTM = localtime(&rawtime);
+ memset(&timeTM, 0x00, sizeof(tm));
+ localtime_r(&rawtime, &timeTM);
memset(displayTime, 0x00, sizeof(displayTime));
- strftime(displayTime, 32, "%Y-%02m-%02d %T %z", timeTM);
+ strftime(displayTime, 32, "%Y-%02m-%02d %T %z", &timeTM);
MSG_DEBUG("displayTime [%s]", displayTime);
} else {
rawtime = time(NULL);