File oprofile-fix-issues-detected-by-coverity.patch of Package oprofile
From: Maynard Johnson <maynardj@us.ibm.com>
Subject: Fix issues detected by Coverity
Git-commit: be6d22999668ac976acd2008ec13db4385a0c8dd (partial)
Date: Mon Jan 27 15:44:18 2014 -0600
References: FATE#319565, bsc#965789
Signed-off-by: Tony Jones <tonyj@suse.de>
Fix issues detected by Coverity
Will Cohen ran Coverity against oprofile and reported some issues
on Nov 20, 2013. I submitted the current oprofile source to the
Coverity webpage, and a couple new issues were detected. This
patch addresses most of these issues. Some issues are either
false positives from Coverity's analysis or have been marked
as "Intentional" so as to have Coverity ignore them.
[tonyj: trimmed to those necessary for fb952916]
Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
diff --git a/libpe_utils/op_pe_utils.cpp b/libpe_utils/op_pe_utils.cpp
index aa0c1c5..0b7482f 100644
--- a/libpe_utils/op_pe_utils.cpp
+++ b/libpe_utils/op_pe_utils.cpp
@@ -487,7 +487,7 @@ handle_named_um:
(endptr <= (mask + strlen(mask) - 2))) { // '- 2' to account for linefeed and '\0'
// Must be a default named unit mask
- strncpy(event->um_name, mask, OP_MAX_UM_NAME_LEN);
+ strncpy(event->um_name, mask, OP_MAX_UM_NAME_LEN - 1);
goto handle_named_um;
}
config |= ((event->evt_um & 0xFFULL) << 8);