Skip to content

Missing Return Statement in Non-Void Function

Description

A non-void function does not have a return statement, resulting in an undefined return value.

Examples

Insecure Code

c
int foo() { }

Secure Code

c
int foo() { return 0; }

Remediation

Add a return statement to the function with a valid return value.

Rule Details

FieldValue
IDCODE-0487
CategoryGeneric
SeverityMEDIUM
CWECWE-393
ConfidenceLOW
ImpactMEDIUM
LikelihoodMEDIUM
ExploitabilityMODERATE
Tags
OWASPN/A

References