natFileWin32.cc (isAbsolute): Check path length before looking at any characters.

2003-01-21  Vladimir Puskas  <vpuskas@eunet.yu>

	* java/io/natFileWin32.cc (isAbsolute): Check path length before
	looking at any characters.
	* java/io/natFilePosix.cc (_stat): Only compute `buf' if it will
	be used.
	(isAbsolute): Check path's length as well.

From-SVN: r61566
This commit is contained in:
Vladimir Puskas
2003-01-21 20:45:57 +00:00
committed by Tom Tromey
parent e8e8c1e5e3
commit 691255fb2a
3 changed files with 17 additions and 8 deletions
+3 -2
View File
@@ -1,6 +1,6 @@
// natFileWin32.cc - Native part of File class.
/* Copyright (C) 1998, 1999, 2002 Red Hat, Inc.
/* Copyright (C) 1998, 1999, 2002, 2003 Red Hat, Inc.
This file is part of libgcj.
@@ -119,7 +119,8 @@ java::io::File::getCanonicalPath (void)
jboolean
java::io::File::isAbsolute (void)
{
if (path->charAt(0) == '/' || path->charAt(0) == '\\')
if (path->length() > 0
&& (path->charAt(0) == '/' || path->charAt(0) == '\\'))
return true;
if (path->length() < 3)
return false;