rspec/rules/S3921/cobol/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

54 lines
918 B
Plaintext

== Why is this an issue?
Moving a large string into a small field will result in data truncation with data lost from the right side of the string.
=== Noncompliant code example
[source,cobol]
----
01 ALPHA PIC X(4).
*> ...
MOVE "Now is the time" TO ALPHA *> Noncompliant. Becomes "Now "
----
=== Compliant solution
[source,cobol]
----
01 ALPHA PIC X(15).
*> ...
MOVE "Now is the time" TO ALPHA
----
== Resources
* https://cwe.mitre.org/data/definitions/704[MITRE, CWE-704] - Incorrect Type Conversion or Cast
=== Related rules
* S1967 - for truncation of numeric values
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../parameters.adoc[]
include::../highlighting.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]