Skip to main content

SA0026: Possible truncated strings

Detects string assignments and string initializations that do not use sufficient string length

Justification: When strings of different lengths are assigned, a string could be truncated. This can have unexpected results.

Importance: Medium

Example 38. Example
PROGRAM PLC_PRG
VAR
    strVar1 : STRING[10];
    strVar2 : STRING[6];
    strVar3 : STRING[6] := 'abcdefghi';    // SA0026
END_VAR
strVar2 := strVar1;    // SA0026

Output in the Messages view:

  • sa_icon_message.png SA0026: Truncation of 'abcdefghi'

  • sa_icon_message.png SA0026: Possible truncation of string 'strVar1'



For more information, see: