Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modif: Standardize and add missing name/hostname checks #5856

Merged
merged 6 commits into from
Jun 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
util.c: increase name max length from 64 to 253
To match the hostname check in src/firejail/main.c.
  • Loading branch information
kmk3 committed Jun 13, 2023
commit 052de475b9c6fc0c4670fc202ed24f75d12b1148
9 changes: 4 additions & 5 deletions src/firejail/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1479,8 +1479,11 @@ int ascii_isxdigit(unsigned char c) {
// allow strict ASCII letters and numbers; names with only numbers are rejected; spaces are rejected
int invalid_name(const char *name) {
const char *c = name;

int only_numbers = 1;

if (strlen(name) > 253)
return 1;

while (*c) {
if (!ascii_isalnum(*c))
return 1;
Expand All @@ -1491,10 +1494,6 @@ int invalid_name(const char *name) {
if (only_numbers)
return 1;

// restrict name to 64 chars max
if (strlen(name) > 64)
return 1;

return 0;
}

Expand Down