Commit df9660df authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Tomasz Zawadzki
Browse files

lib/event: fix printing non-null-terminated strings



%*s prints at least * characters and may add padding to the string.
%.*s prints at most * characters.

In a few places we used the first instead of the second and
printed some garbage to screen (in the best case...).

Change-Id: I97a862be61a5e43aa61e8230044dbd64a9db33bd
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1569


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent e71e81b6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -189,7 +189,7 @@ rpc_client_poller(void *arg)
	assert(resp);

	if (resp->error) {
		SPDK_ERRLOG("error response: %*s", (int)resp->error->len, (char *)resp->error->start);
		SPDK_ERRLOG("error response: %.*s", (int)resp->error->len, (char *)resp->error->start);
	}

	if (resp->error && ctx->stop_on_error) {
@@ -339,7 +339,7 @@ spdk_app_json_config_load_subsystem_config_entry(void *_ctx)
		params_end = spdk_json_next(ctx->config_it);
		assert(params_end != NULL);
		params_len = params_end->start - ctx->config->start + 1;
		SPDK_ERRLOG("Failed to decode config entry: %*s!\n", (int)params_len, (char *)ctx->config_it);
		SPDK_ERRLOG("Failed to decode config entry: %.*s!\n", (int)params_len, (char *)ctx->config_it);
		spdk_app_json_config_load_done(ctx, -EINVAL);
		goto out;
	}
+1 −1
Original line number Diff line number Diff line
@@ -308,7 +308,7 @@ spdk_jsonrpc_client_hook_conn_close(struct spdk_jsonrpc_client *client)

	/* Check for error response */
	if (json_resp->error != NULL) {
		SPDK_ERRLOG("Unexpected error response: %*s\n", json_resp->error->len,
		SPDK_ERRLOG("Unexpected error response: %.*s\n", json_resp->error->len,
			    (char *)json_resp->error->start);
		rc = -EIO;
		goto out;