X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fcommon%2Furi.c;h=7fe4dd3b30af4796a855fb28cb83f5f4fca827ce;hb=f72bb42fe5fb36e43df18f9df6d0d389db699170;hp=58ffcbcd66de518c8fba4ee4c470609af5ec8491;hpb=1b7c93cbef5f1c0497f65c9b48b3487e1f6c6034;p=lttng-tools.git diff --git a/src/common/uri.c b/src/common/uri.c index 58ffcbcd6..7fe4dd3b3 100644 --- a/src/common/uri.c +++ b/src/common/uri.c @@ -587,6 +587,10 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url, if (ret < 0) { PERROR("snprintf file url"); goto parse_error; + } else if (ret >= sizeof(url)) { + PERROR("snprintf file url is too long"); + goto parse_error; + } ctrl_url = url; } @@ -604,7 +608,7 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url, if (ctrl_uris[0].dtype == LTTNG_DST_PATH && (data_url && *data_url != '\0')) { - ERR("Can not have a data URL when destination is file://"); + ERR("Cannot have a data URL when destination is file://"); goto error; } @@ -640,10 +644,12 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url, set_default_uri_attr(&data_uris[0], LTTNG_STREAM_DATA); - ret = compare_destination(&ctrl_uris[0], &data_uris[0]); - if (ret != 0) { - ERR("Control and data destination mismatch"); - goto error; + if (ctrl_uris) { + ret = compare_destination(&ctrl_uris[0], &data_uris[0]); + if (ret != 0) { + ERR("Control and data destination mismatch"); + goto error; + } } }