Commit Diff


commit - 80444938654389aa7970aaa43c4590d63da6844d
commit + 387b976b99496c76d54831c44fb4c218e896c359
blob - 489547e4e88867cffba3c784d1f84f3bf83df60e
blob + 8a2ab7b8597aa36bb6caf94988dc5f10e1dd9734
--- log.c
+++ 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)