]> granicus.if.org Git - php/commitdiff
improve condition
authorAnatol Belski <ab@php.net>
Wed, 12 Aug 2015 08:58:21 +0000 (10:58 +0200)
committerAnatol Belski <ab@php.net>
Wed, 12 Aug 2015 12:50:43 +0000 (14:50 +0200)
same as CSPRNG, break by EOF

ext/mcrypt/mcrypt.c

index bdb119fd4129a74cbe3fbaf99d402f5b0d823f99..a9098ed2836e1817ff2039912d8fbb533943c624 100644 (file)
@@ -1377,7 +1377,7 @@ PHP_FUNCTION(mcrypt_create_iv)
 
                while (read_bytes < size) {
                        n = read(*fd, iv + read_bytes, size - read_bytes);
-                       if (n < 0) {
+                       if (n <= 0) {
                                break;
                        }
                        read_bytes += n;