Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F101970150
D34699.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D34699.diff
View Options
diff --git a/usr.sbin/fstyp/msdosfs.c b/usr.sbin/fstyp/msdosfs.c
--- a/usr.sbin/fstyp/msdosfs.c
+++ b/usr.sbin/fstyp/msdosfs.c
@@ -41,6 +41,24 @@
#define LABEL_NO_NAME "NO NAME "
+/*
+ * XXX the signature 0x55 0xAA as the last two bytes of 512 is not required
+ * by specifications, but was historically required by fstyp. This check
+ * should be removed, with a more comprehensive BPB validation instead.
+ */
+static bool
+check_signature(uint8_t sector0[512])
+{
+ /* Check for the FAT boot sector signature. */
+ if (sector0[510] == 0x55 && sector0[511] == 0xaa)
+ return (true);
+ /* Special case for Raspberry Pi Nano bootloader. */
+ if (sector0[510] == 0 && sector0[511] == 0 &&
+ sector0[0] == 0xeb && sector0[1] == 0x3c && sector0[2] == 0x90)
+ return (true);
+ return (false);
+}
+
int
fstyp_msdosfs(FILE *fp, char *label, size_t size)
{
@@ -58,8 +76,7 @@
if (sector0 == NULL)
return (1);
- /* Check for the FAT boot sector signature. */
- if (sector0[510] != 0x55 || sector0[511] != 0xaa) {
+ if (!check_signature(sector0)) {
goto error;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 6, 11:21 PM (21 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14501687
Default Alt Text
D34699.diff (1 KB)
Attached To
Mode
D34699: fstyp: detect Raspberry Pi Pico boot filesystem as FAT
Attached
Detach File
Event Timeline
Log In to Comment