pointtools

Simple point utilities to hold text presentations.
git clone git://r-36.net/pointtools
Log | Files | Refs | LICENSE

commit ad95b9aa5689e07c7febceddbc9db5e8574f2699
parent d56297fed58c06e726860efbd7be4c72bfc4429e
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sun, 13 Jun 2021 14:00:52 +0200

Only allo a-zA-Z0-9_ in filenames.

Thanks Od1n for reporting this.

Diffstat:
md2point.c | 25+++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/md2point.c b/md2point.c @@ -62,23 +62,20 @@ void escapechars(char *s) { for (; *s; s++) { - switch (*s) { - case '#': - case ' ': - case '\t': - case ':': - case '.': - case '(': - case ')': - case '/': - *s = '_'; - break; - case '\n': + if (*s == '\n') { *s = '\0'; return; - default: - break; } + + /* + * Only allow ASCII printable a-zA-Z0-9 for simplicity. + */ + if ((*s >= 'a' && *s <= 'z') + || (*s >= 'A' && *s <= 'Z') + || (*s >= '0' && *s <= '9')) { + continue; + } + *s = '_'; } }