[syslinux:lwip] extlinux: remove wrong use of strstr()

syslinux-bot for Paulo Alcantara pcacjr at gmail.com
Wed Jul 6 10:45:13 PDT 2011


Commit-ID:  c2d4f9b611c43697e889d991d8a4edea92ef2d76
Gitweb:     http://syslinux.zytor.com/commit/c2d4f9b611c43697e889d991d8a4edea92ef2d76
Author:     Paulo Alcantara <pcacjr at gmail.com>
AuthorDate: Tue, 5 Jul 2011 22:12:24 +0000
Committer:  Paulo Alcantara <pcacjr at gmail.com>
CommitDate: Tue, 5 Jul 2011 22:12:24 +0000

extlinux: remove wrong use of strstr()

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 at gmail.com>


---
 extlinux/main.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/extlinux/main.c b/extlinux/main.c
index 6aa6202..26dba7b 100755
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -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) {



More information about the Syslinux-commits mailing list