From 5fe17d06eeb28e357cac3d7c6a2d668989160d9e Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 20 Feb 2014 21:49:31 -0500 Subject: [PATCH] Fix: off by one in lttng-live path length check Does not account for final \0. Signed-off-by: Mathieu Desnoyers --- formats/lttng-live/lttng-live-plugin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/formats/lttng-live/lttng-live-plugin.c b/formats/lttng-live/lttng-live-plugin.c index b3c660c8..1d0e0aa0 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); -- 2.34.1