Back

LL076

String index without length check

Object Pascal — Delphi & Free Pascal
Warning
Reliability

Indexing a string without a Length guard risks an index-out-of-range exception at runtime

indexing a string without a Length guard risks an index-out-of-range exception at runtime.

Why this severity

indexing a string without a Length guard risks an index-out-of-range exception at runtime.


Known false positives

code where the string length is guaranteed by prior validation or protocol constraints.

Remediation example

if Length(S) >= 3 then
  C := S[3];

Reconnecting… Connection lost. Reload