[PR #5741] [MERGED] util.c: add and use ascii-only char functions #5646

Closed
opened 2026-05-05 10:42:16 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netblue30/firejail/pull/5741
Author: @kmk3
Created: 3/21/2023
Status: Merged
Merged: 3/23/2023
Merged by: @netblue30

Base: masterHead: util-ascii-char-fns


📝 Commits (2)

  • 3e79412 firejail.h: move invalid_name prototype to proper place
  • f95bbb6 util.c: add and use ascii-only char functions

📊 Changes

2 files changed (+36 additions, -3 deletions)

View changed files

📝 src/firejail/firejail.h (+7 -1)
📝 src/firejail/util.c (+29 -2)

📄 Description

The "invalid_name" function claims to "allow strict ASCII letters and
numbers".

However, it uses isalnum(3) and isdigit(3), which may take the current
locale into account and thus return 1 for non-ASCII characters.

So add the following functions:

  • ascii_isalnum
  • ascii_isalpha
  • ascii_isdigit
  • ascii_islower
  • ascii_isupper
  • ascii_isxdigit

And use the applicable ones in "invalid_name" so that it actually uses
strictly ASCII in its comparisons.

Added on commit b4ffaa207 ("merges; more on cleaning up esc chars",
2023-02-14).

Relates to #5578.

Kind of relates to #5708.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netblue30/firejail/pull/5741 **Author:** [@kmk3](https://github.com/kmk3) **Created:** 3/21/2023 **Status:** ✅ Merged **Merged:** 3/23/2023 **Merged by:** [@netblue30](https://github.com/netblue30) **Base:** `master` ← **Head:** `util-ascii-char-fns` --- ### 📝 Commits (2) - [`3e79412`](https://github.com/netblue30/firejail/commit/3e79412172fddcaba6999e435a5e09dc28dfc0b1) firejail.h: move invalid_name prototype to proper place - [`f95bbb6`](https://github.com/netblue30/firejail/commit/f95bbb6f6e517f43fd0f3d7129f238fe817beca4) util.c: add and use ascii-only char functions ### 📊 Changes **2 files changed** (+36 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/firejail/firejail.h` (+7 -1) 📝 `src/firejail/util.c` (+29 -2) </details> ### 📄 Description The "invalid_name" function claims to "allow strict ASCII letters and numbers". However, it uses isalnum(3) and isdigit(3), which may take the current locale into account and thus return 1 for non-ASCII characters. So add the following functions: * ascii_isalnum * ascii_isalpha * ascii_isdigit * ascii_islower * ascii_isupper * ascii_isxdigit And use the applicable ones in "invalid_name" so that it actually uses strictly ASCII in its comparisons. Added on commit b4ffaa207 ("merges; more on cleaning up esc chars", 2023-02-14). Relates to #5578. Kind of relates to #5708. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 10:42:17 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#5646
No description provided.