*/
xfree(uri);
const SBuf tmp(request->effectiveRequestUri());
- uri = xstrndup(tmp.rawContent(), tmp.length());
+ uri = xstrndup(tmp.rawContent(), tmp.length()+1);
setLogUri(this, urlCanonicalClean(request));
assert(request->method.id());
} else if (HttpReply *new_rep = dynamic_cast<HttpReply*>(msg)) {
if (code == 200) {
const SBuf tmp = ftpState->request->url.path();
- p = path = xstrndup(tmp.rawContent(),tmp.length());
+ p = path = xstrndup(tmp.rawContent(),tmp.length()+1);
if (*p == '/')
++p;
/* Build the new path (urlpath begins with /) */
const SBuf tmp = ftpState->request->url.path();
- path = xstrndup(tmp.rawContent(), tmp.length());
+ path = xstrndup(tmp.rawContent(), tmp.length()+1);
path[tmp.length()] = '\0';
rfc1738_unescape(path);
/** FIXME: this appears to be parsing the URL. *very* badly. */
/* a proper encapsulated URI/URL type needs to clear this up. */
if ((p = urlpath.find(':')) != SBuf::npos) {
- result = xstrndup(urlpath.rawContent(), p-1);
+ result = xstrndup(urlpath.rawContent(), (p-1) /*but xstrndup truncates*/+1 );
} else {
- result = xstrndup(urlpath.rawContent(), urlpath.length());
+ result = xstrndup(urlpath.rawContent(), urlpath.length()+1);
}
return result;
}