Avoid null pointer dereferences when no username/password specified.
This commit is contained in:
parent
6ceb55fad0
commit
d6f9152bfa
|
@ -403,7 +403,8 @@ static int iscsi_build_login_request_strings ( struct iscsi_session *iscsi,
|
||||||
used += ssnprintf ( data + used, len - used, "CHAP_A=5%c", 0 );
|
used += ssnprintf ( data + used, len - used, "CHAP_A=5%c", 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( iscsi->status & ISCSI_STATUS_STRINGS_CHAP_RESPONSE ) {
|
if ( ( iscsi->status & ISCSI_STATUS_STRINGS_CHAP_RESPONSE ) &&
|
||||||
|
iscsi->username ) {
|
||||||
used += ssnprintf ( data + used, len - used,
|
used += ssnprintf ( data + used, len - used,
|
||||||
"CHAP_N=%s%cCHAP_R=0x",
|
"CHAP_N=%s%cCHAP_R=0x",
|
||||||
iscsi->username, 0 );
|
iscsi->username, 0 );
|
||||||
|
@ -572,8 +573,10 @@ static void iscsi_handle_chap_i_value ( struct iscsi_session *iscsi,
|
||||||
* challenge.
|
* challenge.
|
||||||
*/
|
*/
|
||||||
chap_set_identifier ( &iscsi->chap, identifier );
|
chap_set_identifier ( &iscsi->chap, identifier );
|
||||||
chap_update ( &iscsi->chap, iscsi->password,
|
if ( iscsi->password ) {
|
||||||
strlen ( iscsi->password ) );
|
chap_update ( &iscsi->chap, iscsi->password,
|
||||||
|
strlen ( iscsi->password ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Reference in New Issue