1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-30 16:51:41 +00:00

Make sure the length variable is initialized to 0 before passing

it to Var_Parse().

Patch:		7.85

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
This commit is contained in:
Hartmut Brandt 2005-03-01 17:52:18 +00:00
parent b8a4edc17e
commit 41664cddcd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=142937
5 changed files with 18 additions and 12 deletions

View File

@ -170,7 +170,7 @@ Arch_ParseArchive(char **linePtr, Lst *nodeLst, GNode *ctxt)
* Variable spec, so call the Var module to parse the
* puppy so we can safely advance beyond it...
*/
size_t length;
size_t length = 0;
Boolean freeIt;
char *result;
@ -222,7 +222,7 @@ Arch_ParseArchive(char **linePtr, Lst *nodeLst, GNode *ctxt)
* parse the puppy so we can safely advance
* beyond it...
*/
size_t length;
size_t length = 0;
Boolean freeIt;
char *result;

View File

@ -234,7 +234,7 @@ CondGetArg(char **linePtr, char **argPtr, const char *func, Boolean parens)
* though perhaps we should...
*/
char *cp2;
size_t len;
size_t len = 0;
Boolean doFree;
cp2 = Var_Parse(cp, VAR_CMD, TRUE, &len, &doFree);
@ -518,7 +518,7 @@ CondToken(Boolean doEval)
char *lhs;
char *rhs;
const char *op;
size_t varSpecLen;
size_t varSpecLen = 0;
Boolean doFree;
/*
@ -630,8 +630,8 @@ CondToken(Boolean doEval)
cp++;
Buf_AddByte(buf, (Byte)*cp);
} else if (*cp == '$') {
size_t len;
Boolean freeIt;
size_t len = 0;
Boolean freeIt;
cp2 = Var_Parse(cp, VAR_CMD, doEval, &len, &freeIt);
if (cp2 != var_Error) {
@ -682,7 +682,7 @@ CondToken(Boolean doEval)
if (*CondCvtArg(lhs, &left) != '\0')
goto do_string_compare;
if (*rhs == '$') {
size_t len;
size_t len = 0;
Boolean freeIt;
string = Var_Parse(rhs, VAR_CMD, doEval, &len, &freeIt);
@ -803,9 +803,9 @@ CondToken(Boolean doEval)
* Use Var_Parse to parse the spec in parens and return
* True if the resulting string is empty.
*/
size_t length;
Boolean doFree;
char *val;
size_t length;
Boolean doFree;
char *val;
condExpr += 5;
@ -815,6 +815,7 @@ CondToken(Boolean doEval)
continue;
if (condExpr[arglen] != '\0') {
length = 0;
val = Var_Parse(&condExpr[arglen - 1], VAR_CMD,
FALSE, &length, &doFree);
if (val == var_Error) {

View File

@ -710,7 +710,7 @@ ParseDoDependency(char *line)
* no errors in this, as they would have been discovered
* in the initial Var_Subst and we wouldn't be here.
*/
size_t length;
size_t length = 0;
Boolean freeIt;
char *result;

View File

@ -1365,7 +1365,7 @@ SuffExpandChildren(void *cgnp, void *pgnp)
* to find the end so we can skip over it.
*/
char *junk;
size_t len;
size_t len = 0;
Boolean doFree;
junk = Var_Parse(cp, pgn, TRUE, &len, &doFree);

View File

@ -731,6 +731,7 @@ VarGetPattern(GNode *ctxt, int err, char **tstr, int delim, int *flags,
* delimiter, assume it's a variable
* substitution and recurse.
*/
len = 0;
cp2 = Var_Parse(cp, ctxt, err, &len, &freeIt);
Buf_Append(buf, cp2);
if (freeIt)
@ -1028,6 +1029,7 @@ ParseModifier(const char input[], char tstr[],
size_t len;
Boolean freeIt;
len = 0;
cp2 = Var_Parse(cp, ctxt, err, &len, &freeIt);
Buf_Append(buf, cp2);
if (freeIt) {
@ -1092,6 +1094,7 @@ ParseModifier(const char input[], char tstr[],
size_t len;
Boolean freeIt;
len = 0;
cp2 = Var_Parse(cp, ctxt, err, &len, &freeIt);
Buf_Append(buf, cp2);
cp += len - 1;
@ -1528,6 +1531,7 @@ VarParseLong(char foo[], GNode *ctxt, Boolean err, size_t *lengthPtr,
Boolean rfree;
char *rval;
rlen = 0;
rval = Var_Parse(tstr, ctxt, err, &rlen, &rfree);
if (rval == var_Error) {
Fatal("Error expanding embedded variable.");
@ -1920,6 +1924,7 @@ Var_Subst(const char *var, char *str, GNode *ctxt, Boolean undefErr)
continue;
}
length = 0;
val = Var_Parse(str, ctxt, undefErr, &length, &doFree);
/*