author | erik <erik> | 2007-01-26 20:30:32 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-26 20:30:32 (UTC) |
commit | f77da1ae08512b02a3c50a124f823ed77e53dd64 (patch) (side-by-side diff) | |
tree | ac7e414aff95348e0bf2fba3f45b2a06a4eb4623 /core/apps | |
parent | 4688f98202f590ec6af6c2e66a49dd2f80536083 (diff) | |
download | opie-f77da1ae08512b02a3c50a124f823ed77e53dd64.zip opie-f77da1ae08512b02a3c50a124f823ed77e53dd64.tar.gz opie-f77da1ae08512b02a3c50a124f823ed77e53dd64.tar.bz2 |
Both packageslave.cpp and textedit.cpp have instances of possibly exploitable
race conditions associated to files. The big deal is that it is quite typical
to use strings of pathnames to track files. But because that does not leverage
the filesystem would be attackers may be able to exploit time lags in uses
of filesystem functions (like stat and chmod or open) to get files with
suspect data into the files that the applications are working with.
This commit closes that potential hole even though there are no known exploits.
Better safe then sorry. There is no change in the behavior of the apps.
-rw-r--r-- | core/apps/textedit/textedit.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp index 4bbc62b..1c81a55 100644 --- a/core/apps/textedit/textedit.cpp +++ b/core/apps/textedit/textedit.cpp @@ -788,3 +788,2 @@ bool TextEdit::save() { } - name = currentFileName; if(doc) { @@ -809,3 +808,4 @@ bool TextEdit::save() { mode_t mode; - stat(file.latin1(), &buf); + QFile f(file); + fstat(f.handle(), &buf); mode = buf.st_mode; @@ -821,3 +821,2 @@ bool TextEdit::save() { odebug << "regular save file" << oendl; - QFile f(file); if( f.open(IO_WriteOnly)) { @@ -829,3 +828,2 @@ bool TextEdit::save() { } - } @@ -837,4 +835,3 @@ bool TextEdit::save() { - - chmod( file.latin1(), mode); + fchmod( f.handle(), mode); } |