summaryrefslogtreecommitdiff
path: root/libwaitress/src
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2009-05-28 17:20:48 +0200
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2009-05-28 17:20:48 +0200
commitd8648e1896aa2c9d6bf2273712ede9db01aac917 (patch)
treef3f6477d92eb30ab398802c3358a1eaef9e9b5ba /libwaitress/src
parentdbdef6859c59b5b04d3c68f3e664e27932d556c4 (diff)
downloadpianobar-windows-d8648e1896aa2c9d6bf2273712ede9db01aac917.tar.gz
pianobar-windows-d8648e1896aa2c9d6bf2273712ede9db01aac917.tar.bz2
pianobar-windows-d8648e1896aa2c9d6bf2273712ede9db01aac917.zip
waitress: Fix urlencode
Diffstat (limited to 'libwaitress/src')
-rw-r--r--libwaitress/src/main.c4
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 */