diff --git a/historic/jam/src/variable.c b/historic/jam/src/variable.c index 36647e973..1399723b0 100644 --- a/historic/jam/src/variable.c +++ b/historic/jam/src/variable.c @@ -203,6 +203,12 @@ var_string( *out++ = *in++; } + /* Add zero to 'out' so that 'lastword' is correctly zero-terminated. */ + if (out >= oute) + return -1; + /* Don't increment, intentionally. */ + *out= '\0'; + /* If a variable encountered, expand it and and embed the */ /* space-separated members of the list in the output. */ diff --git a/jam_src/variable.c b/jam_src/variable.c index 36647e973..1399723b0 100644 --- a/jam_src/variable.c +++ b/jam_src/variable.c @@ -203,6 +203,12 @@ var_string( *out++ = *in++; } + /* Add zero to 'out' so that 'lastword' is correctly zero-terminated. */ + if (out >= oute) + return -1; + /* Don't increment, intentionally. */ + *out= '\0'; + /* If a variable encountered, expand it and and embed the */ /* space-separated members of the list in the output. */