Revision: 14703
          http://sourceforge.net/p/edk2/code/14703
Author:   oliviermartin
Date:     2013-09-23 09:41:19 +0000 (Mon, 23 Sep 2013)
Log Message:
-----------
SemihostFs: Fix check for read-only file or file-open

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c

Modified: trunk/edk2/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c
===================================================================
--- trunk/edk2/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c    2013-09-23 
09:40:27 UTC (rev 14702)
+++ trunk/edk2/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c    2013-09-23 
09:41:19 UTC (rev 14703)
@@ -345,7 +345,8 @@
   Fcb = SEMIHOST_FCB_FROM_THIS(File);
 
   // We cannot write a read-only file
-  if (Fcb->OpenMode & EFI_FILE_READ_ONLY) {
+  if ((Fcb->Info.Attribute & EFI_FILE_READ_ONLY)
+      || !(Fcb->OpenMode & EFI_FILE_MODE_WRITE)) {
     return EFI_ACCESS_DENIED;
   }
 
@@ -567,7 +568,8 @@
   if (Fcb->IsRoot) {
     return EFI_SUCCESS;
   } else {
-    if (Fcb->Info.Attribute & EFI_FILE_READ_ONLY) {
+    if ((Fcb->Info.Attribute & EFI_FILE_READ_ONLY)
+        || !(Fcb->OpenMode & EFI_FILE_MODE_WRITE)) {
       return EFI_ACCESS_DENIED;
     } else {
       return EFI_SUCCESS;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to