gcr/gcrDebug.c: Incorrect return-value check for a 'scanf'-like function
Fix code scanning alert no. 137: Incorrect return-value check for a 'scanf'-like function (#9) * Create codeql.yml * Fix code scanning alert no. 137: 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:
parent
4ca98dc31b
commit
96c7e283c0
|
|
@ -978,8 +978,12 @@ gcrShowMap(ch)
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
TxPrintf("Field selector (0 terminates): ");
|
TxPrintf("Field selector (0 terminates): ");
|
||||||
if(!scanf("%d", &field)) /*typed something funny*/
|
if(scanf("%d", &field) != 1) /*typed something funny or EOF*/
|
||||||
{
|
{
|
||||||
|
if (feof(stdin)) {
|
||||||
|
TxPrintf("End of input detected. Terminating.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
TxPrintf("Bad input. Legal responses are\n");
|
TxPrintf("Bad input. Legal responses are\n");
|
||||||
TxPrintf(" GCRBLKM 1\n");
|
TxPrintf(" GCRBLKM 1\n");
|
||||||
TxPrintf(" GCRBLKP 2\n");
|
TxPrintf(" GCRBLKP 2\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue