commit 5ee33091fbaa341b6c86fcf65d4069b6fcf02111
parent 0c25f932d2bb89aa8bc778f0d493debe2f239cf3
Author: Drew DeVault <sir@cmpwn.com>
Date: Mon, 14 May 2018 18:21:52 -0400
Enforce isalnum/isdigit receive ASCII characters
Fixes https://todo.sr.ht/~sircmpwn/scdoc/13
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main.c b/src/main.c
@@ -15,7 +15,7 @@ static int parse_section(struct parser *p) {
str_t *section = str_create();
uint32_t ch;
while ((ch = parser_getch(p)) != UTF8_INVALID) {
- if (isdigit(ch)) {
+ if (ch < 0x80 && isdigit(ch)) {
assert(str_append_ch(section, ch) != -1);
} else if (ch == ')') {
if (!section->str) {
@@ -47,7 +47,7 @@ static void parse_preamble(struct parser *p) {
struct tm *now_tm = localtime(&now);
strftime(date, sizeof(date), "%F", now_tm);
while ((ch = parser_getch(p)) != UTF8_INVALID) {
- if (isalnum(ch)) {
+ if (ch < 0x80 && isalnum(ch)) {
assert(str_append_ch(name, ch) != -1);
} else if (ch == '(') {
section = parse_section(p);