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
431a70b1
Commit
431a70b1
authored
Mar 03, 2022
by
Rob Swindell
💬
Browse files
Fix CID 33227: Argument cannot be negative
parent
5051ad34
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
src/sbbs3/str.cpp
src/sbbs3/str.cpp
+6
-3
No files found.
src/sbbs3/str.cpp
View file @
431a70b1
...
...
@@ -302,23 +302,26 @@ void sbbs_t::sof(char *fname, char *answers, long len)
int
file
;
long
length
,
l
=
0
,
m
,
a
=
0
;
*
answers
=
'\0'
;
sprintf
(
str
,
"%s%s.sif"
,
cfg
.
text_dir
,
fname
);
if
((
file
=
nopen
(
str
,
O_RDONLY
))
==-
1
)
{
errormsg
(
WHERE
,
ERR_OPEN
,
str
,
O_RDONLY
);
answers
[
0
]
=
0
;
return
;
}
length
=
(
long
)
filelength
(
file
);
if
(
length
<
0
)
{
close
(
file
);
errormsg
(
WHERE
,
ERR_CHK
,
str
,
length
);
return
;
}
if
((
buf
=
(
char
*
)
calloc
(
length
+
1
,
1
))
==
0
)
{
close
(
file
);
errormsg
(
WHERE
,
ERR_ALLOC
,
str
,
length
);
answers
[
0
]
=
0
;
return
;
}
if
(
lread
(
file
,
buf
,
length
)
!=
length
)
{
close
(
file
);
errormsg
(
WHERE
,
ERR_READ
,
str
,
length
);
answers
[
0
]
=
0
;
free
(
buf
);
return
;
}
...
...
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