未验证 提交 1eb753cd 编写于 作者: O openharmony_ci 提交者: Gitee

!1075 【挑单】time相关系统调用内核栈信息泄露排查

Merge pull request !1075 from zhushengle/OpenHarmony_1.0.1_release
...@@ -108,7 +108,7 @@ int SysSetiTimer(int which, const struct itimerval *value, struct itimerval *ova ...@@ -108,7 +108,7 @@ int SysSetiTimer(int which, const struct itimerval *value, struct itimerval *ova
{ {
int ret; int ret;
struct itimerval svalue; struct itimerval svalue;
struct itimerval sovalue; struct itimerval sovalue = { 0 };
if (value == NULL) { if (value == NULL) {
errno = EINVAL; errno = EINVAL;
...@@ -136,7 +136,7 @@ int SysSetiTimer(int which, const struct itimerval *value, struct itimerval *ova ...@@ -136,7 +136,7 @@ int SysSetiTimer(int which, const struct itimerval *value, struct itimerval *ova
int SysGetiTimer(int which, struct itimerval *value) int SysGetiTimer(int which, struct itimerval *value)
{ {
int ret; int ret;
struct itimerval svalue; struct itimerval svalue = { 0 };
if (value == NULL) { if (value == NULL) {
errno = EINVAL; errno = EINVAL;
...@@ -188,7 +188,7 @@ int SysTimerCreate(clockid_t clockID, struct sigevent *evp, timer_t *timerID) ...@@ -188,7 +188,7 @@ int SysTimerCreate(clockid_t clockID, struct sigevent *evp, timer_t *timerID)
int SysTimerGettime(timer_t timerID, struct itimerspec *value) int SysTimerGettime(timer_t timerID, struct itimerspec *value)
{ {
int ret; int ret;
struct itimerspec svalue; struct itimerspec svalue = { 0 };
if (value == NULL) { if (value == NULL) {
errno = EINVAL; errno = EINVAL;
...@@ -212,7 +212,7 @@ int SysTimerSettime(timer_t timerID, int flags, const struct itimerspec *value, ...@@ -212,7 +212,7 @@ int SysTimerSettime(timer_t timerID, int flags, const struct itimerspec *value,
{ {
int ret; int ret;
struct itimerspec svalue; struct itimerspec svalue;
struct itimerspec soldValue; struct itimerspec soldValue = { 0 };
if (value == NULL) { if (value == NULL) {
errno = EINVAL; errno = EINVAL;
...@@ -284,7 +284,7 @@ int SysClockSettime(clockid_t clockID, const struct timespec *tp) ...@@ -284,7 +284,7 @@ int SysClockSettime(clockid_t clockID, const struct timespec *tp)
int SysClockGettime(clockid_t clockID, struct timespec *tp) int SysClockGettime(clockid_t clockID, struct timespec *tp)
{ {
int ret; int ret;
struct timespec stp; struct timespec stp = { 0 };
if (tp == NULL) { if (tp == NULL) {
errno = EINVAL; errno = EINVAL;
...@@ -307,7 +307,7 @@ int SysClockGettime(clockid_t clockID, struct timespec *tp) ...@@ -307,7 +307,7 @@ int SysClockGettime(clockid_t clockID, struct timespec *tp)
int SysClockGetres(clockid_t clockID, struct timespec *tp) int SysClockGetres(clockid_t clockID, struct timespec *tp)
{ {
int ret; int ret;
struct timespec stp; struct timespec stp = { 0 };
if (tp == NULL) { if (tp == NULL) {
errno = EINVAL; errno = EINVAL;
...@@ -355,7 +355,7 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp) ...@@ -355,7 +355,7 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp)
{ {
int ret; int ret;
struct timespec srqtp; struct timespec srqtp;
struct timespec srmtp; struct timespec srmtp = { 0 };
if (!rqtp || LOS_ArchCopyFromUser(&srqtp, rqtp, sizeof(struct timespec))) { if (!rqtp || LOS_ArchCopyFromUser(&srqtp, rqtp, sizeof(struct timespec))) {
errno = EFAULT; errno = EFAULT;
...@@ -383,7 +383,7 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp) ...@@ -383,7 +383,7 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp)
clock_t SysTimes(struct tms *buf) clock_t SysTimes(struct tms *buf)
{ {
clock_t ret; clock_t ret;
struct tms sbuf; struct tms sbuf = { 0 };
if (buf == NULL) { if (buf == NULL) {
errno = EFAULT; errno = EFAULT;
...@@ -435,7 +435,7 @@ int SysClockGettime64(clockid_t clockID, struct timespec64 *tp) ...@@ -435,7 +435,7 @@ int SysClockGettime64(clockid_t clockID, struct timespec64 *tp)
{ {
int ret; int ret;
struct timespec t; struct timespec t;
struct timespec64 stp; struct timespec64 stp = { 0 };
if (tp == NULL) { if (tp == NULL) {
errno = EINVAL; errno = EINVAL;
...@@ -462,7 +462,7 @@ int SysClockGetres64(clockid_t clockID, struct timespec64 *tp) ...@@ -462,7 +462,7 @@ int SysClockGetres64(clockid_t clockID, struct timespec64 *tp)
{ {
int ret; int ret;
struct timespec t; struct timespec t;
struct timespec64 stp; struct timespec64 stp = { 0 };
if (tp == NULL) { if (tp == NULL) {
errno = EINVAL; errno = EINVAL;
...@@ -524,7 +524,7 @@ int SysTimerGettime64(timer_t timerID, struct itimerspec64 *value) ...@@ -524,7 +524,7 @@ int SysTimerGettime64(timer_t timerID, struct itimerspec64 *value)
{ {
int ret; int ret;
struct itimerspec val; struct itimerspec val;
struct itimerspec64 svalue; struct itimerspec64 svalue = { 0 };
if (value == NULL) { if (value == NULL) {
errno = EINVAL; errno = EINVAL;
...@@ -583,6 +583,7 @@ int SysTimerSettime64(timer_t timerID, int flags, const struct itimerspec64 *val ...@@ -583,6 +583,7 @@ int SysTimerSettime64(timer_t timerID, int flags, const struct itimerspec64 *val
} }
if (oldValue != NULL) { if (oldValue != NULL) {
(void)memset_s(&soldValue, sizeof(struct itimerspec64), 0, sizeof(struct itimerspec64));
soldValue.it_interval.tv_sec = oldVal.it_interval.tv_sec; soldValue.it_interval.tv_sec = oldVal.it_interval.tv_sec;
soldValue.it_interval.tv_nsec = oldVal.it_interval.tv_nsec; soldValue.it_interval.tv_nsec = oldVal.it_interval.tv_nsec;
soldValue.it_value.tv_sec = oldVal.it_value.tv_sec; soldValue.it_value.tv_sec = oldVal.it_value.tv_sec;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册