mirror of
https://github.com/LX3JL/xlxd.git
synced 2025-12-06 07:42:01 +01:00
isdigit() may return any non-zero result for success
POSIX states that the return value of isdigit(): "shall return non-zero if c is a decimal digit; otherwise, they shall return 0." Thus the form: ok &= isdigit(x) is invalid since the runtime is not required to return 1. This bug was observed on Debian 11 while using the clang toolchain. In that environment, isdigit() returns 2048 for a positive match.
This commit is contained in:
parent
6752c7b254
commit
08d1ff5df0
|
|
@ -152,7 +152,7 @@ bool CDmridDir::IsValidDmrid(const char *sz)
|
|||
ok = true;
|
||||
for ( size_t i = 0; (i < n) && ok; i++ )
|
||||
{
|
||||
ok &= ::isdigit(sz[i]);
|
||||
ok = ::isdigit(sz[i]);
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
|
|
|
|||
Loading…
Reference in a new issue