I've discovered this issue while has been testing GHSA-rcq7-rv5g-j3r4
According to note in ieee1284.c we can give deviceID on input of cfIEEE1284NormalizeMakeModel:
cfIEEE1284NormalizeMakeModel(
640 const char *make_and_model, // I - Original make-and-model string
641 // or device ID
So I've tried it to understand how it works and discovered that if cfIEEE1284NormalizeMakeModel receives the line with empty MFG and MDL on input, it goes to infinite loop. It reproduces even if line has other not empty values, like CMD. My examples are:
"MFG:;MDL:;"
"MFG:;MDL:;CMD:PostScript;"
Loop doesn't reproduce with line:
Both MFG and MDL values should be empty.
I cannot assess a severity of this issue, as I cannot fully understand if using cfIEEE1284NormalizeMakeModel with deviceID is life-case scenario, so advice is appreciated.
Steps to reproduce:
- I've defined function as:
static int
run_device_id_case(const char *device_id)
{
char output[OUTPUT_SIZE];
char *result;
memset(output, 0, sizeof(output));
result = cfIEEE1284NormalizeMakeModel(
device_id,
NULL,
CF_IEEE1284_NORMALIZE_HUMAN,
NULL,
output,
sizeof(output),
NULL,
NULL,
NULL);
if (result == NULL)
printf(" Result: NULL\n");
else
printf(" Result: \"%s\"\n", result);
fflush(stdout);
return 0;
}
- Input data:
static const test_case_t tests[] =
{
{
"Corrupted device_id",
TEST_DEVICE_ID,
"MFG:;MDL:;"
},
- Run test
Result: Function hanged
Expected result: Corrupted data was filtered or function exits with error code
I can attach my script if it'll help to reproduce.
I've discovered this issue while has been testing GHSA-rcq7-rv5g-j3r4
According to note in
ieee1284.cwe can givedeviceIDon input ofcfIEEE1284NormalizeMakeModel:So I've tried it to understand how it works and discovered that if
cfIEEE1284NormalizeMakeModelreceives the line with empty MFG and MDL on input, it goes to infinite loop. It reproduces even if line has other not empty values, like CMD. My examples are:Loop doesn't reproduce with line:
Both MFG and MDL values should be empty.
I cannot assess a severity of this issue, as I cannot fully understand if using
cfIEEE1284NormalizeMakeModelwithdeviceIDis life-case scenario, so advice is appreciated.Steps to reproduce:
Result: Function hanged
Expected result: Corrupted data was filtered or function exits with error code
I can attach my script if it'll help to reproduce.