diff options
| author | Mikael Magnusson <mikachu@gmail.com> | 2026-05-07 05:26:22 +0200 |
|---|---|---|
| committer | Mikael Magnusson <mikachu@gmail.com> | 2026-05-11 21:31:26 +0200 |
| commit | 785e64d90645a6241f71979105cd3c30d4b70fba (patch) | |
| tree | 762c2e9f4679a235835fef5b56e0c6fd53db6313 | |
| parent | 54481: Move variable into scope where it's used (diff) | |
| download | zsh-785e64d90645a6241f71979105cd3c30d4b70fba.tar zsh-785e64d90645a6241f71979105cd3c30d4b70fba.tar.gz zsh-785e64d90645a6241f71979105cd3c30d4b70fba.tar.bz2 zsh-785e64d90645a6241f71979105cd3c30d4b70fba.tar.lz zsh-785e64d90645a6241f71979105cd3c30d4b70fba.tar.xz zsh-785e64d90645a6241f71979105cd3c30d4b70fba.tar.zst zsh-785e64d90645a6241f71979105cd3c30d4b70fba.zip | |
54490: Fix buffer overflow and wrong behavior in url_encode
For non-ascii bytes, we passed negative values around,
resulting in:
write(10, "/code/zsh/%FFFFFFC3%FFFFFFA5", 54) = 54
With the change, we get the more reasonable:
write(10, "/code/zsh/%C3%A5", 42) = 42
| -rw-r--r-- | ChangeLog | 3 | ||||
| -rw-r--r-- | Src/Zle/termquery.c | 2 |
2 files changed, 4 insertions, 1 deletions
@@ -12,6 +12,9 @@ * 54481: Src/Zle/zle_misc.c: Move variable into scope where it's used + * 54490: Src/Zle/termquery.c: Fix buffer overflow and wrong + behavior in url_encode + 2026-05-10 Oliver Kiddle <opk@zsh.org> * unposted: Completion/Linux/Command/_selinux: complete files diff --git a/Src/Zle/termquery.c b/Src/Zle/termquery.c index 983f2d622..4042df078 100644 --- a/Src/Zle/termquery.c +++ b/Src/Zle/termquery.c @@ -619,7 +619,7 @@ static char* url_encode(const char* path, size_t *ulen) { char *url = zhalloc(strlen(path) * 3 + 1); /* worst case length triples */ - const char *in = path; + const unsigned char *in = (unsigned char*)path; char *out = url; for (; *in; in++) { |
