cmwind/CMWcmmnds.c: Incorrect return-value check for a 'scanf'-like function

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

* Create codeql.yml

* Fix code scanning alert no. 134: 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-10-01 12:36:12 -04:00
committed by Tim Edwards
co-authored by Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
parent 886a0212e8
commit c89455782b
+1 -1
View File
@@ -372,7 +372,7 @@ cmwColor(w, cmd)
} }
else if (cmd->tx_argc == 2) else if (cmd->tx_argc == 2)
{ {
if (sscanf(cmd->tx_argv[1], "%i", &color) == 0) if (sscanf(cmd->tx_argv[1], "%i", &color) != 1)
{ {
/* Invalid color---allow keywords "next" and "last" */ /* Invalid color---allow keywords "next" and "last" */
crec = (CMWclientRec *) w->w_clientData; crec = (CMWclientRec *) w->w_clientData;