From ffaea23347a6aa8f2d7c311e5d4feb7a891be182 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 13 Jul 2016 15:13:28 -0400 Subject: [PATCH] Fix: memory corruption in compat.h Found by Coverity: CID 1357641 (#1 of 1): Out-of-bounds write (OVERRUN)2. sprintf_overrun: sprintf will overrun its first argument &name[len] which can accommodate 4 bytes. The number of bytes written may be 5 bytes, including the terminating null. Signed-off-by: Mathieu Desnoyers --- liblttng-ust/compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/liblttng-ust/compat.h b/liblttng-ust/compat.h index de5e6477..cd83b46b 100644 --- a/liblttng-ust/compat.h +++ b/liblttng-ust/compat.h @@ -100,7 +100,7 @@ int lttng_ust_setustprocname(void) { int ret = 0, len; char name[LTTNG_UST_PROCNAME_LEN]; - int limit = LTTNG_UST_PROCNAME_LEN - strlen(LTTNG_UST_PROCNAME_SUFFIX); + int limit = LTTNG_UST_PROCNAME_LEN - strlen(LTTNG_UST_PROCNAME_SUFFIX) - 1; lttng_ust_getprocname(name); -- 2.34.1