Revision: 5907
http://jnode.svn.sourceforge.net/jnode/?rev=5907&view=rev
Author: galatnm
Date: 2012-08-10 06:19:44 +0000 (Fri, 10 Aug 2012)
Log Message:
-----------
Attempt to strengthen the APM magic checks
Modified Paths:
--------------
trunk/fs/src/fs/org/jnode/partitions/apm/ApmPartitionTable.java
Modified: trunk/fs/src/fs/org/jnode/partitions/apm/ApmPartitionTable.java
===================================================================
--- trunk/fs/src/fs/org/jnode/partitions/apm/ApmPartitionTable.java 2012-08-10 06:13:18 UTC (rev 5906)
+++ trunk/fs/src/fs/org/jnode/partitions/apm/ApmPartitionTable.java 2012-08-10 06:19:44 UTC (rev 5907)
@@ -20,6 +20,7 @@
package org.jnode.partitions.apm;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@@ -84,6 +85,16 @@
if ((first16KiB[0x201] & 0xFF) != 0x4d) {
return false;
}
+
+ byte[] typeBytes = new byte[31];
+ System.arraycopy(first16KiB, 0x230, typeBytes, 0, typeBytes.length);
+ String type = new String(typeBytes, Charset.forName("ASCII")).replace("\u0000", "");
+
+ if (!"Apple_partition_map".equalsIgnoreCase(type))
+ {
+ return false;
+ }
+
return true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|