계: Code Quality

코드 품질이 낮으면 예측할 수 없는 동작이 발생합니다. 사용자 입장에서는 사용 편의성이 떨어지는 것으로 나타나는 경우가 많습니다. 공격자에게는 예상치 못한 방법으로 시스템에 부담을 줄 수 있는 기회가 됩니다.

Code Correctness: Function Not Invoked

Abstract
마지막 괄호가 없기 때문에 이 식은 함수의 반환 값이 아닌 함수 포인터의 값을 참조합니다.
Explanation
이 표현식은 함수의 반환 값보다 함수 포인터를 참조하므로 항상 null이 아닙니다.

예제 1: 다음과 같은 조건절은 작동하지 않습니다. 조건부 getChunk == NULLgetChunk이 프로그램에 정의된 함수의 이름이므로 항상 false가 됩니다.


if (getChunk == NULL)
return ERR;
References
[1] Standards Mapping - Common Weakness Enumeration CWE ID 398
[2] Standards Mapping - Motor Industry Software Reliability Association (MISRA) C Guidelines 2023 Rule 2.1, Rule 2.2
[3] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.6
[4] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.6
[5] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.6
[6] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.6
[7] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[8] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection
[9] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection
[10] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3050 CAT II
[11] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3050 CAT II
[12] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3050 CAT II
[13] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3050 CAT II
[14] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3050 CAT II
[15] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3050 CAT II
[16] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3050 CAT II
desc.structural.cpp.code_correctness_function_not_invoked