Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Main
Synchronet
Commits
4bb4130c
Commit
4bb4130c
authored
Mar 01, 2022
by
Rob Swindell
💬
Browse files
Add some NULL argument value checking
parent
7117b4d8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
src/sbbs3/filedat.c
src/sbbs3/filedat.c
+7
-1
No files found.
src/sbbs3/filedat.c
View file @
4bb4130c
...
@@ -1302,7 +1302,7 @@ char* cmdstr(scfg_t* cfg, user_t* user, const char* instr, const char* fpath
...
@@ -1302,7 +1302,7 @@ char* cmdstr(scfg_t* cfg, user_t* user, const char* instr, const char* fpath
/****************************************************************************/
/****************************************************************************/
bool
safest_filename
(
const
char
*
fname
)
bool
safest_filename
(
const
char
*
fname
)
{
{
return
strspn
(
fname
,
SAFEST_FILENAME_CHARS
)
==
strlen
(
fname
);
return
(
fname
!=
NULL
)
&&
(
strspn
(
fname
,
SAFEST_FILENAME_CHARS
)
==
strlen
(
fname
)
)
;
}
}
/****************************************************************************/
/****************************************************************************/
...
@@ -1310,6 +1310,9 @@ bool safest_filename(const char* fname)
...
@@ -1310,6 +1310,9 @@ bool safest_filename(const char* fname)
/****************************************************************************/
/****************************************************************************/
bool
illegal_filename
(
const
char
*
fname
)
bool
illegal_filename
(
const
char
*
fname
)
{
{
if
(
fname
==
NULL
)
return
false
;
size_t
len
=
strlen
(
fname
);
size_t
len
=
strlen
(
fname
);
if
(
len
<
1
)
if
(
len
<
1
)
...
@@ -1342,6 +1345,9 @@ bool illegal_filename(const char *fname)
...
@@ -1342,6 +1345,9 @@ bool illegal_filename(const char *fname)
/****************************************************************************/
/****************************************************************************/
bool
allowed_filename
(
scfg_t
*
cfg
,
const
char
*
fname
)
bool
allowed_filename
(
scfg_t
*
cfg
,
const
char
*
fname
)
{
{
if
(
fname
==
NULL
)
return
false
;
size_t
len
=
strlen
(
fname
);
size_t
len
=
strlen
(
fname
);
if
(
len
<
1
||
len
>
cfg
->
filename_maxlen
)
if
(
len
<
1
||
len
>
cfg
->
filename_maxlen
)
return
false
;
return
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment