`strchr` may return null if a deliminator is not found. Likewise,
if an `Http::HdrType::FTP_REASON` string is not found, nullptr would
be used in the %s formatter, leading to UB.
s = e + 1;
e = strchr(s, delim);
+ if (!e)
+ return false;
+
char ip[MAX_IPSTRLEN];
if (static_cast<size_t>(e - s) >= sizeof(ip))
return false;
if (header.has(Http::HdrType::FTP_STATUS)) {
const char *reason = header.getStr(Http::HdrType::FTP_REASON);
mb.appendf("%i %s\r\n", header.getInt(Http::HdrType::FTP_STATUS),
- (reason ? reason : nullptr));
+ (reason ? reason : ""));
}
}