mirror of
https://github.com/ipxe/ipxe
synced 2026-02-14 02:31:26 +03:00
[bzimage] Fix parsing of "vga=..." when not at end of command line
bzimage_parse_cmdline() uses strcmp() to identify the named "vga=..." kernel command line option values, which will give a false negative if the option is not last on the command line. Fix by temporarily changing the relevant command line separator (if any) to a NUL terminator. Debugged-by: Simon Rettberg <simon.rettberg@rz.uni-freiburg.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -252,13 +252,17 @@ static void bzimage_update_header ( struct image *image,
|
|||||||
*/
|
*/
|
||||||
static int bzimage_parse_cmdline ( struct image *image,
|
static int bzimage_parse_cmdline ( struct image *image,
|
||||||
struct bzimage_context *bzimg,
|
struct bzimage_context *bzimg,
|
||||||
const char *cmdline ) {
|
char *cmdline ) {
|
||||||
|
char *sep;
|
||||||
char *vga;
|
char *vga;
|
||||||
char *mem;
|
char *mem;
|
||||||
|
|
||||||
/* Look for "vga=" */
|
/* Look for "vga=" */
|
||||||
if ( ( vga = strstr ( cmdline, "vga=" ) ) ) {
|
if ( ( vga = strstr ( cmdline, "vga=" ) ) ) {
|
||||||
vga += 4;
|
vga += 4;
|
||||||
|
sep = strchr ( vga, ' ' );
|
||||||
|
if ( sep )
|
||||||
|
*sep = '\0';
|
||||||
if ( strcmp ( vga, "normal" ) == 0 ) {
|
if ( strcmp ( vga, "normal" ) == 0 ) {
|
||||||
bzimg->vid_mode = BZI_VID_MODE_NORMAL;
|
bzimg->vid_mode = BZI_VID_MODE_NORMAL;
|
||||||
} else if ( strcmp ( vga, "ext" ) == 0 ) {
|
} else if ( strcmp ( vga, "ext" ) == 0 ) {
|
||||||
@@ -267,11 +271,13 @@ static int bzimage_parse_cmdline ( struct image *image,
|
|||||||
bzimg->vid_mode = BZI_VID_MODE_ASK;
|
bzimg->vid_mode = BZI_VID_MODE_ASK;
|
||||||
} else {
|
} else {
|
||||||
bzimg->vid_mode = strtoul ( vga, &vga, 0 );
|
bzimg->vid_mode = strtoul ( vga, &vga, 0 );
|
||||||
if ( *vga && ( *vga != ' ' ) ) {
|
if ( *vga ) {
|
||||||
DBGC ( image, "bzImage %p strange \"vga=\""
|
DBGC ( image, "bzImage %p strange \"vga=\" "
|
||||||
"terminator '%c'\n", image, *vga );
|
"terminator '%c'\n", image, *vga );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( sep )
|
||||||
|
*sep = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look for "mem=" */
|
/* Look for "mem=" */
|
||||||
@@ -522,7 +528,7 @@ static void bzimage_load_initrds ( struct image *image,
|
|||||||
*/
|
*/
|
||||||
static int bzimage_exec ( struct image *image ) {
|
static int bzimage_exec ( struct image *image ) {
|
||||||
struct bzimage_context bzimg;
|
struct bzimage_context bzimg;
|
||||||
const char *cmdline = ( image->cmdline ? image->cmdline : "" );
|
char *cmdline = ( image->cmdline ? image->cmdline : "" );
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Read and parse header from image */
|
/* Read and parse header from image */
|
||||||
|
|||||||
Reference in New Issue
Block a user