From 2c1fcdea4def5a009aa031dfb37326a9db3b22dd Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 20 Jan 2018 07:58:27 +0100 Subject: mcode: assert identifiers don't have embedded NULL. --- src/ortho/mcode/ortho_ident.adb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/ortho') diff --git a/src/ortho/mcode/ortho_ident.adb b/src/ortho/mcode/ortho_ident.adb index 9b5a36ed0..c3990320d 100644 --- a/src/ortho/mcode/ortho_ident.adb +++ b/src/ortho/mcode/ortho_ident.adb @@ -37,9 +37,12 @@ package body Ortho_Ident is begin Start := Strs.Allocate (Str'Length + 1); for I in Str'Range loop + -- Identifiers are NULL terminated, so they cannot have any + -- embedded NULL. + pragma Assert (Str (I) /= ASCII.NUL); Strs.Table (Start + I - Str'First) := Str (I); end loop; - Strs.Table (Start + Str'Length) := ASCII.Nul; + Strs.Table (Start + Str'Length) := ASCII.NUL; Ids.Append (Start); return Ids.Last; end Get_Identifier; -- cgit v1.2.3