Fix CVE-2017-6891 in minitasn1 code
[platform/upstream/gnutls.git] / gl / vasnprintf.c
index c291be1..791f674 100644 (file)
@@ -1886,7 +1886,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
             else
               {
                 do
-                  result[length++] = *cp++;
+                  result[length++] = (unsigned char) *cp++;
                 while (--n > 0);
               }
           }
@@ -4793,7 +4793,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                           {
                             const FCHAR_T *mp = dp->width_start;
                             do
-                              *fbp++ = *mp++;
+                              *fbp++ = (unsigned char) *mp++;
                             while (--n > 0);
                           }
                       }
@@ -4814,7 +4814,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                           {
                             const FCHAR_T *mp = dp->precision_start;
                             do
-                              *fbp++ = *mp++;
+                              *fbp++ = (unsigned char) *mp++;
                             while (--n > 0);
                           }
                       }
@@ -5382,7 +5382,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                             tmpsrc += count;
                             tmpdst += count;
                             for (n = count; n > 0; n--)
-                              *--tmpdst = *--tmpsrc;
+                              *--tmpdst = (unsigned char) *--tmpsrc;
                           }
                       }
 #endif