From: Mathieu Desnoyers Date: Wed, 13 Jul 2016 19:13:28 +0000 (-0400) Subject: Fix: memory corruption in compat.h X-Git-Tag: v2.9.0-rc1~32 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ffaea23347a6aa8f2d7c311e5d4feb7a891be182;p=lttng-ust.git 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 --- 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);