diff options
author | Taylor R Campbell <campbell+ledger@mumble.net> | 2024-04-27 19:54:23 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2024-08-06 14:51:38 -1000 |
commit | d9967c2638052730c6eeb1624586d633d6482003 (patch) | |
tree | f6dd9d0a94cc633f4e1a4f0588c2cb613e0100e2 /src/strptime.cc | |
parent | 762353945a744ae4b89970b9e08c2c22a52ddbff (diff) | |
download | fork-ledger-d9967c2638052730c6eeb1624586d633d6482003.tar.gz fork-ledger-d9967c2638052730c6eeb1624586d633d6482003.tar.bz2 fork-ledger-d9967c2638052730c6eeb1624586d633d6482003.zip |
Avoid ctype abuse.
fix https://github.com/ledger/ledger/issues/2338
fix https://github.com/ledger/ledger/issues/2340
Diffstat (limited to 'src/strptime.cc')
-rw-r--r-- | src/strptime.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/strptime.cc b/src/strptime.cc index d390d1fa..77593665 100644 --- a/src/strptime.cc +++ b/src/strptime.cc @@ -62,7 +62,9 @@ static const char* kMonthAbbr[] = { static const char* _parse_num(const char* s, int low, int high, int* value) { const char* p = s; - for (*value = 0; *p != NULL && isdigit(*p); ++p) { + for (*value = 0; + *p != NULL && isdigit(static_cast<unsigned char>(*p)); + ++p) { *value = (*value) * 10 + static_cast<int>(*p) - static_cast<int>('0'); } @@ -177,7 +179,7 @@ static char* _strptime(const char *s, const char *format, struct tm *tm) { // arbitrary whitespace. case 't': case 'n': - while (isspace(*s)) ++s; + while (isspace(static_cast<unsigned char>(*s))) ++s; break; // '%'. |