X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/blobdiff_plain/17d5977bf8d24a1b0abb5f52a8453322f21a994d..41f33f9c1dac5381412bcab57c971fd08d1d8613:/lib/functions.php?ds=inline diff --git a/lib/functions.php b/lib/functions.php index 850386b..cfb2703 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1205,10 +1205,13 @@ function jirafeau_encrypt_file($fp_src, $fp_dst) /* Crypt file. */ $r = fopen($fp_src, 'r'); $w = fopen($fp_dst, 'c'); - while (!feof($r)) { - $enc = mcrypt_generic($m, fread($r, 1024)); - if (fwrite($w, $enc) === false) { - return ''; + while (!feof($r)) { + $to_enc = fread($r, 1024); + if (strlen($to_enc) > 0) { + $enc = mcrypt_generic($m, $to_enc); + if (fwrite($w, $enc) === false) { + return ''; + } } } fclose($r);