gspawn-win32: Fix potential integer overflows in argv handling

This can happen if a user passes a ludicrously long string to argv.

Spotted by chamalsl as #YWH-PGM9867-48.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2025-03-30 21:49:05 +01:00
parent 913a1bfd85
commit 3d9cc10330
No known key found for this signature in database
GPG Key ID: C5C42CFB268637CA
2 changed files with 4 additions and 4 deletions

View File

@ -80,8 +80,8 @@ protect_wargv (gint argc,
{
wchar_t *p = wargv[i];
wchar_t *q;
gint len = 0;
gint pre_bslash = 0;
size_t len = 0;
size_t pre_bslash = 0;
gboolean need_dblquotes = FALSE;
while (*p)
{

View File

@ -253,8 +253,8 @@ protect_argv_string (const gchar *string)
{
const gchar *p = string;
gchar *retval, *q;
gint len = 0;
gint pre_bslash = 0;
size_t len = 0;
size_t pre_bslash = 0;
gboolean need_dblquotes = FALSE;
while (*p)
{