djvulibre/CVE-2021-3630.patch

31 lines
694 B
Diff
Raw Normal View History

2021-07-07 11:53:33 +08:00
From a613ff8a73585b55359e9b7128b4a30665b1f191 Mon Sep 17 00:00:00 2001
Author: Leon Bottou <leon@bottou.org>
Date: Thu Jun 27 18:38:03 2019 -0400
---
libdjvu/GString.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libdjvu/GString.cpp b/libdjvu/GString.cpp
index 181c0b2..f71e6b3 100644
--- a/libdjvu/GString.cpp
+++ b/libdjvu/GString.cpp
@@ -1212,11 +1212,11 @@ GP<GStringRep>
GStringRep::getbuf(int n) const
{
GP<GStringRep> retval;
- if(n< 0)
+ if(n < 0)
n=strlen(data);
- if(n>0)
+ if(n >= 0)
{
- retval=blank(n);
+ retval=blank((n>0) ? n : 1);
char *ndata=retval->data;
strncpy(ndata,data,n);
ndata[n]=0;
--
2.23.0