Skip to content

Commit

Permalink
Don't allow filenames >8chars to save to 4.22 format.
Browse files Browse the repository at this point in the history
Also don't default filenames to echo tags if they are over
8 chars in size.

Fixes #1306

(cherry picked from commit b294a7c)
  • Loading branch information
wwiv committed Nov 1, 2020
1 parent 13f4c83 commit 33f7959
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
5 changes: 3 additions & 2 deletions bbs/subedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,9 @@ static void modify_sub(int n) {
if (a()->subs().sub(n).name == "** New WWIV Message Sub **") {
a()->subs().sub(n).name = a()->subs().sub(n).desc;
}
if (a()->subs().sub(n).filename == "NONAME") {
a()->subs().sub(n).filename = a()->subs().sub(n).nets[0].stype;
const auto stype = a()->subs().sub(n).nets[0].stype;
if (a()->subs().sub(n).filename == "NONAME" && stype.size() <= 8) {
a()->subs().sub(n).filename = stype;
}
} else if (ch2 == 'D' || ch2 == 'M') {
bout.nl();
Expand Down
17 changes: 12 additions & 5 deletions sdk/subxtr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,18 @@ bool Subs::Save() {
std::vector<xtrasubsrec> xsubs;

for (const auto& s : subs_) {
subboardrec_422_t ls = {};
xtrasubsrec lx = {};
to_char_array(ls.name, s.name);
to_char_array(lx.desc, s.desc);
to_char_array(ls.filename, s.filename);
// Only copy over what data fits in the old format.
subboardrec_422_t ls{};
xtrasubsrec lx{};
if (s.name.size() < sizeof ls.name) {
to_char_array(ls.name, s.name);
}
if (s.desc.size() < sizeof lx.desc) {
to_char_array(lx.desc, s.desc);
}
if (s.filename.size() < sizeof ls.filename) {
to_char_array(ls.filename, s.filename);
}
ls.key = s.key;
ls.readsl = s.readsl;
ls.postsl = s.postsl;
Expand Down

0 comments on commit 33f7959

Please sign in to comment.