aboutsummaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-10-15 07:51:15 +0000
committerOmar Polo <op@omarpolo.com>2021-10-15 07:51:15 +0000
commit387b976b99496c76d54831c44fb4c218e896c359 (patch)
tree24ffed44431883fe875f9f9b105ed3abb0cf4d2d /log.c
parent80444938654389aa7970aaa43c4590d63da6844d (diff)
c->req may be NULL now
Diffstat (limited to 'log.c')
-rw-r--r--log.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/log.c b/log.c
index 489547e..8a2ab7b 100644
--- a/log.c
+++ b/log.c
@@ -213,7 +213,8 @@ void
log_request(struct client *c, char *meta, size_t l)
{
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV], b[GEMINI_URL_LEN];
- char *t, *fmted;
+ char *fmted;
+ const char *t;
size_t len;
int ec;
@@ -244,7 +245,9 @@ log_request(struct client *c, char *meta, size_t l)
strlcat(b, c->iri.query, sizeof(b));
}
} else {
- strlcpy(b, c->req, sizeof(b));
+ if ((t = c->req) == NULL)
+ t = "";
+ strlcpy(b, t, sizeof(b));
}
if ((t = gmid_strnchr(meta, '\r', l)) == NULL)