extract/ExtBasic.c: Incorrect return-value check for a 'scanf'-like function

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

* Create codeql.yml

* Fix code scanning alert no. 149: 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:49:18 +01:00 committed by Tim Edwards
parent 96c7e283c0
commit e66e3b32ad
1 changed files with 8 additions and 8 deletions

View File

@ -427,14 +427,14 @@ extBasic(def, outFile)
case DEV_FET:
/* Read area */
token = strtok(NULL, " ");
if ((token == NULL) || !sscanf(token, "%d", &w))
if ((token == NULL) || (sscanf(token, "%d", &w) != 1))
propfound = FALSE;
else
w *= ExtCurStyle->exts_unitsPerLambda *
ExtCurStyle->exts_unitsPerLambda;
/* Read perimeter */
token = strtok(NULL, " ");
if ((token == NULL) || !sscanf(token, "%d", &l))
if ((token == NULL) || (sscanf(token, "%d", &l) != 1))
propfound = FALSE;
else
l *= ExtCurStyle->exts_unitsPerLambda;
@ -444,13 +444,13 @@ extBasic(def, outFile)
case DEV_BJT:
/* Read width */
token = strtok(NULL, " ");
if ((token == NULL) || !sscanf(token, "%d", &w))
if ((token == NULL) || (sscanf(token, "%d", &w) != 1))
propfound = FALSE;
else
w *= ExtCurStyle->exts_unitsPerLambda;
/* Read length */
token = strtok(NULL, " ");
if ((token == NULL) || !sscanf(token, "%d", &l))
if ((token == NULL) || (sscanf(token, "%d", &l) != 1))
propfound = FALSE;
else
l *= ExtCurStyle->exts_unitsPerLambda;
@ -460,13 +460,13 @@ extBasic(def, outFile)
{
/* Read width */
token = strtok(NULL, " ");
if ((token == NULL) || !sscanf(token, "%d", &w))
if ((token == NULL) || (sscanf(token, "%d", &w) != 1))
propfound = FALSE;
else
w *= ExtCurStyle->exts_unitsPerLambda;
/* Read length */
token = strtok(NULL, " ");
if ((token == NULL) || !sscanf(token, "%d", &l))
if ((token == NULL) || (sscanf(token, "%d", &l) != 1))
propfound = FALSE;
else
l *= ExtCurStyle->exts_unitsPerLambda;
@ -479,14 +479,14 @@ extBasic(def, outFile)
{
/* Read area */
token = strtok(NULL, " ");
if ((token == NULL) || !sscanf(token, "%d", &w))
if ((token == NULL) || (sscanf(token, "%d", &w) != 1))
propfound = FALSE;
else
w *= ExtCurStyle->exts_unitsPerLambda *
ExtCurStyle->exts_unitsPerLambda;
/* Read perimeter */
token = strtok(NULL, " ");
if ((token == NULL) || !sscanf(token, "%d", &l))
if ((token == NULL) || (sscanf(token, "%d", &l) != 1))
propfound = FALSE;
else
l *= ExtCurStyle->exts_unitsPerLambda;