From: Mathieu Desnoyers Date: Fri, 21 Feb 2014 02:49:31 +0000 (-0500) Subject: Fix: off by one in lttng-live path length check X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=5fe17d06eeb28e357cac3d7c6a2d668989160d9e;p=deliverable%2Fbabeltrace.git Fix: off by one in lttng-live path length check Does not account for final \0. Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/lttng-live/lttng-live-plugin.c b/formats/lttng-live/lttng-live-plugin.c index b3c660c8d..1d0e0aa02 100644 --- a/formats/lttng-live/lttng-live-plugin.c +++ b/formats/lttng-live/lttng-live-plugin.c @@ -46,14 +46,14 @@ int parse_url(const char *path, struct lttng_live_ctx *ctx) { 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);