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
ecce2a8a
Commit
ecce2a8a
authored
Mar 02, 2022
by
Rob Swindell
💬
Browse files
Detect smb_fallocdat() and ftell() failures
CID 33245
parent
92cb6318
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
src/sbbs3/smbutil.c
src/sbbs3/smbutil.c
+14
-4
No files found.
src/sbbs3/smbutil.c
View file @
ecce2a8a
...
...
@@ -1196,16 +1196,26 @@ void packmsgs(ulong packable)
continue
;
}
off_t
offset
;
if
(
!
(
smb
.
status
.
attr
&
SMB_HYPERALLOC
))
{
msg
.
hdr
.
offset
=
(
uint32_t
)
smb_fallocdat
(
&
smb
,(
uint32_t
)
m
,
1
);
datoffset
[
datoffsets
].
new
=
msg
.
hdr
.
offset
;
offset
=
smb_fallocdat
(
&
smb
,(
uint32_t
)
m
,
1
);
if
(
offset
<
0
)
{
fprintf
(
errfp
,
"
\n
%s!Data allocation failure: %ld
\n
"
,
beep
,
(
long
)
offset
);
continue
;
}
datoffset
[
datoffsets
].
new
=
(
uint32_t
)
offset
;
datoffsets
++
;
fseek
(
tmp_sdt
,
msg
.
hdr
.
offset
,
SEEK_SET
);
fseek
o
(
tmp_sdt
,
offset
,
SEEK_SET
);
}
else
{
fseek
(
tmp_sdt
,
0L
,
SEEK_END
);
msg
.
hdr
.
offset
=
ftell
(
tmp_sdt
);
offset
=
ftell
(
tmp_sdt
);
if
(
offset
<
0
)
{
fprintf
(
errfp
,
"
\n
%s!ftell() ERROR %d
\n
"
,
beep
,
errno
);
continue
;
}
}
msg
.
hdr
.
offset
=
(
uint32_t
)
offset
;
/* Actually copy the data */
...
...
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