From 5ee33091fbaa341b6c86fcf65d4069b6fcf02111 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 14 May 2018 18:21:52 -0400 Subject: [PATCH] Enforce isalnum/isdigit receive ASCII characters Fixes https://todo.sr.ht/~sircmpwn/scdoc/13 --- src/main.c | 4 ++-- diff --git a/src/main.c b/src/main.c index ad5b04f3b58aaf381c41796935160896615f74fb..14179863770956a9752d6529e53da1fd7c59b138 100644 --- 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 @@ time(&now); 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); -- 2.48.1