Skip to content

Commit

Permalink
q-dev: handle invalid values
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbartman committed Jun 17, 2024
1 parent 54fca94 commit 18abd26
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion qubesusbproxy/core3ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,11 @@ def _sanitize(
if i >= len(untrusted_device_desc):
break
hex_code = untrusted_device_desc[i - 1: i + 1]
c = chr(int(hex_code, base=16))
try:
hex_value = int(hex_code, 16)
c = chr(hex_value)
except ValueError:
c = '_'

if c in safe_chars_set:
result += c
Expand Down

0 comments on commit 18abd26

Please sign in to comment.