From 7c41892ff829c521b304bd086b9796f69302e091 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 25 Sep 2012 22:50:39 -0400 Subject: [PATCH] Fix: BSD getprogname null pointer dereference Signed-off-by: Christian Babeux Signed-off-by: Mathieu Desnoyers --- liblttng-ust/compat.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/liblttng-ust/compat.h b/liblttng-ust/compat.h index 58d8585c..4d4a4368 100644 --- a/liblttng-ust/compat.h +++ b/liblttng-ust/compat.h @@ -55,7 +55,8 @@ void lttng_ust_getprocname(char *name) bsd_name = getprogname(); if (!bsd_name) name[0] = '\0'; - memcpy(name, bsd_name, LTTNG_UST_PROCNAME_LEN - 1); + else + memcpy(name, bsd_name, LTTNG_UST_PROCNAME_LEN - 1); } #endif -- 2.34.1