From: Julien Desfossez Date: Wed, 12 Jun 2013 18:59:05 +0000 (-0400) Subject: Fix: overflow in uri_to_str_url X-Git-Tag: v2.3.0-rc1~85 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=28fcbaeb0c451fbc4e2c289de2ce1f29522239eb;p=lttng-tools.git Fix: overflow in uri_to_str_url Signed-off-by: Julien Desfossez Signed-off-by: David Goulet --- diff --git a/src/common/uri.c b/src/common/uri.c index 4af94072c..4838372ee 100644 --- a/src/common/uri.c +++ b/src/common/uri.c @@ -194,13 +194,13 @@ int uri_to_str_url(struct lttng_uri *uri, char *dst, size_t size) if (uri->dtype == LTTNG_DST_PATH) { ipver = 0; addr = uri->dst.path; - (void) snprintf(proto, sizeof(proto) + 1, "file"); - (void) snprintf(port, sizeof(port) + 1, "%s", ""); + (void) snprintf(proto, sizeof(proto), "file"); + (void) snprintf(port, sizeof(port), "%s", ""); } else { ipver = (uri->dtype == LTTNG_DST_IPV4) ? 4 : 6; addr = (ipver == 4) ? uri->dst.ipv4 : uri->dst.ipv6; - (void) snprintf(proto, sizeof(proto) + 1, "net%d", ipver); - (void) snprintf(port, sizeof(port) + 1, ":%d", uri->port); + (void) snprintf(proto, sizeof(proto), "net%d", ipver); + (void) snprintf(port, sizeof(port), ":%d", uri->port); } ret = snprintf(dst, size, "%s://%s%s%s%s/%s", proto,