You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
2.1 KiB
47 lines
2.1 KiB
1 year ago
|
From c67bf049871a49e9871efe50b230a7f37b7039f6 Mon Sep 17 00:00:00 2001
|
||
|
From: Alex Rousskov <rousskov@measurement-factory.com>
|
||
|
Date: Thu, 25 May 2023 02:10:28 +0000
|
||
|
Subject: [PATCH] Fix userinfo percent-encoding (#1367)
|
||
|
|
||
|
%X expects an unsigned int, and that is what we were giving it. However,
|
||
|
to get to the correct unsigned int value from a (signed) char, one has
|
||
|
to cast to an unsigned char (or equivalent) first.
|
||
|
|
||
|
Broken since inception in commit 7b75100.
|
||
|
|
||
|
Also adjusted similar (commented out) ext_edirectory_userip_acl code.
|
||
|
---
|
||
|
src/acl/external/eDirectory_userip/ext_edirectory_userip_acl.cc | 2 +-
|
||
|
src/anyp/Uri.cc | 2 +-
|
||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/src/acl/external/eDirectory_userip/ext_edirectory_userip_acl.cc b/src/acl/external/eDirectory_userip/ext_edirectory_userip_acl.cc
|
||
|
index dbc20ae54..9028d1562 100644
|
||
|
--- a/src/acl/external/eDirectory_userip/ext_edirectory_userip_acl.cc
|
||
|
+++ b/src/acl/external/eDirectory_userip/ext_edirectory_userip_acl.cc
|
||
|
@@ -1612,7 +1612,7 @@ MainSafe(int argc, char **argv)
|
||
|
/* BINARY DEBUGGING *
|
||
|
local_printfx("while() -> bufa[%" PRIuSIZE "]: %s", k, bufa);
|
||
|
for (i = 0; i < k; ++i)
|
||
|
- local_printfx("%02X", bufa[i]);
|
||
|
+ local_printfx("%02X", static_cast<unsigned int>(static_cast<unsigned char>(bufa[i])));
|
||
|
local_printfx("\n");
|
||
|
* BINARY DEBUGGING */
|
||
|
/* Check for CRLF */
|
||
|
diff --git a/src/anyp/Uri.cc b/src/anyp/Uri.cc
|
||
|
index a6a5d5d9e..3d19188e9 100644
|
||
|
--- a/src/anyp/Uri.cc
|
||
|
+++ b/src/anyp/Uri.cc
|
||
|
@@ -70,7 +70,7 @@ AnyP::Uri::Encode(const SBuf &buf, const CharacterSet &ignore)
|
||
|
while (!tk.atEnd()) {
|
||
|
// TODO: Add Tokenizer::parseOne(void).
|
||
|
const auto ch = tk.remaining()[0];
|
||
|
- output.appendf("%%%02X", static_cast<unsigned int>(ch)); // TODO: Optimize using a table
|
||
|
+ output.appendf("%%%02X", static_cast<unsigned int>(static_cast<unsigned char>(ch))); // TODO: Optimize using a table
|
||
|
(void)tk.skip(ch);
|
||
|
|
||
|
if (tk.prefix(goodSection, ignore))
|
||
|
--
|
||
|
2.25.1
|
||
|
|