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
7821ccfb
Commit
7821ccfb
authored
1 year ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
Replace some sprintf calls with snprintf
... much more still to do, I'm sure.
parent
00a300a1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#6150
passed
1 year ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/sbbs3/qwk.cpp
+22
-22
22 additions, 22 deletions
src/sbbs3/qwk.cpp
src/sbbs3/un_qwk.cpp
+5
-5
5 additions, 5 deletions
src/sbbs3/un_qwk.cpp
src/sbbs3/un_rep.cpp
+1
-1
1 addition, 1 deletion
src/sbbs3/un_rep.cpp
with
28 additions
and
28 deletions
src/sbbs3/qwk.cpp
+
22
−
22
View file @
7821ccfb
...
...
@@ -180,7 +180,7 @@ void sbbs_t::update_qwkroute(char *via)
if
(
via
==
NULL
)
{
if
(
!
total_qwknodes
)
return
;
sprintf
(
str
,
"%sqnet/route.dat"
,
cfg
.
data_dir
);
s
n
printf
(
str
,
sizeof
str
,
"%sqnet/route.dat"
,
cfg
.
data_dir
);
if
((
stream
=
fnopen
(
&
file
,
str
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
))
!=
NULL
)
{
t
=
time
(
NULL
);
t
-=
(
90L
*
24L
*
60L
*
60L
);
...
...
@@ -198,7 +198,7 @@ void sbbs_t::update_qwkroute(char *via)
}
if
(
!
total_qwknodes
)
{
sprintf
(
str
,
"%sqnet/route.dat"
,
cfg
.
data_dir
);
s
n
printf
(
str
,
sizeof
str
,
"%sqnet/route.dat"
,
cfg
.
data_dir
);
if
((
stream
=
fnopen
(
&
file
,
str
,
O_RDONLY
))
!=
NULL
)
{
while
(
!
feof
(
stream
))
{
if
(
!
fgets
(
str
,
sizeof
(
str
),
stream
))
...
...
@@ -208,7 +208,7 @@ void sbbs_t::update_qwkroute(char *via)
p
=
strchr
(
str
,
':'
);
if
(
!
p
)
continue
;
*
p
=
0
;
sprintf
(
node
,
"%.8s"
,
str
+
9
);
s
n
printf
(
node
,
sizeof
node
,
"%.8s"
,
str
+
9
);
tp
=
strchr
(
node
,
' '
);
/* change "node bbs:" to "node:" */
if
(
tp
)
*
tp
=
0
;
for
(
i
=
0
;
i
<
total_qwknodes
;
i
++
)
...
...
@@ -226,7 +226,7 @@ void sbbs_t::update_qwkroute(char *via)
strcpy
(
qwknode
[
i
].
id
,
node
);
p
++
;
while
(
*
p
&&
*
p
<=
' '
)
p
++
;
sprintf
(
qwknode
[
i
].
path
,
"%.127s"
,
p
);
s
n
printf
(
qwknode
[
i
].
path
,
sizeof
qwknode
[
i
].
path
,
"%.127s"
,
p
);
qwknode
[
i
].
time
=
t
;
}
fclose
(
stream
);
...
...
@@ -239,7 +239,7 @@ void sbbs_t::update_qwkroute(char *via)
while
(
p
&&
*
p
)
{
p
++
;
sprintf
(
node
,
"%.8s"
,
p
);
s
n
printf
(
node
,
sizeof
node
,
"%.8s"
,
p
);
tp
=
strchr
(
node
,
'/'
);
if
(
tp
)
*
tp
=
0
;
tp
=
strchr
(
node
,
' '
);
/* no spaces allowed */
...
...
@@ -255,8 +255,8 @@ void sbbs_t::update_qwkroute(char *via)
}
total_qwknodes
++
;
}
sprintf
(
qwknode
[
i
].
id
,
"%.8s"
,
node
);
sprintf
(
qwknode
[
i
].
path
,
"%.*s"
,(
int
)((
p
-
1
)
-
via
),
via
);
s
n
printf
(
qwknode
[
i
].
id
,
sizeof
qwknode
[
i
].
id
,
"%.8s"
,
node
);
s
n
printf
(
qwknode
[
i
].
path
,
sizeof
qwknode
[
i
].
path
,
"%.*s"
,(
int
)((
p
-
1
)
-
via
),
via
);
qwknode
[
i
].
time
=
time
(
NULL
);
p
=
strchr
(
p
,
'/'
);
}
...
...
@@ -278,7 +278,7 @@ void sbbs_t::qwk_success(uint msgcnt, char bi, char prepack)
char
id
[
LEN_QWKID
+
1
];
SAFECOPY
(
id
,
useron
.
alias
);
strlwr
(
id
);
sprintf
(
str
,
"%sqnet/%s.out/"
,
cfg
.
data_dir
,
id
);
s
n
printf
(
str
,
sizeof
str
,
"%sqnet/%s.out/"
,
cfg
.
data_dir
,
id
);
int
result
=
delfiles
(
str
,
ALLFILES
);
if
(
result
<
0
)
errormsg
(
WHERE
,
ERR_REMOVE
,
str
,
result
);
...
...
@@ -289,7 +289,7 @@ void sbbs_t::qwk_success(uint msgcnt, char bi, char prepack)
logline
(
"D-"
,
str
);
posts_read
+=
msgcnt
;
sprintf
(
str
,
"%sfile/%04u.qwk"
,
cfg
.
data_dir
,
useron
.
number
);
s
n
printf
(
str
,
sizeof
str
,
"%sfile/%04u.qwk"
,
cfg
.
data_dir
,
useron
.
number
);
if
(
fexistcase
(
str
))
remove
(
str
);
...
...
@@ -303,7 +303,7 @@ void sbbs_t::qwk_success(uint msgcnt, char bi, char prepack)
if
(
useron
.
rest
&
FLAG
(
'Q'
))
useron
.
qwk
|=
(
QWK_EMAIL
|
QWK_ALLMAIL
|
QWK_DELMAIL
);
if
(
useron
.
qwk
&
(
QWK_EMAIL
|
QWK_ALLMAIL
))
{
sprintf
(
smb
.
file
,
"%smail"
,
cfg
.
data_dir
);
s
n
printf
(
smb
.
file
,
sizeof
smb
.
file
,
"%smail"
,
cfg
.
data_dir
);
smb
.
retry_time
=
cfg
.
smb_retry_time
;
smb
.
subnum
=
INVALID_SUB
;
if
((
i
=
smb_open
(
&
smb
))
!=
0
)
{
...
...
@@ -397,7 +397,7 @@ void sbbs_t::qwk_sec()
action
=
NODE_TQWK
;
sync
();
bputs
(
text
[
QWKPrompt
]);
sprintf
(
str
,
"?UDCSP
\r
%c"
,
quit_key
());
s
n
printf
(
str
,
sizeof
str
,
"?UDCSP
\r
%c"
,
quit_key
());
ch
=
(
char
)
getkeys
(
str
,
0
);
if
(
ch
>
' '
)
logch
(
ch
,
0
);
...
...
@@ -576,7 +576,7 @@ void sbbs_t::qwk_sec()
}
if
(
ch
==
'D'
)
{
/* Download QWK Packet of new messages */
sprintf
(
str
,
"%s%s.qwk"
,
cfg
.
temp_dir
,
cfg
.
sys_id
);
s
n
printf
(
str
,
sizeof
str
,
"%s%s.qwk"
,
cfg
.
temp_dir
,
cfg
.
sys_id
);
if
(
!
fexistcase
(
str
)
&&
!
pack_qwk
(
str
,
&
msgcnt
,
0
))
{
for
(
i
=
0
;
i
<
cfg
.
total_subs
;
i
++
)
subscan
[
i
].
ptr
=
sav_ptr
[
i
];
...
...
@@ -605,10 +605,10 @@ void sbbs_t::qwk_sec()
/***************/
xfer_prot_menu
(
XFER_DOWNLOAD
);
mnemonics
(
text
[
ProtocolOrQuit
]);
sprintf
(
tmp2
,
"%c"
,
quit_key
());
s
n
printf
(
tmp2
,
sizeof
tmp2
,
"%c"
,
quit_key
());
for
(
i
=
0
;
i
<
cfg
.
total_prots
;
i
++
)
if
(
cfg
.
prot
[
i
]
->
dlcmd
[
0
]
&&
chk_ar
(
cfg
.
prot
[
i
]
->
ar
,
&
useron
,
&
client
))
{
sprintf
(
tmp
,
"%c"
,
cfg
.
prot
[
i
]
->
mnemonic
);
s
n
printf
(
tmp
,
sizeof
tmp
,
"%c"
,
cfg
.
prot
[
i
]
->
mnemonic
);
strcat
(
tmp2
,
tmp
);
}
ungetkey
(
useron
.
prot
);
...
...
@@ -624,8 +624,8 @@ void sbbs_t::qwk_sec()
&&
chk_ar
(
cfg
.
prot
[
i
]
->
ar
,
&
useron
,
&
client
))
break
;
if
(
i
<
cfg
.
total_prots
)
{
sprintf
(
str
,
"%s%s.qwk"
,
cfg
.
temp_dir
,
cfg
.
sys_id
);
sprintf
(
tmp2
,
"%s.qwk"
,
cfg
.
sys_id
);
s
n
printf
(
str
,
sizeof
str
,
"%s%s.qwk"
,
cfg
.
temp_dir
,
cfg
.
sys_id
);
s
n
printf
(
tmp2
,
sizeof
tmp2
,
"%s.qwk"
,
cfg
.
sys_id
);
error
=
protocol
(
cfg
.
prot
[
i
],
XFER_DOWNLOAD
,
str
,
nulstr
,
false
);
if
(
!
checkprotresult
(
cfg
.
prot
[
i
],
error
,
tmp2
))
{
last_ns_time
=
ns_time
;
...
...
@@ -654,10 +654,10 @@ void sbbs_t::qwk_sec()
/******************/
xfer_prot_menu
(
XFER_UPLOAD
);
mnemonics
(
text
[
ProtocolOrQuit
]);
sprintf
(
tmp2
,
"%c"
,
quit_key
());
s
n
printf
(
tmp2
,
sizeof
tmp2
,
"%c"
,
quit_key
());
for
(
i
=
0
;
i
<
cfg
.
total_prots
;
i
++
)
if
(
cfg
.
prot
[
i
]
->
ulcmd
[
0
]
&&
chk_ar
(
cfg
.
prot
[
i
]
->
ar
,
&
useron
,
&
client
))
{
sprintf
(
tmp
,
"%c"
,
cfg
.
prot
[
i
]
->
mnemonic
);
s
n
printf
(
tmp
,
sizeof
tmp
,
"%c"
,
cfg
.
prot
[
i
]
->
mnemonic
);
strcat
(
tmp2
,
tmp
);
}
ch
=
(
char
)
getkeys
(
tmp2
,
0
);
...
...
@@ -669,7 +669,7 @@ void sbbs_t::qwk_sec()
break
;
if
(
i
>=
cfg
.
total_prots
)
/* This shouldn't happen */
continue
;
sprintf
(
str
,
"%s%s.rep"
,
cfg
.
temp_dir
,
cfg
.
sys_id
);
s
n
printf
(
str
,
sizeof
str
,
"%s%s.rep"
,
cfg
.
temp_dir
,
cfg
.
sys_id
);
protocol
(
cfg
.
prot
[
i
],
XFER_UPLOAD
,
str
,
nulstr
,
true
);
unpack_rep
();
delfiles
(
cfg
.
temp_dir
,
ALLFILES
);
...
...
@@ -719,7 +719,7 @@ void sbbs_t::qwkcfgline(char *buf, int subnum)
uint
qwk
=
useron
.
qwk
;
file_t
f
=
{{}};
sprintf
(
str
,
"%-25.25s"
,
buf
);
/* Note: must be space-padded, left justified */
s
n
printf
(
str
,
sizeof
str
,
"%-25.25s"
,
buf
);
/* Note: must be space-padded, left justified */
strupr
(
str
);
bprintf
(
"
\1
n
\r\n\1
b
\1
hQWK Control [
\1
c%s
\1
b]:
\1
g%s
\r\n
"
,
subnum
==
INVALID_SUB
?
"Mail"
:
cfg
.
sub
[
subnum
]
->
qwkname
,
str
);
...
...
@@ -735,7 +735,7 @@ void sbbs_t::qwkcfgline(char *buf, int subnum)
y
=
l
-
(
x
*
1000
);
if
(
x
>=
usrgrps
||
y
>=
usrsubs
[
x
])
{
bprintf
(
text
[
QWKInvalidConferenceN
],
l
);
sprintf
(
str
,
"Invalid conference number %u"
,
l
);
s
n
printf
(
str
,
sizeof
str
,
"Invalid conference number %u"
,
l
);
logline
(
LOG_NOTICE
,
"Q!"
,
str
);
}
else
...
...
@@ -971,7 +971,7 @@ bool sbbs_t::qwk_voting(str_list_t* ini, int offset, smb_net_type_t net_type, co
int
found
;
str_list_t
section_list
=
iniGetSectionList
(
*
ini
,
/* prefix: */
NULL
);
sprintf
(
location
,
"%x"
,
offset
);
s
n
printf
(
location
,
sizeof
location
,
"%x"
,
offset
);
if
((
found
=
strListFind
(
section_list
,
location
,
/* case_sensitive: */
FALSE
))
<
0
)
{
lprintf
(
LOG_NOTICE
,
"QWK vote message (offset: %d) not found in %s VOTING.DAT"
,
offset
,
qnet_id
);
strListFree
(
&
section_list
);
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/un_qwk.cpp
+
5
−
5
View file @
7821ccfb
...
...
@@ -157,7 +157,7 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
errors
++
;
continue
;
}
sprintf
(
tmp
,
"%.6s"
,
block
+
116
);
s
n
printf
(
tmp
,
sizeof
tmp
,
"%.6s"
,
block
+
116
);
blocks
=
atoi
(
tmp
);
/* i = number of blocks */
n
=
(
uint
)
block
[
123
]
|
(((
uint
)
block
[
124
])
<<
8
);
/* conference number */
if
(
blocks
<
2
)
{
...
...
@@ -208,7 +208,7 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
}
smb_stack
(
&
smb
,
SMB_STACK_PUSH
);
sprintf
(
smb
.
file
,
"%smail"
,
cfg
.
data_dir
);
s
n
printf
(
smb
.
file
,
sizeof
smb
.
file
,
"%smail"
,
cfg
.
data_dir
);
smb
.
retry_time
=
cfg
.
smb_retry_time
;
smb
.
subnum
=
INVALID_SUB
;
if
((
k
=
smb_open
(
&
smb
))
!=
0
)
{
...
...
@@ -379,7 +379,7 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
dir
=
opendir
(
cfg
.
temp_dir
);
while
(
dir
!=
NULL
&&
(
dirent
=
readdir
(
dir
))
!=
NULL
)
{
sprintf
(
str
,
"%s%s"
,
cfg
.
temp_dir
,
dirent
->
d_name
);
s
n
printf
(
str
,
sizeof
str
,
"%s%s"
,
cfg
.
temp_dir
,
dirent
->
d_name
);
if
(
isdir
(
str
))
/* sub-dir */
continue
;
...
...
@@ -396,7 +396,7 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
// Copy files
SAFEPRINTF2
(
fname
,
"%s/%s"
,
inbox
,
dirent
->
d_name
);
mv
(
str
,
fname
,
1
/* overwrite */
);
sprintf
(
str
,
text
[
ReceivedFileViaQWK
],
dirent
->
d_name
,
cfg
.
qhub
[
hubnum
]
->
id
);
s
n
printf
(
str
,
sizeof
str
,
text
[
ReceivedFileViaQWK
],
dirent
->
d_name
,
cfg
.
qhub
[
hubnum
]
->
id
);
putsmsg
(
1
,
str
);
lprintf
(
LOG_INFO
,
"Received file from %s: %s"
,
cfg
.
qhub
[
hubnum
]
->
id
,
dirent
->
d_name
);
}
...
...
@@ -411,7 +411,7 @@ bool sbbs_t::unpack_qwk(char *packet,uint hubnum)
"(%lu msgs) in %lu seconds (%lu msgs/sec), %lu errors, %lu dupes"
,
cfg
.
qhub
[
hubnum
]
->
id
,
tmsgs
,
t
,
tmsgs
/
t
,
errors
,
dupes
);
/* trigger timed event with internal code of 'qnet-qwk' to run */
sprintf
(
str
,
"%sqnet-qwk.now"
,
cfg
.
data_dir
);
s
n
printf
(
str
,
sizeof
str
,
"%sqnet-qwk.now"
,
cfg
.
data_dir
);
ftouch
(
str
);
}
delfiles
(
cfg
.
temp_dir
,
ALLFILES
);
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/un_rep.cpp
+
1
−
1
View file @
7821ccfb
...
...
@@ -193,7 +193,7 @@ bool sbbs_t::unpack_rep(char* repfile)
errors
++
;
break
;
}
sprintf
(
tmp
,
"%.6s"
,
block
+
116
);
s
n
printf
(
tmp
,
sizeof
tmp
,
"%.6s"
,
block
+
116
);
blocks
=
atoi
(
tmp
);
/* i = number of blocks */
long
confnum
=
atol
((
char
*
)
block
+
1
);
if
(
blocks
<
2
)
{
...
...
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