PKCS#7: avoid NULL pointer dereferences with missing content
[openssl.git] / crypto / x86_64cpuid.pl
index 862118f285858439384cbed181c056bd6b58501d..cd2567a26cff500ce8241abdbfe41cc253ed1b26 100644 (file)
@@ -7,7 +7,8 @@ if ($flavour =~ /\./) { $output = $flavour; undef $flavour; }
 $win64=0; $win64=1 if ($flavour =~ /[nm]asm|mingw64/ || $output =~ /\.asm$/);
 
 $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
-open STDOUT,"| $^X ${dir}perlasm/x86_64-xlate.pl $flavour $output";
+open OUT,"| \"$^X\" ${dir}perlasm/x86_64-xlate.pl $flavour $output";
+*STDOUT=*OUT;
 
 if ($win64)    { $arg1="%rcx"; $arg2="%rdx"; }
 else           { $arg1="%rdi"; $arg2="%rsi"; }
@@ -145,11 +146,14 @@ OPENSSL_cleanse:
        xor     %rax,%rax
        cmp     \$15,$arg2
        jae     .Lot
+       cmp     \$0,$arg2
+       je      .Lret
 .Little:
        mov     %al,($arg1)
        sub     \$1,$arg2
        lea     1($arg1),$arg1
        jnz     .Little
+.Lret:
        ret
 .align 16
 .Lot: