This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Two natFile.cc questions
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Discuss List <java at gcc dot gnu dot org>
- Date: 02 Feb 2002 01:11:03 -0700
- Subject: Two natFile.cc questions
- Reply-to: tromey at redhat dot com
Right now natFile.cc has code like this throughout:
char buf[MAXPATHLEN];
jsize total = JvGetStringUTFRegion (path, 0, path->length(), buf);
buf[total] = '\0';
This is pretty bad. What if the UTF-8 encoded `path' is longer than
MAXPATHLEN? Security hole!
I was about to fix this when I thought: maybe we should take this
opportunity to use `file.encoding' as the encoding for file names.
However, I'm reluctant to do this without knowing whether it is really
the correct thing to do. Does anyone have a definitive answer?
Tom