]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/md5.cc
try not to call memcpy with length 0 in hash calculations
[apt.git] / apt-pkg / contrib / md5.cc
index 4351aeb22f23d6b0d17e7b54cf5c4e066798ad6e..ff7868fe20919403cf7574b90dd53012b4c32ff3 100644 (file)
 #include <config.h>
 
 #include <apt-pkg/md5.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/macros.h>
 
+#include <stdint.h>
 #include <string.h>
-#include <unistd.h>
-#include <netinet/in.h>                          // For htonl
-#include <inttypes.h>
                                                                        /*}}}*/
 
 // byteSwap - Swap bytes in a buffer                                   /*{{{*/
@@ -191,6 +187,8 @@ bool MD5Summation::Add(const unsigned char *data,unsigned long long len)
 {
    if (Done == true)
       return false;
+   if (len == 0)
+      return true;
 
    uint32_t *buf = (uint32_t *)Buf;
    uint32_t *bytes = (uint32_t *)Bytes;