icecat: add release icecat-140.10.1-1gnu1 for ecne

This commit is contained in:
Ark74 2026-05-04 16:58:41 -06:00
parent a5f93cb214
commit ff85d7c623
1256 changed files with 63469 additions and 24141 deletions

View file

@ -113,7 +113,12 @@ bool NetAddr::ToStringBuffer(char* buf, uint32_t bufSize) const {
}
#if defined(XP_UNIX)
if (addr->raw.family == AF_LOCAL) {
if (bufSize < sizeof(addr->local.path)) {
// local.path is NOT guaranteed to be NUL-terminated: PR_Accept casts
// PRNetAddr* to struct sockaddr* and Linux sun_path is 108 bytes vs
// our 104, so a peer bound to a >=104-char path fills the whole field
// with non-NUL data. We must write our own terminator, so require
// strictly more than sizeof(path) bytes.
if (bufSize <= sizeof(addr->local.path)) {
// Many callers don't bother checking our return value, so
// null-terminate just in case.
if (bufSize > 0) {
@ -128,26 +133,54 @@ bool NetAddr::ToStringBuffer(char* buf, uint32_t bufSize) const {
// using the destination's size may cause us to read off the end of the
// source.
memcpy(buf, addr->local.path, sizeof(addr->local.path));
buf[sizeof(addr->local.path)] = '\0';
return true;
}
#endif
return false;
}
bool NetAddr::ToString(nsACString& aOutput) const {
size_t bufferSize = 0;
if (raw.family == AF_INET) {
bufferSize = INET_ADDRSTRLEN;
} else if (raw.family == AF_INET6) {
bufferSize = INET6_ADDRSTRLEN;
}
#if defined(XP_UNIX)
else if (raw.family == AF_LOCAL) {
// +1 for the NUL terminator that ToStringBuffer writes.
bufferSize = sizeof(local.path) + 1;
}
#endif
auto handleOrErr = aOutput.BulkWrite(bufferSize, /* aPrefixToPreserve */ 0,
/* aAllowShrinking */ false);
if (handleOrErr.isErr()) {
NS_ABORT_OOM(bufferSize);
return false;
}
auto handle = handleOrErr.unwrap();
if (!ToStringBuffer(handle.Elements(), bufferSize)) {
handle.Finish(0, /* aAllowShrinking */ false);
return false;
}
handle.Finish(strlen(handle.Elements()), /* aAllowShrinking */ false);
return true;
}
nsCString NetAddr::ToString() const {
nsCString out;
out.SetLength(kNetAddrMaxCStrBufSize);
if (ToStringBuffer(out.BeginWriting(), kNetAddrMaxCStrBufSize)) {
out.SetLength(strlen(out.BeginWriting()));
return out;
}
return ""_ns;
ToString(out);
return out;
}
void NetAddr::ToAddrPortString(nsACString& aOutput) const {
ToString(aOutput);
uint16_t port = 0;
GetPort(&port);
aOutput.Assign(nsPrintfCString("%s:%d", ToString().get(), port));
aOutput.AppendPrintf(":%d", port);
}
bool NetAddr::IsLoopbackAddr() const {