diff options
author | Michael Brown <mcb30@etherboot.org> | 2006-12-21 18:38:24 +0000 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2006-12-21 18:38:24 +0000 |
commit | d6f9152bfa10d0ba9da2d06ebfa9938517bd5251 (patch) | |
tree | 2b6a260e310eed88eca61d2185bc6a3e82a9cf72 /src/net/tcp/iscsi.c | |
parent | 6ceb55fad0a95be0fc9926a3f528503c0ec3e506 (diff) | |
download | ipxe-d6f9152bfa10d0ba9da2d06ebfa9938517bd5251.tar.gz |
Avoid null pointer dereferences when no username/password specified.
Diffstat (limited to 'src/net/tcp/iscsi.c')
-rw-r--r-- | src/net/tcp/iscsi.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c index 4897f1e2..d38c20e7 100644 --- a/src/net/tcp/iscsi.c +++ b/src/net/tcp/iscsi.c @@ -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 ); } - if ( iscsi->status & ISCSI_STATUS_STRINGS_CHAP_RESPONSE ) { + if ( ( iscsi->status & ISCSI_STATUS_STRINGS_CHAP_RESPONSE ) && + iscsi->username ) { used += ssnprintf ( data + used, len - used, "CHAP_N=%s%cCHAP_R=0x", iscsi->username, 0 ); @@ -572,8 +573,10 @@ static void iscsi_handle_chap_i_value ( struct iscsi_session *iscsi, * challenge. */ chap_set_identifier ( &iscsi->chap, identifier ); - chap_update ( &iscsi->chap, iscsi->password, - strlen ( iscsi->password ) ); + if ( iscsi->password ) { + chap_update ( &iscsi->chap, iscsi->password, + strlen ( iscsi->password ) ); + } } /** |