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
90ff2f3f
Commit
90ff2f3f
authored
6 months ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
Set "native" flag for newly created file types/protocols
Eliminate use of strcpy() and sprintf() in this file
parent
65cbf055
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#7704
passed
6 months ago
Stage: build
Stage: test
Stage: cleanup
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/scfg/scfgxfr1.c
+37
-34
37 additions, 34 deletions
src/sbbs3/scfg/scfgxfr1.c
with
37 additions
and
34 deletions
src/sbbs3/scfg/scfgxfr1.c
+
37
−
34
View file @
90ff2f3f
...
@@ -97,10 +97,10 @@ void xfer_opts()
...
@@ -97,10 +97,10 @@ void xfer_opts()
snprintf
(
opt
[
i
++
],
MAX_OPLN
,
"%-33.33s%u%%"
,
"Default Credit on Download"
snprintf
(
opt
[
i
++
],
MAX_OPLN
,
"%-33.33s%u%%"
,
"Default Credit on Download"
,
cfg
.
cdt_dn_pct
);
,
cfg
.
cdt_dn_pct
);
if
(
cfg
.
leech_pct
)
if
(
cfg
.
leech_pct
)
sprintf
(
str
,
"%u%% after %u seconds"
s
n
printf
(
str
,
sizeof
str
,
"%u%% after %u seconds"
,
cfg
.
leech_pct
,
cfg
.
leech_sec
);
,
cfg
.
leech_pct
,
cfg
.
leech_sec
);
else
else
strcpy
(
str
,
"<disabled>"
);
SAFECOPY
(
str
,
"<disabled>"
);
snprintf
(
opt
[
i
++
],
MAX_OPLN
,
"%-33.33s%s"
,
"Leech Protocol Detection"
,
str
);
snprintf
(
opt
[
i
++
],
MAX_OPLN
,
"%-33.33s%s"
,
"Leech Protocol Detection"
,
str
);
if
(
cfg
.
file_misc
&
FM_SAFEST
)
if
(
cfg
.
file_misc
&
FM_SAFEST
)
SAFECOPY
(
str
,
"Safest Subset"
);
SAFECOPY
(
str
,
"Safest Subset"
);
...
@@ -110,12 +110,12 @@ void xfer_opts()
...
@@ -110,12 +110,12 @@ void xfer_opts()
,
cfg
.
file_misc
&
FM_SPACES
?
"In"
:
"Ex"
);
,
cfg
.
file_misc
&
FM_SPACES
?
"In"
:
"Ex"
);
snprintf
(
opt
[
i
++
],
MAX_OPLN
,
"%-33.33s%u characters"
,
"Allowed Filename Length"
,
cfg
.
filename_maxlen
);
snprintf
(
opt
[
i
++
],
MAX_OPLN
,
"%-33.33s%u characters"
,
"Allowed Filename Length"
,
cfg
.
filename_maxlen
);
snprintf
(
opt
[
i
++
],
MAX_OPLN
,
"%-33.33s%s"
,
"Allowed Filename Characters"
,
str
);
snprintf
(
opt
[
i
++
],
MAX_OPLN
,
"%-33.33s%s"
,
"Allowed Filename Characters"
,
str
);
s
trcpy
(
opt
[
i
++
],
"Viewable Files..."
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Viewable Files..."
);
s
trcpy
(
opt
[
i
++
],
"Testable Files..."
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Testable Files..."
);
s
trcpy
(
opt
[
i
++
],
"Download Events..."
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Download Events..."
);
s
trcpy
(
opt
[
i
++
],
"Extractable Files..."
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Extractable Files..."
);
s
trcpy
(
opt
[
i
++
],
"Compressible Files..."
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Compressible Files..."
);
s
trcpy
(
opt
[
i
++
],
"Transfer Protocols..."
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Transfer Protocols..."
);
opt
[
i
][
0
]
=
0
;
opt
[
i
][
0
]
=
0
;
uifc
.
helpbuf
=
uifc
.
helpbuf
=
"`File Transfer Configuration:`
\n
"
"`File Transfer Configuration:`
\n
"
...
@@ -256,11 +256,11 @@ void xfer_opts()
...
@@ -256,11 +256,11 @@ void xfer_opts()
break
;
break
;
case
__COUNTER__
:
/* Uploaded Filename characters allowed */
case
__COUNTER__
:
/* Uploaded Filename characters allowed */
i
=
0
;
i
=
0
;
s
trcpy
(
opt
[
i
++
],
"Safest Subset Only (A-Z, a-z, 0-9, -, _, and .)"
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Safest Subset Only (A-Z, a-z, 0-9, -, _, and .)"
);
s
trcpy
(
opt
[
i
++
],
"Most ASCII Characters, Excluding Spaces"
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Most ASCII Characters, Excluding Spaces"
);
s
trcpy
(
opt
[
i
++
],
"Most ASCII Characters, Including Spaces"
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Most ASCII Characters, Including Spaces"
);
s
trcpy
(
opt
[
i
++
],
"Most CP437 Characters, Excluding Spaces"
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Most CP437 Characters, Excluding Spaces"
);
s
trcpy
(
opt
[
i
++
],
"Most CP437 Characters, Including Spaces"
);
s
nprintf
(
opt
[
i
++
],
MAX_OPLN
,
"Most CP437 Characters, Including Spaces"
);
opt
[
i
][
0
]
=
'\0'
;
opt
[
i
][
0
]
=
'\0'
;
if
(
cfg
.
file_misc
&
FM_SAFEST
)
if
(
cfg
.
file_misc
&
FM_SAFEST
)
j
=
0
;
j
=
0
;
...
@@ -386,8 +386,9 @@ void xfer_opts()
...
@@ -386,8 +386,9 @@ void xfer_opts()
continue
;
continue
;
}
}
memset
(
cfg
.
fview
[
0
],
0
,
sizeof
(
fview_t
));
memset
(
cfg
.
fview
[
0
],
0
,
sizeof
(
fview_t
));
strcpy
(
cfg
.
fview
[
0
]
->
ext
,
"*"
);
SAFECOPY
(
cfg
.
fview
[
0
]
->
ext
,
"*"
);
strcpy
(
cfg
.
fview
[
0
]
->
cmd
,
"?archive list %f"
);
SAFECOPY
(
cfg
.
fview
[
0
]
->
cmd
,
"?archive list %f"
);
cfg
.
fview
[
0
]
->
ex_mode
=
EX_NATIVE
;
}
}
else
{
else
{
for
(
j
=
cfg
.
total_fviews
;
j
>
i
;
j
--
)
for
(
j
=
cfg
.
total_fviews
;
j
>
i
;
j
--
)
...
@@ -468,8 +469,7 @@ void xfer_opts()
...
@@ -468,8 +469,7 @@ void xfer_opts()
toggle_flag
(
native_opt
,
&
cfg
.
fview
[
i
]
->
ex_mode
,
EX_NATIVE
,
false
,
native_help
);
toggle_flag
(
native_opt
,
&
cfg
.
fview
[
i
]
->
ex_mode
,
EX_NATIVE
,
false
,
native_help
);
break
;
break
;
case
3
:
case
3
:
sprintf
(
str
,
"Viewable File Type %s"
snprintf
(
str
,
sizeof
str
,
"Viewable File Type %s"
,
cfg
.
fview
[
i
]
->
ext
);
,
cfg
.
fview
[
i
]
->
ext
);
getar
(
str
,
cfg
.
fview
[
i
]
->
arstr
);
getar
(
str
,
cfg
.
fview
[
i
]
->
arstr
);
break
;
break
;
}
}
...
@@ -521,9 +521,10 @@ void xfer_opts()
...
@@ -521,9 +521,10 @@ void xfer_opts()
continue
;
continue
;
}
}
memset
(
cfg
.
ftest
[
0
],
0
,
sizeof
(
ftest_t
));
memset
(
cfg
.
ftest
[
0
],
0
,
sizeof
(
ftest_t
));
strcpy
(
cfg
.
ftest
[
0
]
->
ext
,
"ZIP"
);
SAFECOPY
(
cfg
.
ftest
[
0
]
->
ext
,
"ZIP"
);
strcpy
(
cfg
.
ftest
[
0
]
->
cmd
,
"%@unzip -tqq %f"
);
SAFECOPY
(
cfg
.
ftest
[
0
]
->
cmd
,
"%@unzip -tqq %f"
);
strcpy
(
cfg
.
ftest
[
0
]
->
workstr
,
"Testing ZIP Integrity..."
);
SAFECOPY
(
cfg
.
ftest
[
0
]
->
workstr
,
"Testing ZIP Integrity..."
);
cfg
.
ftest
[
0
]
->
ex_mode
=
EX_NATIVE
;
}
}
else
{
else
{
...
@@ -613,7 +614,7 @@ void xfer_opts()
...
@@ -613,7 +614,7 @@ void xfer_opts()
,
cfg
.
ftest
[
i
]
->
workstr
,
sizeof
(
cfg
.
ftest
[
i
]
->
workstr
)
-
1
,
K_EDIT
|
K_MSG
);
,
cfg
.
ftest
[
i
]
->
workstr
,
sizeof
(
cfg
.
ftest
[
i
]
->
workstr
)
-
1
,
K_EDIT
|
K_MSG
);
break
;
break
;
case
4
:
case
4
:
sprintf
(
str
,
"Testable File Type %s"
,
cfg
.
ftest
[
i
]
->
ext
);
s
n
printf
(
str
,
sizeof
str
,
"Testable File Type %s"
,
cfg
.
ftest
[
i
]
->
ext
);
getar
(
str
,
cfg
.
ftest
[
i
]
->
arstr
);
getar
(
str
,
cfg
.
ftest
[
i
]
->
arstr
);
break
;
break
;
}
}
...
@@ -680,9 +681,10 @@ void xfer_opts()
...
@@ -680,9 +681,10 @@ void xfer_opts()
continue
;
continue
;
}
}
memset
(
cfg
.
dlevent
[
0
],
0
,
sizeof
(
dlevent_t
));
memset
(
cfg
.
dlevent
[
0
],
0
,
sizeof
(
dlevent_t
));
strcpy
(
cfg
.
dlevent
[
0
]
->
ext
,
"ZIP"
);
SAFECOPY
(
cfg
.
dlevent
[
0
]
->
ext
,
"ZIP"
);
strcpy
(
cfg
.
dlevent
[
0
]
->
cmd
,
"%@zip -z %f < %zzipmsg.txt"
);
SAFECOPY
(
cfg
.
dlevent
[
0
]
->
cmd
,
"%@zip -z %f < %zzipmsg.txt"
);
strcpy
(
cfg
.
dlevent
[
0
]
->
workstr
,
"Adding ZIP Comment..."
);
SAFECOPY
(
cfg
.
dlevent
[
0
]
->
workstr
,
"Adding ZIP Comment..."
);
cfg
.
dlevent
[
0
]
->
ex_mode
=
EX_NATIVE
;
}
}
else
{
else
{
...
@@ -771,7 +773,7 @@ void xfer_opts()
...
@@ -771,7 +773,7 @@ void xfer_opts()
,
cfg
.
dlevent
[
i
]
->
workstr
,
sizeof
(
cfg
.
dlevent
[
i
]
->
workstr
)
-
1
,
K_EDIT
|
K_MSG
);
,
cfg
.
dlevent
[
i
]
->
workstr
,
sizeof
(
cfg
.
dlevent
[
i
]
->
workstr
)
-
1
,
K_EDIT
|
K_MSG
);
break
;
break
;
case
4
:
case
4
:
sprintf
(
str
,
"Download Event %s"
,
cfg
.
dlevent
[
i
]
->
ext
);
s
n
printf
(
str
,
sizeof
str
,
"Download Event %s"
,
cfg
.
dlevent
[
i
]
->
ext
);
getar
(
str
,
cfg
.
dlevent
[
i
]
->
arstr
);
getar
(
str
,
cfg
.
dlevent
[
i
]
->
arstr
);
break
;
break
;
}
}
...
@@ -832,8 +834,9 @@ void xfer_opts()
...
@@ -832,8 +834,9 @@ void xfer_opts()
continue
;
continue
;
}
}
memset
(
cfg
.
fextr
[
0
],
0
,
sizeof
(
fextr_t
));
memset
(
cfg
.
fextr
[
0
],
0
,
sizeof
(
fextr_t
));
strcpy
(
cfg
.
fextr
[
0
]
->
ext
,
"ZIP"
);
SAFECOPY
(
cfg
.
fextr
[
0
]
->
ext
,
"ZIP"
);
strcpy
(
cfg
.
fextr
[
0
]
->
cmd
,
"%@unzip -Cojqq %f %s -d %g"
);
SAFECOPY
(
cfg
.
fextr
[
0
]
->
cmd
,
"%@unzip -Cojqq %f %s -d %g"
);
cfg
.
fextr
[
0
]
->
ex_mode
=
EX_NATIVE
;
}
}
else
{
else
{
...
@@ -915,8 +918,7 @@ void xfer_opts()
...
@@ -915,8 +918,7 @@ void xfer_opts()
toggle_flag
(
native_opt
,
&
cfg
.
fextr
[
i
]
->
ex_mode
,
EX_NATIVE
,
false
,
native_help
);
toggle_flag
(
native_opt
,
&
cfg
.
fextr
[
i
]
->
ex_mode
,
EX_NATIVE
,
false
,
native_help
);
break
;
break
;
case
3
:
case
3
:
sprintf
(
str
,
"Extractable File Type %s"
snprintf
(
str
,
sizeof
str
,
"Extractable File Type %s"
,
cfg
.
fextr
[
i
]
->
ext
);
,
cfg
.
fextr
[
i
]
->
ext
);
getar
(
str
,
cfg
.
fextr
[
i
]
->
arstr
);
getar
(
str
,
cfg
.
fextr
[
i
]
->
arstr
);
break
;
break
;
}
}
...
@@ -976,8 +978,9 @@ void xfer_opts()
...
@@ -976,8 +978,9 @@ void xfer_opts()
continue
;
continue
;
}
}
memset
(
cfg
.
fcomp
[
0
],
0
,
sizeof
(
fcomp_t
));
memset
(
cfg
.
fcomp
[
0
],
0
,
sizeof
(
fcomp_t
));
strcpy
(
cfg
.
fcomp
[
0
]
->
ext
,
"ZIP"
);
SAFECOPY
(
cfg
.
fcomp
[
0
]
->
ext
,
"ZIP"
);
strcpy
(
cfg
.
fcomp
[
0
]
->
cmd
,
"%@zip -jD %f %s"
);
SAFECOPY
(
cfg
.
fcomp
[
0
]
->
cmd
,
"%@zip -jD %f %s"
);
cfg
.
fcomp
[
0
]
->
ex_mode
=
EX_NATIVE
;
}
}
else
{
else
{
for
(
j
=
cfg
.
total_fcomps
;
j
>
i
;
j
--
)
for
(
j
=
cfg
.
total_fcomps
;
j
>
i
;
j
--
)
...
@@ -1058,8 +1061,7 @@ void xfer_opts()
...
@@ -1058,8 +1061,7 @@ void xfer_opts()
toggle_flag
(
native_opt
,
&
cfg
.
fcomp
[
i
]
->
ex_mode
,
EX_NATIVE
,
false
,
native_help
);
toggle_flag
(
native_opt
,
&
cfg
.
fcomp
[
i
]
->
ex_mode
,
EX_NATIVE
,
false
,
native_help
);
break
;
break
;
case
3
:
case
3
:
sprintf
(
str
,
"Compressible File Type %s"
snprintf
(
str
,
sizeof
str
,
"Compressible File Type %s"
,
cfg
.
fcomp
[
i
]
->
ext
);
,
cfg
.
fcomp
[
i
]
->
ext
);
getar
(
str
,
cfg
.
fcomp
[
i
]
->
arstr
);
getar
(
str
,
cfg
.
fcomp
[
i
]
->
arstr
);
break
;
break
;
}
}
...
@@ -1126,6 +1128,7 @@ void xfer_opts()
...
@@ -1126,6 +1128,7 @@ void xfer_opts()
}
}
memset
(
cfg
.
prot
[
0
],
0
,
sizeof
(
prot_t
));
memset
(
cfg
.
prot
[
0
],
0
,
sizeof
(
prot_t
));
cfg
.
prot
[
0
]
->
mnemonic
=
'?'
;
cfg
.
prot
[
0
]
->
mnemonic
=
'?'
;
cfg
.
prot
[
0
]
->
misc
=
PROT_NATIVE
;
}
else
{
}
else
{
for
(
j
=
cfg
.
total_prots
;
j
>
i
;
j
--
)
for
(
j
=
cfg
.
total_prots
;
j
>
i
;
j
--
)
cfg
.
prot
[
j
]
=
cfg
.
prot
[
j
-
1
];
cfg
.
prot
[
j
]
=
cfg
.
prot
[
j
-
1
];
...
@@ -1217,7 +1220,7 @@ void xfer_opts()
...
@@ -1217,7 +1220,7 @@ void xfer_opts()
,
cfg
.
prot
[
i
]
->
name
,
sizeof
(
cfg
.
prot
[
i
]
->
name
)
-
1
,
K_EDIT
);
,
cfg
.
prot
[
i
]
->
name
,
sizeof
(
cfg
.
prot
[
i
]
->
name
)
-
1
,
K_EDIT
);
break
;
break
;
case
2
:
case
2
:
sprintf
(
str
,
"Protocol %s"
,
cfg
.
prot
[
i
]
->
name
);
s
n
printf
(
str
,
sizeof
str
,
"Protocol %s"
,
cfg
.
prot
[
i
]
->
name
);
getar
(
str
,
cfg
.
prot
[
i
]
->
arstr
);
getar
(
str
,
cfg
.
prot
[
i
]
->
arstr
);
break
;
break
;
case
3
:
case
3
:
...
...
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