Enforce isalnum/isdigit receive ASCII characters

Fixes https://todo.sr.ht/~sircmpwn/scdoc/13
master
Drew DeVault 7 years ago
parent 0c25f932d2
commit 5ee33091fb
  1. 4
      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);

Loading…
Cancel
Save