2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

Added explicit checking for too long command-line arguments for running directly using the CreateProcessA() API.

[SVN r79000]
This commit is contained in:
Jurko Gospodnetić
2012-06-19 00:55:44 +00:00
parent d8399d398e
commit cc90cd9341

View File

@@ -445,6 +445,20 @@ void exec_cmd
}
string_copy( &cmdtab[ slot ].command, command_orig );
/* CreateProcessA() Windows API places a limit of 32768 characters
* (bytes) on the allowed command-line length, including a trailing
* Unicode (2-byte) nul-terminator character.
*/
#define MAX_RAW_COMMAND_LENGTH 32766
printf("...strlen:%d/%d...max:%d...\n", strlen(command_local.value), command_local.size, MAX_RAW_COMMAND_LENGTH);
if ( command_local.size > MAX_RAW_COMMAND_LENGTH )
{
printf( "Command line too long (%d characters). Maximum executable "
"command-line length is %d.", command_local.size,
MAX_RAW_COMMAND_LENGTH );
exit( EXITBAD );
}
/* Create output buffers. */
string_new( &cmdtab[ slot ].buffer_out );
string_new( &cmdtab[ slot ].buffer_err );