{"@ID": "1116", "@Name": "Inaccurate Source Code Comments", "@Abstraction": "Base", "@Structure": "Simple", "@Status": "Incomplete", "Description": "The source code contains comments that do not accurately\n\t\t\t\t\tdescribe or explain aspects of the portion of the code with which the comment is\n\t\t\t\t\tassociated.", "Extended_Description": {"xhtml:p": [null, null]}, "Related_Weaknesses": {"Related_Weakness": {"@Nature": "ChildOf", "@CWE_ID": "1078", "@View_ID": "1000", "@Ordinal": "Primary"}}, "Weakness_Ordinalities": {"Weakness_Ordinality": {"Ordinality": "Indirect"}}, "Applicable_Platforms": {"Language": {"@Class": "Not Language-Specific", "@Prevalence": "Undetermined"}}, "Modes_Of_Introduction": {"Introduction": {"Phase": "Implementation"}}, "Common_Consequences": {"Consequence": [{"Scope": "Other", "Impact": "Reduce Maintainability", "Note": "This issue makes it more difficult to maintain the product, which indirectly affects security by making it more difficult or time-consuming to find and/or fix vulnerabilities.  It also might make it easier to introduce vulnerabilities."}, {"Scope": "Other", "Impact": "Increase Analytical Complexity", "Note": "When a comment does not accurately reflect the associated code elements, this can introduce confusion to a reviewer (due to inconsistencies) or make it more difficult and less efficient to validate that the code is implementing the intended behavior correctly."}]}, "Potential_Mitigations": {"Mitigation": {"Phase": "Implementation", "Description": "Verify that each comment accurately reflects what is intended to happen during execution of the code."}}, "Demonstrative_Examples": {"Demonstrative_Example": {"Intro_Text": "In the following Java example the code performs a calculation to determine how much medicine to administer. A comment is provided to give insight into what the calculation shoud be doing. Unfortunately the comment does not match the actual code and thus leaves the reader to wonder which is correct.", "Example_Code": [{"@Nature": "Bad", "@Language": "Java", "xhtml:br": null, "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": {"@style": "margin-left:1em;", "xhtml:br": [null, null, null, null, null, null], "#text": "int pt_weight = 83;\n\t\t     int mg_per_kg = 3;\n\t\t     int daily_dose = 0;\n\t\t     \n\t\t     // Add the patient weight and Mg/Kg to calculate the correct daily dose\n\t\t     daily_dose = pt_weight * mg_per_kg;\n                     return dosage;"}, "#text": "public static void main(String[] args) {\n                   \n                   }"}, "#text": "public class Main {\n                 \n                 }"}, {"@Nature": "Good", "@Language": "Java", "xhtml:br": null, "xhtml:div": {"@style": "margin-left:1em;", "xhtml:div": {"@style": "margin-left:1em;", "xhtml:br": [null, null, null, null, null, null], "#text": "int pt_weight = 83;\n\t\t     int mg_per_kg = 3;\n\t\t     int daily_dose = 0;\n\t\t     \n\t\t     // Multiply the patient weight and Mg/Kg to calculate the correct daily dose\n\t\t     daily_dose = pt_weight * mg_per_kg;\n                     return dosage;"}, "#text": "public static void main(String[] args) {\n                   \n                   }"}, "#text": "public class Main {\n                 \n                 }"}], "Body_Text": ["In the correction below, the code functionality has been verified, and the comment has been corrected to reflect the proper calculation.", "Note that in real-world code, these values should be validated to disallow negative numbers, prevent integer overflow, etc."]}}, "References": {"Reference": {"@External_Reference_ID": "REF-963"}}, "Mapping_Notes": {"Usage": "Allowed", "Rationale": "This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.", "Comments": "Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.", "Reasons": {"Reason": {"@Type": "Acceptable-Use"}}}, "Content_History": {"Submission": {"Submission_Name": "CWE Content Team", "Submission_Organization": "MITRE", "Submission_Date": "2018-07-02", "Submission_Version": "3.2", "Submission_ReleaseDate": "2019-01-03", "Submission_Comment": "Entry derived from Common Quality Enumeration (CQE) Draft 0.9."}, "Modification": [{"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2020-02-24", "Modification_Version": "4.0", "Modification_ReleaseDate": "2020-02-24", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2022-10-13", "Modification_Version": "4.9", "Modification_ReleaseDate": "2022-10-13", "Modification_Comment": "updated Applicable_Platforms, Demonstrative_Examples, Potential_Mitigations"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-01-31", "Modification_Version": "4.10", "Modification_ReleaseDate": "2023-01-31", "Modification_Comment": "updated Description"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-04-27", "Modification_Version": "4.11", "Modification_ReleaseDate": "2023-04-27", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-06-29", "Modification_Version": "4.12", "Modification_ReleaseDate": "2023-06-29", "Modification_Comment": "updated Mapping_Notes"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2025-12-11", "Modification_Version": "4.19", "Modification_ReleaseDate": "2025-12-11", "Modification_Comment": "updated Common_Consequences, Description, Name, Time_of_Introduction"}], "Contribution": {"@Type": "Content", "Contribution_Name": "Drew Buttner", "Contribution_Organization": "MITRE", "Contribution_Date": "2022-08-15", "Contribution_Comment": "Suggested new demonstrative examples, mitigations, and applicable platforms."}, "Previous_Entry_Name": {"@Date": "2025-12-11", "#text": "Inaccurate Comments"}}}
