make: Avoid reading an uninitialized value on empty target names

Fixing this is however only theoretically useful, as:
* no actual code paths can currently lead to it;
* even if the code actually ended up reading the uninitialized value,
  it would still have a fully defined behavior as the result of the
  check is irrelevant in the only case the uninitialized read can
  happen.

Anyway, fix this to avoid any possible bad surprises in the future.
This commit is contained in:
Colomban Wendling 2015-04-07 04:10:10 +02:00
parent 39f359b09a
commit 04c721c3b4

View File

@ -75,7 +75,7 @@ static boolean isSpecialTarget (vString *const name)
{
size_t i = 0;
/* All special targets begin with '.'. */
if (vStringChar (name, i++) != '.') {
if (vStringLength (name) < 1 || vStringChar (name, i++) != '.') {
return FALSE;
}
while (i < vStringLength (name)) {