diff --git a/common/inc/pwrdata.h b/common/inc/pwrdata.h index 0dfe14ba7e8402b2d490b1a8ba3824ad25a1efdd..9af89431a04e70f389ac974b0eff48971839ec1f 100644 --- a/common/inc/pwrdata.h +++ b/common/inc/pwrdata.h @@ -27,7 +27,7 @@ #define PWR_MAX_NUMA_NODE_NUM 128 #define PWR_MAX_GOV_NUM 16 #define PWR_MAX_STRING_LEN 1000 -#define PWR_MAX_TIME_LEN 25 +#define PWR_MAX_TIME_LEN 32 #define PWR_MAX_DC_INTERVAL 100000000 #define PWR_MIN_DC_INTERVAL 1000 #define PWR_CPU_USAGE_COLUMN 8 diff --git a/pwrapic/src/sockclient.c b/pwrapic/src/sockclient.c index 3007cd67544fb8f9a27b0c84bc621b49760d0369..9601248970d154b9672e74d3c6c45e35e64d3ca4 100644 --- a/pwrapic/src/sockclient.c +++ b/pwrapic/src/sockclient.c @@ -271,7 +271,9 @@ static void SendMsgToSocket(void) if (len <= MAX_DATA_SIZE) { memcpy(data, msg, sizeof(PwrMsg)); - memcpy(data + sizeof(PwrMsg), msg->data, msg->head.dataLen); + if (msg->data && msg->head.dataLen > 0) { + memcpy(data + sizeof(PwrMsg), msg->data, msg->head.dataLen); + } WriteMsg(data, len); } else { memcpy(data, msg, sizeof(PwrMsg)); diff --git a/pwrapis/src/cpuservice.c b/pwrapis/src/cpuservice.c index 2d4d21afa829c22be7d487b6068e51ac8e9b98e0..a3d5b33a4ac78e4c5fefa10e45d068b7e8ead18a 100644 --- a/pwrapis/src/cpuservice.c +++ b/pwrapis/src/cpuservice.c @@ -160,7 +160,7 @@ static int UsageToLong(char *buf, unsigned long paras[], int line) int j = 0; int k; char temp[PWR_MAX_STRING_LEN]; - while (i <= PWR_CPU_USAGE_COLUMN) { + while (i < PWR_CPU_USAGE_COLUMN) { bzero(temp, sizeof(temp)); k = 0; while (buf[j] != ' ') {