chiark
/
gitweb
/
~mdw
/
mLib
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a23bab9
)
codec/url.c: Always encode whitespace characters.
author
Mark Wooding
<mdw@distorted.org.uk>
Sat, 26 May 2018 22:31:00 +0000
(23:31 +0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Sat, 26 May 2018 23:03:46 +0000
(
00:03
+0100)
Vertical whitespace is obviously bad, so this is a longstanding bug; but
all whitespace should really be escaped.
codec/url.c
patch
|
blob
|
blame
|
history
diff --git
a/codec/url.c
b/codec/url.c
index f502f7cbde1e23d6a8de6a4c1a9d9ecf5305ae9f..4e7f19010606b5ba66dda999ee6785bbfc7e67a6 100644
(file)
--- a/
codec/url.c
+++ b/
codec/url.c
@@
-67,7
+67,8
@@
static void encode(url_ectx *ctx, dstr *d, const char *p)
DPUTC(d, '+');
break;
default:
- if ((ctx->f & URLF_LAX) || isalnum((unsigned char)*p))
+ if (!isspace((unsigned char)*p) &&
+ ((ctx->f & URLF_LAX) || isalnum((unsigned char)*p)))
goto safe;
else
goto unsafe;