Gene Cumm
2013-Feb-06 04:47 UTC
[syslinux] Syslinux-5.01 cmd.c32 broken: __com32 undefined
Rather than acting like a typical C program using argc/argv, cmd.c32 uses __com32.cs_cmdline to retrieve what's passed to it. meminfo.c32 uses __intcall() which in the library calls __com32.cs_intcall(). Is __com32 only exposed for library functions or is there something else missing in here? Should accessing __com32.cs_cmdline be abstracted via a function call for protection? Should cmd.c32 use argc/argv instead? If we were to abstract/protect via a function call, I'd expect the call to use strncpy/memcpy and be like: char *get_cmdline(char *dest, size_t n) or if only for abstraction char *get_cmdline(void) -- -Gene
H. Peter Anvin
2013-Feb-06 17:43 UTC
[syslinux] Syslinux-5.01 cmd.c32 broken: __com32 undefined
On 02/05/2013 08:47 PM, Gene Cumm wrote:> Rather than acting like a typical C program using argc/argv, cmd.c32 > uses __com32.cs_cmdline to retrieve what's passed to it. meminfo.c32 > uses __intcall() which in the library calls __com32.cs_intcall(). Is > __com32 only exposed for library functions or is there something else > missing in here? Should accessing __com32.cs_cmdline be abstracted > via a function call for protection? Should cmd.c32 use argc/argv > instead?Well, __com32 is gone; it was an implementation detail for the older versions.> If we were to abstract/protect via a function call, I'd expect the > call to use strncpy/memcpy and be like: > > char *get_cmdline(char *dest, size_t n) > > or if only for abstraction > > char *get_cmdline(void)Being able to get the raw command line rather than the parsed (argc/argv) command line might be a good thing. If so, we probably would just export it as something like: const char *cmdline(void); -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.