Skip to content

Commit

Permalink
Allow Line Feed & Carriage Return as safe chars
Browse files Browse the repository at this point in the history
  • Loading branch information
alimirjamali committed Sep 27, 2024
1 parent 2a9664f commit 92ba6e6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion qubesusbproxy/core3ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,11 @@ async def on_device_attach_usb(self, vm, event, device, options):
"qubes-usb-proxy not installed in the VM")
else:
# TODO: sanitize and include stdout
sanitized_stderr = e.stderr.replace("\n", ", ")
if sanitized_stderr.endswith(", "):
sanitized_stderr = santizied_stderr[:-2] + "."
sanitized_stderr = ''.join(
[chr(c) for c in e.stderr if 0x20 <= c < 0x80])
[chr(c) for c in sanitized_stderr if 0x20 <= c < 0x80])
raise QubesUSBException(
'Device attach failed: {}'.format(sanitized_stderr))
finally:
Expand Down

0 comments on commit 92ba6e6

Please sign in to comment.