{
char remain[3][NAME_MAX];
int ret = -1, proto, proto_offset = 0;
- size_t path_len = strlen(path);
+ size_t path_len = strlen(path); /* not accounting \0 */
/*
* Since sscanf API does not allow easily checking string length
* against a size defined by a macro. Test it beforehand on the
* input. We know the output is always <= than the input length.
*/
- if (path_len > NAME_MAX) {
+ if (path_len >= NAME_MAX) {
goto end;
}
ret = sscanf(path, "net%d://", &proto);
}
}
- if (ctx->port < 0)
+ if (ctx->port < 0) {
ctx->port = LTTNG_DEFAULT_NETWORK_VIEWER_PORT;
+ }
if (strlen(remain[2]) == 0) {
printf_verbose("Connecting to hostname : %s, port : %d, "
goto end_free;
}
- if (ctx->session_ids->len > 0)
+ if (ctx->session_ids->len > 0) {
lttng_live_read(ctx);
+ }
end_free:
g_hash_table_destroy(ctx->session->ctf_traces);