If FIO_OPT_STR_STORE option not provided it is initialized with NULL value, but
there are many places which assumes that is may be empty string
For example, commands below endup with null pointer dereference
fio --name=test --ioengine=e4engine --size=1M
fio --name=test --ioengine=rdma --port=1234 --size=1M
struct stat stub;
char donor_name[PATH_MAX];
- if (!strlen(o->donor_name)) {
+ if (!o->donor_name || !strlen(o->donor_name)) {
log_err("'donorname' options required\n");
return 1;
}
log_err("rados_create failed.\n");
goto failed_early;
}
+ if (o->pool_name == NULL) {
+ log_err("rbd pool name must be provided.\n");
+ goto failed_early;
+ }
+ if (!o->rbd_name) {
+ log_err("rbdname must be provided.\n");
+ goto failed_early;
+ }
r = rados_conf_read_file(rbd->cluster, NULL);
if (r < 0) {
return err;
/* resolve route */
- if (strcmp(o->bindname, "") != 0) {
+ if (o->bindname && strlen(o->bindname)) {
addrb.ss_family = AF_INET;
err = aton(td, o->bindname, (struct sockaddr_in *)&addrb);
if (err)
rd->addr.sin_family = AF_INET;
rd->addr.sin_port = htons(port);
- if (strcmp(o->bindname, "") == 0)
+ if (!o->bindname || !strlen(o->bindname))
rd->addr.sin_addr.s_addr = htonl(INADDR_ANY);
else
rd->addr.sin_addr.s_addr = htonl(*o->bindname);