Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
0c31f3c1
Commit
0c31f3c1
authored
5 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Dynamically allocate the BBS list.
May fix OS X stack clobbering issue.
parent
8c6bef61
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/syncterm/bbslist.c
+21
-9
21 additions, 9 deletions
src/syncterm/bbslist.c
with
21 additions
and
9 deletions
src/syncterm/bbslist.c
+
21
−
9
View file @
0c31f3c1
...
...
@@ -1518,7 +1518,9 @@ void load_bbslist(struct bbslist **list, size_t listsize, struct bbslist *defaul
*/
struct
bbslist
*
show_bbslist
(
char
*
current
,
int
connected
)
{
struct
bbslist
*
list
[
MAX_OPTS
+
1
];
#define BBSLIST_ENTRIES (MAX_OPTS+1)
#define BBSLIST_SIZE ((MAX_OPTS+1)*sizeof(struct bbslist))
struct
bbslist
**
list
;
int
i
,
j
;
static
int
opt
=
0
,
bar
=
0
;
int
oldopt
=-
1
;
...
...
@@ -1559,18 +1561,23 @@ struct bbslist *show_bbslist(char *current, int connected)
return
(
NULL
);
get_syncterm_filename
(
shared_list
,
sizeof
(
shared_list
),
SYNCTERM_PATH_LIST
,
TRUE
);
load_bbslist
(
list
,
sizeof
(
list
),
&
defaults
,
settings
.
list_path
,
sizeof
(
settings
.
list_path
),
shared_list
,
sizeof
(
shared_list
),
&
listcount
,
&
opt
,
&
bar
,
current
?
strdup
(
current
)
:
NULL
);
list
=
malloc
(
BBSLIST_SIZE
);
load_bbslist
(
list
,
BBSLIST_SIZE
,
&
defaults
,
settings
.
list_path
,
sizeof
(
settings
.
list_path
),
shared_list
,
sizeof
(
shared_list
),
&
listcount
,
&
opt
,
&
bar
,
current
?
strdup
(
current
)
:
NULL
);
uifc
.
helpbuf
=
"Help Button Hack"
;
uifc
.
list
(
WIN_T2B
|
WIN_RHT
|
WIN_EXTKEYS
|
WIN_DYN
|
WIN_ACT
|
WIN_INACT
,
0
,
0
,
0
,
&
sopt
,
&
sbar
,
"SyncTERM Settings"
,
connected
?
connected_settings_menu
:
settings_menu
);
for
(;;)
{
if
(
quitting
)
if
(
quitting
)
{
free
(
list
);
return
NULL
;
}
if
(
!
at_settings
)
{
for
(;
!
at_settings
;)
{
if
(
quitting
)
if
(
quitting
)
{
free
(
list
);
return
NULL
;
}
if
(
connected
)
uifc
.
helpbuf
=
"`SyncTERM Directory`
\n\n
"
"Commands:
\n\n
"
...
...
@@ -1664,6 +1671,7 @@ struct bbslist *show_bbslist(char *current, int connected)
if
(
uifc
.
changes
)
{
parse_url
(
addy
,
&
retlist
,
defaults
.
conn_type
,
FALSE
);
free_list
(
&
list
[
0
],
listcount
);
free
(
list
);
return
(
&
retlist
);
}
}
...
...
@@ -1673,6 +1681,7 @@ struct bbslist *show_bbslist(char *current, int connected)
if
(
!
check_exit
(
TRUE
))
continue
;
free_list
(
&
list
[
0
],
listcount
);
free
(
list
);
return
(
NULL
);
}
}
...
...
@@ -1762,7 +1771,7 @@ struct bbslist *show_bbslist(char *current, int connected)
}
else
{
add_bbs
(
settings
.
list_path
,
list
[
listcount
-
1
]);
load_bbslist
(
list
,
sizeof
(
list
)
,
&
defaults
,
settings
.
list_path
,
sizeof
(
settings
.
list_path
),
shared_list
,
sizeof
(
shared_list
),
&
listcount
,
&
opt
,
&
bar
,
strdup
(
list
[
listcount
-
1
]
->
name
));
load_bbslist
(
list
,
BBSLIST_SIZE
,
&
defaults
,
settings
.
list_path
,
sizeof
(
settings
.
list_path
),
shared_list
,
sizeof
(
shared_list
),
&
listcount
,
&
opt
,
&
bar
,
strdup
(
list
[
listcount
-
1
]
->
name
));
oldopt
=-
1
;
}
break
;
...
...
@@ -1804,7 +1813,7 @@ struct bbslist *show_bbslist(char *current, int connected)
if
(
uifc
.
list
(
WIN_MID
|
WIN_SAV
,
0
,
0
,
0
,
&
i
,
NULL
,
str
,
YesNo
)
!=
0
)
break
;
del_bbs
(
settings
.
list_path
,
list
[
opt
]);
load_bbslist
(
list
,
sizeof
(
list
)
,
&
defaults
,
settings
.
list_path
,
sizeof
(
settings
.
list_path
),
shared_list
,
sizeof
(
shared_list
),
&
listcount
,
NULL
,
NULL
,
NULL
);
load_bbslist
(
list
,
BBSLIST_SIZE
,
&
defaults
,
settings
.
list_path
,
sizeof
(
settings
.
list_path
),
shared_list
,
sizeof
(
shared_list
),
&
listcount
,
NULL
,
NULL
,
NULL
);
oldopt
=-
1
;
break
;
case
MSK_EDIT
:
...
...
@@ -1817,7 +1826,7 @@ struct bbslist *show_bbslist(char *current, int connected)
break
;
}
if
(
edit_list
(
list
,
list
[
opt
],
settings
.
list_path
,
FALSE
))
{
load_bbslist
(
list
,
sizeof
(
list
)
,
&
defaults
,
settings
.
list_path
,
sizeof
(
settings
.
list_path
),
shared_list
,
sizeof
(
shared_list
),
&
listcount
,
&
opt
,
&
bar
,
strdup
(
list
[
opt
]
->
name
));
load_bbslist
(
list
,
BBSLIST_SIZE
,
&
defaults
,
settings
.
list_path
,
sizeof
(
settings
.
list_path
),
shared_list
,
sizeof
(
shared_list
),
&
listcount
,
&
opt
,
&
bar
,
strdup
(
list
[
opt
]
->
name
));
oldopt
=-
1
;
}
break
;
...
...
@@ -1833,13 +1842,14 @@ struct bbslist *show_bbslist(char *current, int connected)
check_exit
(
FALSE
);
}
else
if
(
edit_list
(
list
,
list
[
opt
],
settings
.
list_path
,
FALSE
))
{
load_bbslist
(
list
,
sizeof
(
list
)
,
&
defaults
,
settings
.
list_path
,
sizeof
(
settings
.
list_path
),
shared_list
,
sizeof
(
shared_list
),
&
listcount
,
&
opt
,
&
bar
,
strdup
(
list
[
opt
]
->
name
));
load_bbslist
(
list
,
BBSLIST_SIZE
,
&
defaults
,
settings
.
list_path
,
sizeof
(
settings
.
list_path
),
shared_list
,
sizeof
(
shared_list
),
&
listcount
,
&
opt
,
&
bar
,
strdup
(
list
[
opt
]
->
name
));
oldopt
=-
1
;
}
}
else
{
memcpy
(
&
retlist
,
list
[
val
],
sizeof
(
struct
bbslist
));
free_list
(
&
list
[
0
],
listcount
);
free
(
list
);
return
(
&
retlist
);
}
}
...
...
@@ -1894,6 +1904,7 @@ struct bbslist *show_bbslist(char *current, int connected)
if
(
!
check_exit
(
TRUE
))
continue
;
free_list
(
&
list
[
0
],
listcount
);
free
(
list
);
return
(
NULL
);
case
0
:
/* Edit default connection settings */
edit_list
(
NULL
,
&
defaults
,
settings
.
list_path
,
TRUE
);
...
...
@@ -1930,6 +1941,7 @@ struct bbslist *show_bbslist(char *current, int connected)
}
else
if
(
check_exit
(
FALSE
))
{
free_list
(
&
list
[
0
],
listcount
);
free
(
list
);
return
(
NULL
);
}
}
...
...
@@ -1942,7 +1954,7 @@ struct bbslist *show_bbslist(char *current, int connected)
break
;
case
3
:
/* Program settings */
change_settings
();
load_bbslist
(
list
,
sizeof
(
list
)
,
&
defaults
,
settings
.
list_path
,
sizeof
(
settings
.
list_path
),
shared_list
,
sizeof
(
shared_list
),
&
listcount
,
&
opt
,
&
bar
,
list
[
opt
]
?
strdup
(
list
[
opt
]
->
name
)
:
NULL
);
load_bbslist
(
list
,
BBSLIST_SIZE
,
&
defaults
,
settings
.
list_path
,
sizeof
(
settings
.
list_path
),
shared_list
,
sizeof
(
shared_list
),
&
listcount
,
&
opt
,
&
bar
,
list
[
opt
]
?
strdup
(
list
[
opt
]
->
name
)
:
NULL
);
oldopt
=-
1
;
break
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment