Open ericpareja opened 3 weeks ago
More info:
Here's the output from wwivutil email dump| grep ^From: | head -5
to see the From headers of the 1st five email. The BBS crashes on email number 3, which lists network no. 5.
From: #1 (Xenos #1)
From: #1 (Xenos #1)
From: #1 (Xenos #1)@11 at network #5
From: #1131 ()@1 at network #5
From: #1 (Xenos #1)@1 at network #5
There were a couple of lines that listed network 8.
From: #0 ()@32765 at network #8
From: #1 (Xenos #1)@60 at network #8
From: #0 ()@32765 at network #8
No other networks had email from them.
Here's the output from wwivconfig N)etwork
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒┌────────────── Select Network ┐▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ @60 WWIVnet [.0] │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ @1 fidonet [.1] │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ @7 RUSHnet [.2] │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ @1 fsxNet [.3] │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ @1 aliens.ph [.4] │▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒└──────────────────────────────┘▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
I attached my networks.dat and networks.json which both contain network 0 - 4.
Not sure if this is the correct fix:
diff --git a/bbs/readmail.cpp b/bbs/readmail.cpp
index 0d9de8c14..40f2ca272 100644
--- a/bbs/readmail.cpp
+++ b/bbs/readmail.cpp
@@ -346,7 +346,7 @@ static std::string from_name(const mailrec& m, const Network& net, const slrec&
static std::tuple<Network, int> network_and_num(const mailrec& m) {
Network net{};
auto nn = network_number_from(&m);
- if (nn <= a()->nets().size()) {
+ if (nn < a()->nets().size()) {
net = a()->nets()[nn];
} else {
net.sysnum = static_cast<uint16_t>(-1);
Hypothesis: data/email.dat
structure EmailData contains a from_network_number int that points to a network in the currently configured networks.dat / networks.json. If networks.{dat,json} is updated and number of networks is less than the network number stored in email.dat, this results in a crash.
Patch above merely avoids trying to access the deleted network's info. It could still point to the wrong info about source of the email if the number of networks still meets the criteria of the stored value.
Bug was exposed because we are able to delete/modified networks without checking if email.dat references the network to be deleted/modified and we don't update email.dat or any message bases that might point to the network we delete/modify. Too much work, so the patch above just side-steps the problem by not causing the error.
The BBS crashes when trying to read mail from deleted networks. All else works.
OS: Debian 12 WWIV version commit: 5d9bef30e0772f3ce0349b78b3245c8aad9306f6
Crash screen:
GDB backtrace: