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
c1d232e0
Commit
c1d232e0
authored
6 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Use GCC-assisted printf-style format/arg checking to find and fix instances
of lprintf() misuse.
parent
53754d3c
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/sbbs3/sbbsecho.c
+17
-13
17 additions, 13 deletions
src/sbbs3/sbbsecho.c
with
17 additions
and
13 deletions
src/sbbs3/sbbsecho.c
+
17
−
13
View file @
c1d232e0
...
...
@@ -106,7 +106,11 @@ bool terminated=false;
str_list_t
locked_bso_nodes
;
int
lprintf
(
int
level
,
char
*
fmt
,
...);
int
lprintf
(
int
level
,
char
*
fmt
,
...)
#if defined(__GNUC__) // Catch printf-format errors
__attribute__
((
format
(
printf
,
2
,
3
)));
#endif
;
int
mv
(
const
char
*
insrc
,
const
char
*
indest
,
bool
copy
);
time32_t
fmsgtime
(
const
char
*
str
);
void
export_echomail
(
const
char
*
sub_code
,
const
nodecfg_t
*
,
bool
rescan
);
...
...
@@ -418,7 +422,7 @@ size_t read_echostats(const char* fname, echostat_t **echostat)
iniFreeStringList
(
echoes
);
iniFreeStringList
(
ini
);
lprintf
(
LOG_DEBUG
,
"Read %u echo statistics from %s"
,
echo_count
,
fname
);
lprintf
(
LOG_DEBUG
,
"Read %
l
u echo statistics from %s"
,
echo_count
,
fname
);
return
echo_count
;
}
...
...
@@ -1487,7 +1491,7 @@ void netmail_arealist(enum arealist_type type, fidoaddr_t addr, const char* to)
fclose
(
fp
);
}
}
lprintf
(
LOG_INFO
,
"AreaFix (for %s) Created response netmail with %s (%u areas)"
lprintf
(
LOG_INFO
,
"AreaFix (for %s) Created response netmail with %s (%
l
u areas)"
,
smb_faddrtoa
(
&
addr
,
NULL
),
title
,
strListCount
(
area_list
));
strListFree
(
&
area_list
);
}
...
...
@@ -1811,10 +1815,10 @@ void alter_areas(str_list_t add_area, str_list_t del_area, fidoaddr_t addr, cons
fclose
(
nmfile
);
fclose
(
afileout
);
if
(
added
)
lprintf
(
LOG_DEBUG
,
"AreaFix (for %s) Added links to %u areas in %s"
lprintf
(
LOG_DEBUG
,
"AreaFix (for %s) Added links to %
l
u areas in %s"
,
smb_faddrtoa
(
&
addr
,
NULL
),
added
,
cfg
.
areafile
);
if
(
deleted
)
lprintf
(
LOG_DEBUG
,
"AreaFix (for %s) Removed links to %u areas in %s"
lprintf
(
LOG_DEBUG
,
"AreaFix (for %s) Removed links to %
l
u areas in %s"
,
smb_faddrtoa
(
&
addr
,
NULL
),
deleted
,
cfg
.
areafile
);
if
(
added
||
deleted
)
{
if
(
cfg
.
areafile_backups
==
0
||
!
backup
(
cfg
.
areafile
,
cfg
.
areafile_backups
,
/* ren: */
TRUE
))
...
...
@@ -2920,7 +2924,7 @@ void cleanup(void)
char
path
[
MAX_PATH
+
1
];
if
(
bad_areas
!=
NULL
)
{
lprintf
(
LOG_DEBUG
,
"Writing %u areas to %s"
,
strListCount
(
bad_areas
),
cfg
.
badareafile
);
lprintf
(
LOG_DEBUG
,
"Writing %
l
u areas to %s"
,
strListCount
(
bad_areas
),
cfg
.
badareafile
);
FILE
*
fp
=
fopen
(
cfg
.
badareafile
,
"wt"
);
if
(
fp
==
NULL
)
{
lprintf
(
LOG_ERR
,
"ERROR %d (%s) opening %s"
,
errno
,
strerror
(
errno
),
cfg
.
badareafile
);
...
...
@@ -5116,7 +5120,7 @@ int export_netmail(void)
int
result
=
fwrite
(
filedata
,
filelen
,
1
,
fp
);
fclose
(
fp
);
if
(
!
result
)
lprintf
(
LOG_ERR
,
"!ERROR %d (%s) writing %
l
u bytes to %s"
,
errno
,
strerror
(
errno
),
filelen
,
fpath
);
lprintf
(
LOG_ERR
,
"!ERROR %d (%s) writing %u bytes to %s"
,
errno
,
strerror
(
errno
),
filelen
,
fpath
);
else
{
lprintf
(
LOG_DEBUG
,
"Decoded MIME attachment stored as: %s"
,
fpath
);
file_attached
=
true
;
...
...
@@ -5128,7 +5132,7 @@ int export_netmail(void)
}
if
((
txt
=
smb_getmsgtxt
(
email
,
&
msg
,
GETMSGTXT_ALL
|
GETMSGTXT_PLAIN
))
==
NULL
)
{
lprintf
(
LOG_ERR
,
"!ERROR %
d
getting message text for mail msg #%u"
lprintf
(
LOG_ERR
,
"!ERROR %
s
getting message text for mail msg #%u"
,
email
->
last_error
,
msg
.
hdr
.
number
);
continue
;
}
...
...
@@ -5149,7 +5153,7 @@ int export_netmail(void)
/* Just mark as "sent" */
msg
.
hdr
.
netattr
|=
MSG_SENT
;
if
(
smb_putmsghdr
(
email
,
&
msg
)
!=
SMB_SUCCESS
)
lprintf
(
LOG_ERR
,
"!ERROR %
d
updating msg header for mail msg #%u"
lprintf
(
LOG_ERR
,
"!ERROR %
s
updating msg header for mail msg #%u"
,
email
->
last_error
,
msg
.
hdr
.
number
);
if
(
msg
.
hdr
.
auxattr
&
MSG_KILLFILE
)
delfattach
(
&
scfg
,
&
msg
);
...
...
@@ -5442,7 +5446,7 @@ void find_stray_packets(void)
continue
;
}
if
(
fread
(
&
pkthdr
,
sizeof
(
pkthdr
),
1
,
fp
)
!=
1
)
{
lprintf
(
LOG_ERR
,
"ERROR reading header (%u bytes) from stray packet: %s"
lprintf
(
LOG_ERR
,
"ERROR reading header (%
l
u bytes) from stray packet: %s"
,
sizeof
(
pkthdr
),
packet
);
fclose
(
fp
);
delfile
(
packet
,
__LINE__
);
...
...
@@ -5485,7 +5489,7 @@ void find_stray_packets(void)
listAddNode
(
&
outpkt_list
,
pkt
,
0
,
LAST_NODE
);
}
if
(
g
.
gl_pathc
)
lprintf
(
LOG_DEBUG
,
"%u stray outbound packets (%u total pkts) found in %s"
lprintf
(
LOG_DEBUG
,
"%
l
u stray outbound packets (%
l
u total pkts) found in %s"
,
listCountNodes
(
&
outpkt_list
),
g
.
gl_pathc
,
cfg
.
temp_dir
);
globfree
(
&
g
);
}
...
...
@@ -5569,7 +5573,7 @@ void import_packets(const char* inbound, nodecfg_t* inbox, bool secure)
(
void
)
fseek
(
fidomsg
,
0L
,
SEEK_SET
);
if
(
fread
(
&
pkthdr
,
sizeof
(
pkthdr
),
1
,
fidomsg
)
!=
1
)
{
fclose
(
fidomsg
);
lprintf
(
LOG_ERR
,
"ERROR line %d reading %u bytes from %s"
,
__LINE__
lprintf
(
LOG_ERR
,
"ERROR line %d reading %
l
u bytes from %s"
,
__LINE__
,
sizeof
(
pkthdr
),
packet
);
rename_bad_packet
(
packet
);
continue
;
...
...
@@ -5638,7 +5642,7 @@ void import_packets(const char* inbound, nodecfg_t* inbox, bool secure)
hdr
.
cost
=
pkdmsg
.
cost
;
SAFECOPY
(
hdr
.
time
,
pkdmsg
.
time
);
}
else
{
lprintf
(
LOG_NOTICE
,
"Grunged message (type %d) from %s at offset %
u
in packet: %s"
lprintf
(
LOG_NOTICE
,
"Grunged message (type %d) from %s at offset %
ld
in packet: %s"
,
pkdmsg
.
type
,
smb_faddrtoa
(
&
pkt_orig
,
NULL
),
msg_offset
,
packet
);
printf
(
"Grunged message!
\n
"
);
bad_packet
=
true
;
...
...
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