mirror of https://github.com/ipxe/ipxe.git
[cmdline] Remove arbitrary limit on the length of image command lines
parent
031b30898a
commit
4c85017968
|
@ -49,17 +49,26 @@ enum image_action {
|
||||||
*/
|
*/
|
||||||
static int imgfill_cmdline ( struct image *image, unsigned int nargs,
|
static int imgfill_cmdline ( struct image *image, unsigned int nargs,
|
||||||
char **args ) {
|
char **args ) {
|
||||||
char buf[256];
|
size_t len;
|
||||||
size_t used = 0;
|
unsigned int i;
|
||||||
|
|
||||||
memset ( buf, 0, sizeof ( buf ) );
|
/* Determine total length of command line */
|
||||||
while ( ( used < sizeof ( buf ) ) && nargs-- ) {
|
len = 1; /* NUL */
|
||||||
used += snprintf ( &buf[used], ( sizeof ( buf ) - used ),
|
for ( i = 0 ; i < nargs ; i++ )
|
||||||
" %s", *(args++) );
|
len += ( 1 /* space */ + strlen ( args[i] ) );
|
||||||
}
|
|
||||||
|
{
|
||||||
|
char buf[len];
|
||||||
|
char *ptr = buf;
|
||||||
|
|
||||||
|
/* Assemble command line */
|
||||||
|
for ( i = 0 ; i < nargs ; i++ )
|
||||||
|
ptr += sprintf ( ptr, " %s", args[i] );
|
||||||
|
assert ( ptr == ( buf + len - 1 ) );
|
||||||
|
|
||||||
return image_set_cmdline ( image, &buf[1] );
|
return image_set_cmdline ( image, &buf[1] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "imgfetch"/"module"/"kernel" command syntax message
|
* "imgfetch"/"module"/"kernel" command syntax message
|
||||||
|
|
Loading…
Reference in New Issue