From 08d1ff5df0047be7012875ca88cc64e4f205b7c3 Mon Sep 17 00:00:00 2001 From: "Mark Landis (N6AZX)" Date: Tue, 27 Dec 2022 15:04:09 -0800 Subject: [PATCH] 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. --- src/cdmriddir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cdmriddir.cpp b/src/cdmriddir.cpp index 5d62db3..efad32f 100644 --- a/src/cdmriddir.cpp +++ b/src/cdmriddir.cpp @@ -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;