This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] fix handling of invalid filespec under VMS


Manually tested under VMS
Tested on i686-linux, committed on mainline.

Decc$translate_vms translates VMS style filespecs into Unix style filespecs.
If a valid VMS style spec has no Unix equivalent then the return value is -1
which if used in an strncpy operation results in an access violation. The
routine now protects against this case and causes Name_Error to be raised.

Here's a small Ada reproducer with no expected output.

with Ada.Text_IO; use Ada.Text_IO;
procedure Tfile is
  FT : File_Type;
begin
  Open (FT, In_File, "sys_root:[...]");
exception
  when Name_Error =>
    null;
end Tfile;

Also, a few windows clean ups:
Directory containing spaces in the PATH will be quoted to be properly
handled by the toolset. When catenating such a path with a filename to
check for the existence of a file we need to remove the quotes.

2005-06-14  Doug Rupp  <rupp@adacore.com>
	    Pascal Obry  <obry@adacore.com>

	* adaint.c (__gnat_to_canonical_file_spec): Check for error returns in
	call to decc$translate_vms.
	(__gnat_locate_regular_file): Check if the path_val contains quotes. We
	need to remove those quotes before catenating the filename.
	(__gnat_locate_exec_on_path): improvements to the Win32 section:
	* avoid allocating the memory twice for better efficiency;
	* allocate 32K buffer for environment expansion as suggested by MSDN;
	* prepend ".;" to the path so that current directory is searched too.

Attachment: difs.9
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]