diff options
author | Omar Polo <op@omarpolo.com> | 2023-07-01 13:13:04 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2023-07-01 13:13:04 +0000 |
commit | 2339a71178cc4a29dd2eada458c84b6092b056ce (patch) | |
tree | 078b3a2b4d4b06c7205f465cdead1c10652dff2f /server.c | |
parent | fef06f06ac4779731bb8e293248eae1883a7ed1b (diff) |
use a function-local buffer for the canonical redirect
Diffstat (limited to 'server.c')
-rw-r--r-- | server.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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 |