Skip to content
Permalink
Browse files Browse the repository at this point in the history
check for input buffer size on datastream::gets
  • Loading branch information
alextutubalin committed Apr 12, 2021
1 parent 1dbed6b commit bc3aaf4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libraw_datastream.cpp
Expand Up @@ -287,6 +287,7 @@ INT64 LibRaw_file_datastream::tell()

char *LibRaw_file_datastream::gets(char *str, int sz)
{
if(sz<1) return NULL;
LR_STREAM_CHK();
std::istream is(f.get());
is.getline(str, sz);
Expand Down Expand Up @@ -421,6 +422,7 @@ INT64 LibRaw_buffer_datastream::tell()

char *LibRaw_buffer_datastream::gets(char *s, int sz)
{
if(sz<1) return NULL;
unsigned char *psrc, *pdest, *str;
str = (unsigned char *)s;
psrc = buf + streampos;
Expand Down Expand Up @@ -618,6 +620,7 @@ INT64 LibRaw_bigfile_datastream::tell()

char *LibRaw_bigfile_datastream::gets(char *str, int sz)
{
if(sz<1) return NULL;
LR_BF_CHK();
return fgets(str, sz, f);
}
Expand Down

0 comments on commit bc3aaf4

Please sign in to comment.