Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: parameter => argument

When writing a library, each exposed functions should perform a validity check on its argumentsparameters. Validity checks allow the library to survive at least some forms improper usage, enabling an application using the library to likewise survive and often simplifies the task of determining the condition that caused the illegal argumentparameter.

Non-Compliant Coding Example

...

In this non-compliant example, setfile and usefile do not validate their argumentsparameters. It is possible that an invalid file pointer may be used by the library, possibly corrupting the library's internal state and exposing a vulnerability.

...

Compliant Solution

Validating the function arguments parameters and verifying the internal state leads to consistency of program execution and may eliminate potential vulnerabilities, presuming the application using the library properly uses the library.

...