peterhuene opened PR #2620 from fix-fd-readdir
to main
:
Previously,
fd_readdir
was truncating directory entry names based on the
calculation ofmin(name_len, buf_len - bufused)
, butbufused
was not being
updated after writing in thedirent
structure to the buffer.This allowed
bufused
to be incremented beyondbuf_len
and returned as the
number of bytes written to the buffer, which is invalid.This fix adjusts
bufused
when the buffer is written to for thedirent
so
that name truncation happens as expected.Fixes #2618.
peterhuene requested sunfishcode for a review on PR #2620.
peterhuene updated PR #2620 from fix-fd-readdir
to main
:
Previously,
fd_readdir
was truncating directory entry names based on the
calculation ofmin(name_len, buf_len - bufused)
, butbufused
was not being
updated after writing in thedirent
structure to the buffer.This allowed
bufused
to be incremented beyondbuf_len
and returned as the
number of bytes written to the buffer, which is invalid.This fix adjusts
bufused
when the buffer is written to for thedirent
so
that name truncation happens as expected.Fixes #2618.
peterhuene updated PR #2620 from fix-fd-readdir
to main
:
Previously,
fd_readdir
was truncating directory entry names based on the
calculation ofmin(name_len, buf_len - bufused)
, butbufused
was not being
updated after writing in thedirent
structure to the buffer.This allowed
bufused
to be incremented beyondbuf_len
and returned as the
number of bytes written to the buffer, which is invalid.This fix adjusts
bufused
when the buffer is written to for thedirent
so
that name truncation happens as expected.Fixes #2618.
peterhuene updated PR #2620 from fix-fd-readdir
to main
:
Previously,
fd_readdir
was truncating directory entry names based on the
calculation ofmin(name_len, buf_len - bufused)
, butbufused
was not being
updated after writing in thedirent
structure to the buffer.This allowed
bufused
to be incremented beyondbuf_len
and returned as the
number of bytes written to the buffer, which is invalid.This fix adjusts
bufused
when the buffer is written to for thedirent
so
that name truncation happens as expected.Fixes #2618.
pchickey submitted PR Review.
pchickey created PR Review Comment:
the
buf.add(dirent_copy_len)?
performs this overflow check, so bufused doesnt have to have a checked add
pchickey submitted PR Review.
pchickey created PR Review Comment:
same here, no need to check the add
pchickey submitted PR Review.
peterhuene updated PR #2620 from fix-fd-readdir
to main
:
Previously,
fd_readdir
was truncating directory entry names based on the
calculation ofmin(name_len, buf_len - bufused)
, butbufused
was not being
updated after writing in thedirent
structure to the buffer.This allowed
bufused
to be incremented beyondbuf_len
and returned as the
number of bytes written to the buffer, which is invalid.This fix adjusts
bufused
when the buffer is written to for thedirent
so
that name truncation happens as expected.Fixes #2618.
peterhuene merged PR #2620.
Last updated: Dec 23 2024 at 12:05 UTC