Browse code

bb#11269 - hash does not compute on segments smaller than the maxpatlen

Kevin Lin authored on 2015/02/26 04:55:21
Showing 1 changed files
... ...
@@ -933,7 +933,9 @@ int cli_fmap_scandesc(cli_ctx *ctx, cli_file_t ftype, uint8_t ftonly, struct cli
933 933
                     type = ret;
934 934
             }
935 935
 
936
-            if(hdb) {
936
+            /* if (bytes <= (maxpatlen * (offset!=0))), it means the last window finished the file hashing *
937
+             *   since the last window is responsible for adding intersection between windows (maxpatlen)  */
938
+            if(hdb && (bytes > (maxpatlen * (offset!=0)))) {
937 939
                 const void *data = buff + maxpatlen * (offset!=0);
938 940
                 uint32_t data_len = bytes - maxpatlen * (offset!=0);
939 941