public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dylan Whyte <d.whyte@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-common] Fix 3560: gui/notes: escape % symbol when encoding
Date: Fri,  6 Aug 2021 15:22:24 +0200	[thread overview]
Message-ID: <20210806132224.2069916-1-d.whyte@proxmox.com> (raw)

This prevents cases in which a string containing a percent character is
inadvertently utf-8 decoded before being displayed in notes.

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
---
 src/PVE/Tools.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
index 807bc03..b8d6dc9 100644
--- a/src/PVE/Tools.pm
+++ b/src/PVE/Tools.pm
@@ -1200,8 +1200,8 @@ sub upid_normalize_status_type {
 sub encode_text {
     my ($text) = @_;
 
-    # all control and hi-bit characters, and ':'
-    my $unsafe = "^\x20-\x39\x3b-\x7e";
+    # all control and hi-bit characters, ':', and '%'
+    my $unsafe = "\x00-\x1f\x25\x3a\x7f-\xff";
     return uri_escape(Encode::encode("utf8", $text), $unsafe);
 }
 
-- 
2.30.2





             reply	other threads:[~2021-08-06 13:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06 13:22 Dylan Whyte [this message]
2021-11-12  8:43 ` Dylan Whyte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210806132224.2069916-1-d.whyte@proxmox.com \
    --to=d.whyte@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal