parent
36b2fcdaab
commit
c891cc011f
@ -0,0 +1,40 @@
|
|||||||
|
From fa329f37dca4a2c938f8abb50ee4a7ef93e64fbb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alex Tutubalin <lexa@lexa.ru>
|
||||||
|
Date: Mon, 12 Apr 2021 13:21:52 +0300
|
||||||
|
Subject: [PATCH] check for input buffer size on datastream::gets
|
||||||
|
|
||||||
|
---
|
||||||
|
src/libraw_datastream.cpp | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/libraw_datastream.cpp b/src/libraw_datastream.cpp
|
||||||
|
index 606e5de73618..7e95bc749688 100644
|
||||||
|
--- a/src/libraw_datastream.cpp
|
||||||
|
+++ b/src/libraw_datastream.cpp
|
||||||
|
@@ -286,6 +286,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);
|
||||||
|
@@ -417,6 +418,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;
|
||||||
|
@@ -609,6 +611,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);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.39.2
|
||||||
|
|
Loading…
Reference in new issue