extlinux: remove wrong use of strstr() syslinux-4.05-pre4
authorPaulo Alcantara <pcacjr@gmail.com>
Tue, 5 Jul 2011 22:12:24 +0000 (22:12 +0000)
committerPaulo Alcantara <pcacjr@gmail.com>
Tue, 5 Jul 2011 22:12:24 +0000 (22:12 +0000)
strstr() is only used for zero-terminated strings, so OEM Name is not
guaranteed to be zero-terminated. Instead, use fat_check_sb_fields() to
sanity check FAT superblock.

Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
extlinux/main.c

index 6aa6202..26dba7b 100755 (executable)
@@ -347,9 +347,7 @@ int install_bootblock(int fd, const char *device)
                perror("reading fat superblock");
                return 1;
        }
-       if (sb3.bsResSectors && sb3.bsFATs &&
-           (strstr(sb3.bs16.FileSysType, "FAT") ||
-            strstr(sb3.bs32.FileSysType, "FAT")))
+       if (fat_check_sb_fields(&sb3))
                ok = true;
     }
     if (!ok) {