From d2efac37f55050bd07b61d0959a6bf06de4c0ed6 Mon Sep 17 00:00:00 2001 From: Emil Mikulic Date: Mon, 23 May 2011 23:44:52 +1000 Subject: [PATCH 1/1] Put fewer slashes into the slashed_url. --- http.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/http.c b/http.c index 418e481..4afc8c8 100644 --- a/http.c +++ b/http.c @@ -896,8 +896,9 @@ static void http_init_base(const char *url) /* make sure that the url has leading and trailing slashes */ urllen = strlen(url); slashed_url = xmalloc(urllen+3); - memset(slashed_url, '/', urllen+2); - memcpy(slashed_url+1, url, urllen); /* don't copy NULL */ + slashed_url[0] = '/'; + memcpy(slashed_url+1, url, urllen); /* don't copy NUL */ + slashed_url[urllen+1] = '/'; slashed_url[urllen+2] = '\0'; /* clean the url */ -- 2.17.1