[syslinux] [PATCH 0/5] fix installer issues and enable some MSVC compatibility

Pete Batard pete at akeo.ie
Wed Feb 24 05:02:12 PST 2016


Hi,

As I am embedding part of the Syslinux code in Rufus [1], I have 
encountered various issues that I would like to see addressed, so that I 
can keep most of my code in sync with the official mainline. Some of 
these fixes have to do with being more friendly with MSVC compilation, 
and other are fixes for actual Syslinux issues, that Rufus users have 
encountered.

For convenience, the individual description of each patch is gathered below:

o [PATCH 1/5] fat: fix minfatsize for large FAT32:
When trying to installing Syslinux on a FAT32 drive formatted using 
Ridgecrop's Large FAT32 formatting tool [2], the installer will bail due 
to the minfatsize check, as there is an extra sector being used. This 
fix addresses that.

o [PATCH 2/5] ntfs: remove unused variable and have ntfssect use char
The variable 'ok' is never used and generates a warning. Remove it. Also 
ntfssect.c is designed to be compiled in non Unicode mode when using 
MSVC compilers, so remove all ambiguity about it (LPCTSTR -> LPCSTR, use 
of 'A' API calls) so that it doesn't break when compiled in Unicode 
mode, which is what Rufus uses with MSVC.

o [PATCH 3/5] installers: MSVC compatibility fixes
More MSVC compatibility fixes, for packed structures.
NB: In case you are aware of the issues that may come with MS vs GCC 
packing, so far, I have not seen evidence of detrimental impact from 
using ms_struct packing in MSVC (vs gcc_struct, which is explicitly 
specified for MinGW), with regards to the sections of code I am using in 
Rufus.

o [PATCH 4/5] installers: fix a possible buffer overflow when looking 
for LDLINUX_MAGIC
If the ldlinux being processed is garbage, the search for LDLINUX_MAGIC 
will overflow its buffer - fix that.
I encountered this issue in Rufus as, due to notorious incompatibilities 
between different versions of ldlinux.sys and the com32's residing on an 
ISO (NB: 6.03 pre has been a nightmare in that respect [3]), we download 
a version specific ldlinux.sys from our server... which may get trashed 
if the user sits behind one of these corporate firewalls that modifies 
the download payload and replaces it with something like "You are not 
authorized to download this file"...

o [PATCH 5/5] installers: fix a MinGW redefinition warning
I get a redefinition warning on _GNU_SOURCE when compiling with MinGW, 
and while I could see that this #define was introduced in e4fc44 [4], 
but the reason to introduce it is not mentioned, and I can't really see 
a good reason to have it, especially as MSVC will happily compile that 
source. So far I have found no evidence that _GNU_SOURCE applies to 
memset/memmove/memcpy, which are the only calls I see in there that I 
could see impacted. Besides, for obvious compatibility reasons, I would 
advocate using -D_GNU_SOURCE as a compiler option if one really needs 
it, rather than have it in a source.

Regards,

/Pete

[1] https://github.com/pbatard/rufus/tree/master/src/syslinux
[2] http://www.ridgecrop.demon.co.uk/index.htm?fat32format.htm
[3] http://rufus.akeo.ie/files/syslinux-6.03/
[4] 
https://github.com/geneC/syslinux/commit/e4fc443f9b70f188963ff33e0a16ccb72a553540


More information about the Syslinux mailing list