INIT allow iscsi_context = NULL in iscsi_set_error()
qemu-kvm calls iscsi_parse_url_full() with iscsi = NULL. In case there is an invalid URL specified qemu-kvm segfaults when it tries to set iscsi->error_string. I tried to patch this in qemu-kvm, but the initiator_name is dirived from the target name so this seemed to be the easier approach.
This commit is contained in:
committed by
Ronnie Sahlberg
parent
6c2c583af1
commit
bde85a4b57
@@ -251,8 +251,13 @@ iscsi_set_error(struct iscsi_context *iscsi, const char *error_string, ...)
|
|||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
strncpy(iscsi->error_string,errstr,MAX_STRING_SIZE);
|
if (iscsi != NULL) {
|
||||||
DPRINTF(iscsi,1,"%s",iscsi->error_string);
|
strncpy(iscsi->error_string,errstr,MAX_STRING_SIZE);
|
||||||
|
DPRINTF(iscsi,1,"%s",iscsi->error_string);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"libiscsi: %s\n", errstr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user