Re: [PATCH 2/3] git-cvsserver: protect against NULL in crypt(3)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Carlo Marcelo Arenas Belón  <carenas@xxxxxxxxx> writes:

> -                if (crypt(descramble($password), $1) eq $1) {
> -                    $auth_ok = 1;
> +                my $hash = crypt(descramble($password), $1);
> +                if (defined $hash) {
> +                    $auth_ok = 1 if $hash eq $1;
>                  }

It is not wrong per-se to separate the two checks into two separate
parts of the conditional, but because we check for definedness only
because comparison of it with $1 makes sense only when it is
defined, writing it either like this, 

		if (defined $hash and $hash eq $1) {
			$auth_ok = 1;
		}

or even like this,

		$auth_ok = (defined $hash and $hash eq $1);

may be easier to read, no?




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux