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
3f24e009
Commit
3f24e009
authored
5 months ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
Fix new potential NULL derefs (the add/del_area args can be NULL)
... in area manager code modified in previous commit.
parent
d256c540
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/sbbsecho.c
+8
-4
8 additions, 4 deletions
src/sbbs3/sbbsecho.c
with
8 additions
and
4 deletions
src/sbbs3/sbbsecho.c
+
8
−
4
View file @
3f24e009
...
@@ -1590,7 +1590,11 @@ void alter_areas_ini(FILE* afilein, FILE* afileout, FILE* nmfile
...
@@ -1590,7 +1590,11 @@ void alter_areas_ini(FILE* afilein, FILE* afileout, FILE* nmfile
unsigned
j
;
unsigned
j
;
faddr_t
addr
=
nodecfg
->
addr
;
faddr_t
addr
=
nodecfg
->
addr
;
const
char
*
addr_str
=
smb_faddrtoa
(
&
addr
,
NULL
);
const
char
*
addr_str
=
smb_faddrtoa
(
&
addr
,
NULL
);
size_t
add_count
;
size_t
del_count
;
add_count
=
strListCount
(
add_area
);
del_count
=
strListCount
(
del_area
);
str_list_t
ini
=
iniReadFile
(
afilein
);
str_list_t
ini
=
iniReadFile
(
afilein
);
str_list_t
areas
=
iniGetSectionList
(
ini
,
/* prefix: */
NULL
);
str_list_t
areas
=
iniGetSectionList
(
ini
,
/* prefix: */
NULL
);
fclose
(
afilein
);
fclose
(
afilein
);
...
@@ -1601,7 +1605,7 @@ void alter_areas_ini(FILE* afilein, FILE* afileout, FILE* nmfile
...
@@ -1601,7 +1605,7 @@ void alter_areas_ini(FILE* afilein, FILE* afileout, FILE* nmfile
/* Don't allow down-links to our "Unknown area" */
/* Don't allow down-links to our "Unknown area" */
continue
;
continue
;
}
}
if
(
del_
area
[
0
]
!=
NULL
)
{
/* Check for areas to remove */
if
(
del_
count
)
{
/* Check for areas to remove */
bool
disconnect_all
=
(
stricmp
(
del_area
[
0
],
"-ALL"
)
==
0
);
bool
disconnect_all
=
(
stricmp
(
del_area
[
0
],
"-ALL"
)
==
0
);
if
(
disconnect_all
||
strListFind
(
del_area
,
echotag
,
/* case-sensitive */
false
)
>=
0
)
{
if
(
disconnect_all
||
strListFind
(
del_area
,
echotag
,
/* case-sensitive */
false
)
>=
0
)
{
uint
areanum
=
find_area
(
echotag
);
uint
areanum
=
find_area
(
echotag
);
...
@@ -1629,7 +1633,7 @@ void alter_areas_ini(FILE* afilein, FILE* afileout, FILE* nmfile
...
@@ -1629,7 +1633,7 @@ void alter_areas_ini(FILE* afilein, FILE* afileout, FILE* nmfile
continue
;
continue
;
}
}
}
}
if
(
add_
area
[
0
]
!=
NULL
)
{
/* Check for areas to add */
if
(
add_
count
)
{
/* Check for areas to add */
bool
add_all
=
(
stricmp
(
add_area
[
0
],
"+ALL"
)
==
0
);
bool
add_all
=
(
stricmp
(
add_area
[
0
],
"+ALL"
)
==
0
);
j
=
strListFind
(
add_area
,
echotag
,
/* case-sensitive */
false
);
j
=
strListFind
(
add_area
,
echotag
,
/* case-sensitive */
false
);
if
(
add_all
||
j
>=
0
)
{
if
(
add_all
||
j
>=
0
)
{
...
@@ -1672,7 +1676,7 @@ void alter_areas_ini(FILE* afilein, FILE* afileout, FILE* nmfile
...
@@ -1672,7 +1676,7 @@ void alter_areas_ini(FILE* afilein, FILE* afileout, FILE* nmfile
strListWriteFile
(
afileout
,
ini
,
"
\n
"
);
strListWriteFile
(
afileout
,
ini
,
"
\n
"
);
strListFree
(
&
ini
);
strListFree
(
&
ini
);
strListFree
(
&
areas
);
strListFree
(
&
areas
);
if
(
nomatch
||
(
add_
area
[
0
]
!=
NULL
&&
stricmp
(
add_area
[
0
],
"+ALL"
)
==
0
))
if
(
nomatch
||
(
add_
count
&&
stricmp
(
add_area
[
0
],
"+ALL"
)
==
0
))
add_areas_from_echolists
(
afileout
,
nmfile
,
add_area
,
added
,
nodecfg
);
add_areas_from_echolists
(
afileout
,
nmfile
,
add_area
,
added
,
nodecfg
);
}
}
...
@@ -1820,7 +1824,7 @@ void alter_areas_bbs(FILE* afilein, FILE* afileout, FILE* nmfile
...
@@ -1820,7 +1824,7 @@ void alter_areas_bbs(FILE* afilein, FILE* afileout, FILE* nmfile
fprintf
(
afileout
,
"%s
\n
"
,
fields
);
/* No match so write back line */
fprintf
(
afileout
,
"%s
\n
"
,
fields
);
/* No match so write back line */
}
}
fclose
(
afilein
);
fclose
(
afilein
);
if
(
nomatch
||
(
add_
area
[
0
]
!=
NULL
&&
stricmp
(
add_area
[
0
],
"+ALL"
)
==
0
))
if
(
nomatch
||
(
add_
count
&&
stricmp
(
add_area
[
0
],
"+ALL"
)
==
0
))
add_areas_from_echolists
(
afileout
,
nmfile
,
add_area
,
added
,
nodecfg
);
add_areas_from_echolists
(
afileout
,
nmfile
,
add_area
,
added
,
nodecfg
);
}
}
...
...
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