]> granicus.if.org Git - libexpat/commitdiff
xmltok.c: Use memcpy
authorSebastian Pipping <sebastian@pipping.org>
Mon, 28 Aug 2017 20:15:11 +0000 (22:15 +0200)
committerSebastian Pipping <sebastian@pipping.org>
Mon, 28 Aug 2017 20:21:10 +0000 (22:21 +0200)
Fixes false positive Clang (4.0.1) Static Analyzer warning (issue #9)
as a side-effect.

expat/Changes
expat/lib/xmltok.c

index 26df63db2d1b3483a1035732a53ca20619f2bbd6..789ca9ba5e4356daaa4c434dcecd51465cdddad1 100644 (file)
@@ -19,7 +19,7 @@ Release 2.2.5 ???????????????????
        #126 #127  Windows: Fix compilation for Visual Studio 2012
             #129  examples: Fix compilation for XML_UNICODE_WCHAR_T
             #130  benchmark: Fix compilation for XML_UNICODE_WCHAR_T
-                  xmlwf: Address Clang Static Analyzer warning
+              #9  Address two Clang Static Analyzer false positives
 
         Special thanks to:
             Benbuck Nason
index 39b1f6429719b06f2ac3d2e7245bc3d428c8788f..bf1e99d32821310c2b400521515dc242426c7f1f 100644 (file)
@@ -1465,9 +1465,8 @@ unknown_toUtf8(const ENCODING *enc,
         return XML_CONVERT_OUTPUT_EXHAUSTED;
       (*fromP)++;
     }
-    do {
-      *(*toP)++ = *utf8++;
-    } while (--n != 0);
+    memcpy(*toP, utf8, n);
+    *toP += n;
   }
 }