From: Emil Mikulic Date: Mon, 23 May 2011 13:44:52 +0000 (+1000) Subject: Put fewer slashes into the slashed_url. X-Git-Tag: 3.0.714~34 X-Git-Url: https://unix4lyfe.org/gitweb/darkstat/commitdiff_plain/d2efac37f55050bd07b61d0959a6bf06de4c0ed6?hp=828b99551e6baa667a39d13725d936a08f52442b;ds=sidebyside Put fewer slashes into the slashed_url. --- 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 */