Skip to content

Commit

Permalink
Do not allow non-ASCII symbols in filenames
Browse files Browse the repository at this point in the history
ASCII symbols are still allowed.
  • Loading branch information
DemiMarie committed Jan 31, 2023
1 parent cc746b8 commit 185fc58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion qrexec-lib/gentbl.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def print_interval(interval, last_cat):
else:
# Allow the interval consisting only of 0x20, to allow spaces in
# file names
if last_cat[0] in ('C', 'Z') and interval != [0x20, 0x20]:
if (last_cat[0] in ('S', 'C', 'Z')) and interval[1] > 0x7E:
print_interval(interval, last_cat)
interval = [i, i]
print_interval(interval, last_cat)
Expand Down
4 changes: 4 additions & 0 deletions qrexec-lib/unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ static int validate_utf8_char(const unsigned char *untrusted_c) {
if (!(U_IS_UNICODE_CHAR(code_point)))
return 0;

/*
* Validate that the codepoint is a valid scalar value and is not a symbol,
* space, unassigned character, or control character.
*/
switch (code_point) {
#include "unpack-table.c"
return 0; // Invalid UTF-8 or forbidden codepoint
Expand Down

0 comments on commit 185fc58

Please sign in to comment.