ports/59499: [patch] openFile function opens files for reading and writing instead of reading only
Konstantin Oznobihin
bork at rsu.ru
Thu Nov 20 09:00:42 UTC 2003
>Number: 59499
>Category: ports
>Synopsis: [patch] openFile function opens files for reading and writing instead of reading only
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Nov 20 01:00:33 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Konstantin Oznobihin
>Release: FreeBSD 5.1-RELEASE-p8 i386
>Organization:
Computer Center of Rostov State University
>Environment:
System: FreeBSD 5.1-RELEASE-p8 FreeBSD 5.1-RELEASE-p8 #2: Sat Oct 4 18:24:23 MSD 2003 bork at rsu.ru:/usr/obj/usr/src/sys/KERNEL i386
>Description:
The XMLPlatformUtils::openFile function opens files with fopen and
passes it "r+" string as mode argument. This makes(according to
fopen(3)) it try to open file for reading and writing while it
should be opened for reading only. As a result you can't
work with files not owned by you which is rather common case
for dtd files.
>How-To-Repeat:
Try "SAX2Pint somefile.xml" where somefile.xml belongs to
other user and has access rights rw-r--r--.
>Fix:
Just change mode from "r+" to "r", here is the patch:
--- patch begins here ---
--- xerces-c-src_2_3_0/src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp Wed Nov 12 20:32:33 2003
+++ FreeBSDPlatformUtils.cpp Wed Nov 12 20:31:16 2003
@@ -298,7 +298,7 @@
XMLExcepts::CPtr_PointerIsZero);
const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
- FileHandle retVal = (FileHandle)fopen( tmpFileName , "r+" );
+ FileHandle retVal = (FileHandle)fopen( tmpFileName , "r" );
return retVal;
}
@@ -307,7 +307,7 @@
if (fileName == NULL)
ThrowXML(XMLPlatformUtilsException,
XMLExcepts::CPtr_PointerIsZero);
- FileHandle retVal = (FileHandle)fopen( fileName , "r+" );
+ FileHandle retVal = (FileHandle)fopen( fileName , "r" );
return retVal;
}
--- patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list