OCT 1. 修正缓冲区可能溢出问题

This commit is contained in:
huangxin 2022-12-07 15:59:16 +08:00
parent b49e3595db
commit fe0b357300
3 changed files with 4 additions and 2 deletions

View File

@ -36,7 +36,7 @@ static int disk_info_refresh() {
int i = 0; int i = 0;
int errCode = ERR_SUCCESS; int errCode = ERR_SUCCESS;
FILE *fp; FILE *fp;
char buf[MAX_PATH]; char buf[MAX_PATH * 2];
fp = popen(CMD_DISK_FILESYSTEM, "r"); fp = popen(CMD_DISK_FILESYSTEM, "r");

View File

@ -44,7 +44,7 @@ unsigned int get_sys_total_memory() {
static int memory_info_refresh() { static int memory_info_refresh() {
int errCode = ERR_SUCCESS; int errCode = ERR_SUCCESS;
FILE *fp; FILE *fp;
char buf[MAX_PATH]; char buf[MAX_PATH * 2];
fp = popen(CMD_MEMORY_INFO, "r"); fp = popen(CMD_MEMORY_INFO, "r");

View File

@ -701,6 +701,8 @@ static zvect_retval p_vect_set_capacity(vector const v, const zvect_index direct
return ZVERR_OUTOFMEM; return ZVERR_OUTOFMEM;
} }
memset(new_data, 0, sizeof(void *) * (new_capacity + v->cap_right));
zvect_index nb; zvect_index nb;
zvect_index ne; zvect_index ne;
nb = v->cap_left; nb = v->cap_left;