File libraw-CVE-2021-32142.patch of Package libraw.30992

iff --git a/src/libraw_datastream.cpp b/src/libraw_datastream.cpp
index a5c1a84a..a31ae9dd 100644
Index: LibRaw-0.20.2/src/libraw_datastream.cpp
===================================================================
--- LibRaw-0.20.2.orig/src/libraw_datastream.cpp
+++ LibRaw-0.20.2/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);
 }
openSUSE Build Service is sponsored by