The previous implementation was unbounded which could result in long
loops with preemption turned off.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I85afcd879258735bb2e7502f6016fcb2d3974cf7
#include <wrapper/uaccess.h>
#include <lttng/probe-user.h>
+#define LTTNG_MAX_USER_STRING_LEN 1048576 /* 1MB */
+
/*
* Calculate string length. Include final null terminating character if there is
* one, or ends at first fault. Disabling page faults ensures that we can safely
if (unlikely(ret > 0))
break;
count++;
+ if (unlikely(count > LTTNG_MAX_USER_STRING_LEN))
+ break;
if (unlikely(!v))
break;
addr++;