From 06a42c2e47b395d9fa5b71d509914cafd2d402ab Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Mon, 7 Jul 2003 07:37:34 +0000 Subject: [PATCH] Fix use of uninitialized memory. [SVN r18954] --- historic/jam/src/variable.c | 6 ++++++ jam_src/variable.c | 6 ++++++ 2 files changed, 12 insertions(+) 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. */