Skip to content

Commit

Permalink
lib: Fixed potential crash in i_stream_stat() failures.
Browse files Browse the repository at this point in the history
We shouldn't have been copying parent's stream_errno here. Especially
because the parent can be NULL.
  • Loading branch information
sirainen committed May 13, 2016
1 parent 75a7ba7 commit 6eb0192
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/lib/istream.c
Expand Up @@ -811,10 +811,8 @@ static int
i_stream_default_get_size(struct istream_private *stream,
bool exact, uoff_t *size_r)
{
if (stream->stat(stream, exact) < 0) {
stream->istream.stream_errno = stream->parent->stream_errno;
if (stream->stat(stream, exact) < 0)
return -1;
}
if (stream->statbuf.st_size == -1)
return 0;

Expand Down

0 comments on commit 6eb0192

Please sign in to comment.