Fix: off by one in lttng-live path length check
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 21 Feb 2014 02:49:31 +0000 (21:49 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 21 Feb 2014 02:49:31 +0000 (21:49 -0500)
Does not account for final \0.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/lttng-live/lttng-live-plugin.c

index b3c660c8d7648fec124f90bc257a30524d1b00f3..1d0e0aa02f0c1700b8a75aad1f1640d3b39b2527 100644 (file)
@@ -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);
This page took 0.025987 seconds and 4 git commands to generate.