aboutsummaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2023-07-01 13:13:04 +0000
committerOmar Polo <op@omarpolo.com>2023-07-01 13:13:04 +0000
commit2339a71178cc4a29dd2eada458c84b6092b056ce (patch)
tree078b3a2b4d4b06c7205f465cdead1c10652dff2f /server.c
parentfef06f06ac4779731bb8e293248eae1883a7ed1b (diff)
use a function-local buffer for the canonical redirect
Diffstat (limited to 'server.c')
-rw-r--r--server.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/server.c b/server.c
index 0eebe46..9ab4f13 100644
--- a/server.c
+++ b/server.c
@@ -907,15 +907,16 @@ open_dir(struct client *c)
static void
redirect_canonical_dir(struct client *c)
{
+ char buf[GEMINI_URL_LEN];
int r;
- r = snprintf(c->sbuf, sizeof(c->sbuf), "/%s/", c->iri.path);
- if (r < 0 || (size_t)r >= sizeof(c->sbuf)) {
+ r = snprintf(buf, sizeof(buf), "/%s/", c->iri.path);
+ if (r < 0 || (size_t)r >= sizeof(buf)) {
start_reply(c, TEMP_FAILURE, "internal server error");
return;
}
- start_reply(c, TEMP_REDIRECT, c->sbuf);
+ start_reply(c, TEMP_REDIRECT, buf);
}
static void