commit 7646d7372e4d21893f75e1111d86a39a842d9a81
Author: Turo Lamminen <turol@iki.fi>
AuthorDate: Mon Feb 1 15:34:00 2021 +0200
Commit: Turo Lamminen <turol@iki.fi>
CommitDate: Tue Aug 24 18:11:02 2021 +0300
Store new strings in argv instead of direct pointers to response file buffer
---
src/m_argv.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/m_argv.c b/src/m_argv.c
index 9be17dae..6b605e9d 100644
--- a/src/m_argv.c
+++ b/src/m_argv.c
@@ -159,10 +159,11 @@ static void LoadResponseFile(int argv_index, const char *filename)
if (infile[k] == '\"')
{
+ char *argstart;
// Skip the first character(")
++k;
- newargv[newargc++] = &infile[k];
+ argstart = &infile[k];
// Read all characters between quotes
@@ -181,12 +182,14 @@ static void LoadResponseFile(int argv_index, const char *filename)
infile[k] = '\0';
++k;
+ newargv[newargc++] = M_StringDuplicate(argstart);
}
else
{
+ char *argstart;
// Read in the next argument until a space is reached
- newargv[newargc++] = &infile[k];
+ argstart = &infile[k];
while(k < size && !isspace(infile[k]))
{
@@ -198,6 +201,7 @@ static void LoadResponseFile(int argv_index, const char *filename)
infile[k] = '\0';
++k;
+ newargv[newargc++] = M_StringDuplicate(argstart);
}
}