From a504004319b2d42687150cfadbc0fd375c4496b8 Mon Sep 17 00:00:00 2001 From: gingold Date: Tue, 22 Jul 2008 01:31:51 +0000 Subject: Avoid crash when pathes are too long. --- libraries.adb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libraries.adb') diff --git a/libraries.adb b/libraries.adb index f06bd16e5..b52a11da3 100644 --- a/libraries.adb +++ b/libraries.adb @@ -75,8 +75,12 @@ package body Libraries is if Path'Length = 0 then return; end if; - Pathes.Increment_Last; - Pathes.Table (Pathes.Last) := Path_To_Id (Path); + -- Nice message instead of constraint_error. + if Path'Length + 2 >= Name_Buffer'Length then + Error_Msg ("argument of -P is too long"); + return; + end if; + Pathes.Append (Path_To_Id (Path)); end Add_Library_Path; function Get_Nbr_Pathes return Natural is -- cgit v1.2.3