Fixes an infinite loop.
Bug: https://bugs.gentoo.org/638108
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
--- /dev/null
+diff --git a/src/formisc.c b/src/formisc.c
+index 338733b..c48df52 100644
+--- a/src/formisc.c
++++ b/src/formisc.c
+@@ -84,12 +84,11 @@ normal: *target++= *start++;
+ case '"':*target++=delim='"';start++;
+ }
+ ;{ int i;
+- do
++ while(*start) /* anything? */
+ if((i= *target++= *start++)==delim) /* corresponding delimiter? */
+ break;
+ else if(i=='\\'&&*start) /* skip quoted character */
+ *target++= *start++;
+- while(*start); /* anything? */
+ }
+ hitspc=2;
+ }
--- /dev/null
+diff --git a/src/formisc.c b/src/formisc.c
+index 5c2869d..54fd013 100644
+--- a/src/formisc.c
++++ b/src/formisc.c
+@@ -103,7 +103,7 @@ void loadsaved(sp)const struct saved*const sp; /* load some saved text */
+ }
+ /* append to buf */
+ void loadbuf(text,len)const char*const text;const size_t len;
+-{ if(buffilled+len>buflen) /* buf can't hold the text */
++{ while(buffilled+len>buflen) /* buf can't hold the text */
+ buf=realloc(buf,buflen+=Bsize);
+ tmemmove(buf+buffilled,text,len);buffilled+=len;
+ }
+++ /dev/null
---- a/src/formisc.c 2019-03-23 19:52:18.450174402 -0400
-+++ b/src/formisc.c 2019-03-23 19:52:47.914351039 -0400
-@@ -84,12 +84,11 @@
- case '"':*target++=delim='"';start++;
- }
- ;{ int i;
-- do
-+ while(*start);
- if((i= *target++= *start++)==delim) /* corresponding delimiter? */
- break;
- else if(i=='\\'&&*start) /* skip quoted character */
- *target++= *start++;
-- while(*start); /* anything? */
- }
- hitspc=2;
- }
-@@ -104,7 +103,7 @@
- }
- /* append to buf */
- void loadbuf(text,len)const char*const text;const size_t len;
--{ if(buffilled+len>buflen) /* buf can't hold the text */
-+{ while(buffilled+len>buflen) /* buf can't hold the text */
- buf=realloc(buf,buflen+=Bsize);
- tmemmove(buf+buffilled,text,len);buffilled+=len;
- }
eapply "${FILESDIR}/${PN}-3.22-glibc-2.10.patch"
# Fix security bugs #522114 and #638108
- eapply "${FILESDIR}/${PN}-CVE-2014-3618-16844.patch"
+ eapply "${FILESDIR}/${PN}-3.22-CVE-2014-3618.patch"
+ eapply "${FILESDIR}/${PN}-3.22-CVE-2017-16844.patch"
eapply "${FILESDIR}/${PN}-3.22-crash-fix.patch"