fix 内存越界
This commit is contained in:
parent
0af2878317
commit
775ca9f499
|
@ -250,9 +250,10 @@ static void show_check(void)
|
|||
char ch;
|
||||
bool is_first = true;
|
||||
ec_error.is_showed = true;
|
||||
printf(CSI_START "?25l"); // 隐藏光标
|
||||
for (;;)
|
||||
{
|
||||
// 按任意键退出
|
||||
// 按空格,q, x 键退出
|
||||
int result = read(STDIN_FILENO, &ch, 1);
|
||||
if (result == 1 && (ch == ' ' || ch == 'q' || ch == 'x'))
|
||||
{
|
||||
|
@ -282,7 +283,7 @@ static void show_check(void)
|
|||
"---+----+\n");
|
||||
for (int i = 1; i <= ec_slavecount; i++)
|
||||
{
|
||||
char buff[512];
|
||||
char buff[64 * 1024];
|
||||
char *p = buff;
|
||||
// show output / input
|
||||
p += sprintf(p, "%2d | Out/In|", i);
|
||||
|
@ -422,6 +423,7 @@ static void show_check(void)
|
|||
fflush(stdout);
|
||||
osal_usleep(50000);
|
||||
}
|
||||
printf(CSI_START "?25h"); // 显示光标
|
||||
}
|
||||
|
||||
void tj30_test(char *ifname)
|
||||
|
@ -466,7 +468,7 @@ void tj30_test(char *ifname)
|
|||
int32_t sn = ecEepromGetSN(cnt);
|
||||
logn(F_B_BLUE,
|
||||
"Slave:%d Name:%s ID: " CSI_START B_B_WHITE "%u/0x%08x" CSI_END CSI_START F_B_BLUE
|
||||
" SN:" CSI_START B_B_WHITE "%d" CSI_END CSI_START F_B_BLUE
|
||||
" SN:" CSI_START B_B_WHITE "%d" CSI_END CSI_START F_B_BLUE
|
||||
" Output size:%3dbits Input size:%3dbits\n",
|
||||
cnt, ec_slave[cnt].name, ec_slave[cnt].eep_id, ec_slave[cnt].eep_id, sn,
|
||||
ec_slave[cnt].Obits, ec_slave[cnt].Ibits);
|
||||
|
|
Loading…
Reference in New Issue