router/rtrCmd.c: Incorrect return-value check for a 'scanf'-like function

Fix code scanning alert no. 156: Incorrect return-value check for a 'scanf'-like function (#6)

* Create codeql.yml

* Fix code scanning alert no. 156: Incorrect return-value check for a 'scanf'-like function

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
Darryl Miles 2024-09-30 01:46:52 +01:00 committed by Tim Edwards
parent 4374a1918e
commit 64d94ae588
1 changed files with 5 additions and 5 deletions

View File

@ -640,7 +640,7 @@ CmdRoute(w, cmd)
{
if(cmd->tx_argc!=3)
goto wrongNumArgs;
if(!sscanf(cmd->tx_argv[2], "%d", &RtrViaLimit))
if(sscanf(cmd->tx_argv[2], "%d", &RtrViaLimit) != 1)
TxError("Bad value for via limit\n");
}
TxPrintf("Via limit is %d\n", RtrViaLimit);
@ -650,7 +650,7 @@ CmdRoute(w, cmd)
{
if(cmd->tx_argc!=3)
goto wrongNumArgs;
if(!sscanf(cmd->tx_argv[2], "%f", &RtrEndConst))
if(sscanf(cmd->tx_argv[2], "%f", &RtrEndConst) != 1)
TxError("Bad value for channel end distance\n");
}
TxPrintf("Channel end constant is %f\n", RtrEndConst);
@ -660,7 +660,7 @@ CmdRoute(w, cmd)
{
if(cmd->tx_argc!=3)
goto wrongNumArgs;
if(!sscanf(cmd->tx_argv[2], "%d", &GCRMinJog))
if(sscanf(cmd->tx_argv[2], "%d", &GCRMinJog) != 1)
TxError("Bad value for minimum jog length\n");
}
TxPrintf("Minimum jog length is %d\n", GCRMinJog);
@ -670,7 +670,7 @@ CmdRoute(w, cmd)
{
if(cmd->tx_argc!=3)
goto wrongNumArgs;
if(!sscanf(cmd->tx_argv[2], "%f", &GCRObstDist))
if(sscanf(cmd->tx_argv[2], "%f", &GCRObstDist) != 1)
TxError("Bad value for obstacle constant\n");
}
TxPrintf("Obstacle constant is %f\n", GCRObstDist);
@ -680,7 +680,7 @@ CmdRoute(w, cmd)
{
if(cmd->tx_argc!=3)
goto wrongNumArgs;
if(!sscanf(cmd->tx_argv[2], "%d", &GCRSteadyNet))
if(sscanf(cmd->tx_argv[2], "%d", &GCRSteadyNet) != 1)
TxError("Bad value for steady net constant\n");
}
TxPrintf("Steady net constant is %d\n", GCRSteadyNet);