mirror of https://github.com/omar-polo/gmid.git
use snprintf() instead of chain of strlcpy/cat
This commit is contained in:
parent
ed164e7221
commit
c9e878d6a4
9
server.c
9
server.c
|
@ -907,13 +907,10 @@ open_dir(struct client *c)
|
|||
static void
|
||||
redirect_canonical_dir(struct client *c)
|
||||
{
|
||||
size_t len;
|
||||
int r;
|
||||
|
||||
strlcpy(c->sbuf, "/", sizeof(c->sbuf));
|
||||
strlcat(c->sbuf, c->iri.path, sizeof(c->sbuf));
|
||||
len = strlcat(c->sbuf, "/", sizeof(c->sbuf));
|
||||
|
||||
if (len >= sizeof(c->sbuf)) {
|
||||
r = snprintf(c->sbuf, sizeof(c->sbuf), "/%s/", c->iri.path);
|
||||
if (r < 0 || (size_t)r >= sizeof(c->sbuf)) {
|
||||
start_reply(c, TEMP_FAILURE, "internal server error");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue