File fix-CVE-2021-38185_3.patch of Package cpio.20895
Index: cpio-2.12/src/dstring.c
===================================================================
--- cpio-2.12.orig/src/dstring.c
+++ cpio-2.12/src/dstring.c
@@ -118,7 +118,7 @@ void
ds_concat (dynamic_string *s, char const *str)
{
size_t len = strlen (str);
- while (len + 1 > s->ds_size)
+ while (len + s->ds_idx + 1 > s->ds_size)
s->ds_string = x2nrealloc (s->ds_string, &s->ds_size, 1);
memcpy (s->ds_string + s->ds_idx, str, len);
s->ds_idx += len;