fix: 修复审查发现的4个高危问题

1. UartDebug: RS485通道1关闭指令误操作通道2,修正'u'升降级通道混淆
2. bsp: GPIOInit新增PA3(ADC电源控制引脚)初始化为输出
3. main.h: Nonce从int16_t改为uint16_t,消除rand()溢出导致LPTimer0延时异常
4. SGCP: SUB_STATUS_BROADCAST_SYNC_TIME调用ToSDSetColTime改为ToSDSyncTime
This commit is contained in:
2026-07-14 18:16:53 +08:00
parent de545c9919
commit 70758b1c06
4 changed files with 7 additions and 5 deletions
+3 -3
View File
@@ -436,7 +436,7 @@ void DebugCmdRS485Ctrl(int argc, char *argv[])
}
else if(strstr(argv[3], "off") != NULL){
if(idx == 1)
App.Para.Rs485Ch2.Enable = false;
App.Para.Rs485Ch1.Enable = false;
else if(idx == 2)
App.Para.Rs485Ch2.Enable = false;
DBG_LOG("RS485Ch%d Disable!\r\n", idx);
@@ -519,11 +519,11 @@ void DebugCmdRS485Ctrl(int argc, char *argv[])
DBG_LOG("At least keep one upgraded serial port!\r\n");
return;
}
App.Para.Rs485Ch2.UpgradeEnable = false;
App.Para.Rs485Ch1.UpgradeEnable = false;
DBG_LOG("RS485Ch%d Upgrade Off!\r\n", idx);
}
else if(idx == 2) {
if(App.Para.Rs485Ch2.UpgradeEnable == false)
if(App.Para.Rs485Ch1.UpgradeEnable == false)
{
DBG_LOG("At least keep one upgraded serial port!\r\n");
return;
+1 -1
View File
@@ -100,7 +100,7 @@ typedef struct {
bool CaliFlag; //标校标志位
int16_t Nonce; //随机数
uint16_t Nonce; //随机数
}AppDetect_t;
extern AppDetect_t App;
+1 -1
View File
@@ -1355,7 +1355,7 @@ void SubRevLoopHandler(void)
break;}
case SUB_STATUS_BROADCAST_SYNC_TIME:{
ToSDSetColTime(0x00, App.Para.Layout.TimeStamp);
ToSDSyncTime(0x00, App.Para.Layout.TimeStamp);
SGCP.SubStatus = SUB_STATUS_IDLE;
break;}
}
+2
View File
@@ -390,6 +390,8 @@ static void GPIOInit(void)
Gpio_Init(LASER1_ON_OFF_PORTx,LASER1_ON_OFF_PINx,&GpioInitStruct);
Gpio_Init(LASER2_ON_OFF_PORTx,LASER2_ON_OFF_PINx,&GpioInitStruct);
Gpio_Init(LASER3_ON_OFF_PORTx,LASER3_ON_OFF_PINx,&GpioInitStruct);
//< ADC???????
Gpio_Init(AD_ON_OFF_PORTx,AD_ON_OFF_PINx,&GpioInitStruct);
GpioInitStruct.bOutputVal = true; ///< 端口默认输出配置->高电平
//< LORA --> RST