diff options
author | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2009-05-28 17:20:48 +0200 |
---|---|---|
committer | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2009-05-28 17:20:48 +0200 |
commit | d8648e1896aa2c9d6bf2273712ede9db01aac917 (patch) | |
tree | f3f6477d92eb30ab398802c3358a1eaef9e9b5ba | |
parent | dbdef6859c59b5b04d3c68f3e664e27932d556c4 (diff) | |
download | pianobar-d8648e1896aa2c9d6bf2273712ede9db01aac917.tar.gz pianobar-d8648e1896aa2c9d6bf2273712ede9db01aac917.tar.bz2 pianobar-d8648e1896aa2c9d6bf2273712ede9db01aac917.zip |
waitress: Fix urlencode
-rw-r--r-- | libwaitress/src/main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libwaitress/src/main.c b/libwaitress/src/main.c index 06daf24..250a5e1 100644 --- a/libwaitress/src/main.c +++ b/libwaitress/src/main.c @@ -74,8 +74,8 @@ inline void WaitressSetProxy (WaitressHandle_t *waith, const char *host, * @return malloc'ed encoded string, don't forget to free it */ char *WaitressUrlEncode (const char *in) { - /* worst case: encode all characters */ size_t inLen = strlen (in); + /* worst case: encode all characters */ char *out = calloc (inLen * 3 + 1, sizeof (*in)); const char *inPos = in; char *outPos = out; @@ -83,7 +83,7 @@ char *WaitressUrlEncode (const char *in) { while (inPos - in < inLen) { if (!isalnum (*inPos) && *inPos != '_' && *inPos != '-' && *inPos != '.') { *outPos++ = '%'; - snprintf (outPos, 3, "%02x", *inPos); + snprintf (outPos, 3, "%02x", *inPos & 0xff); outPos += 2; } else { /* copy character */ |