aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/perfc.c
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-01-29 10:52:17 +0000
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-01-29 10:52:17 +0000
commit45ce6547e6bde8cdf8f3dcaba833a3bda8f3c889 (patch)
tree9ce439909a9e3816fbac7b29bac84009fced953e /xen/common/perfc.c
parentc642ec17d0d541835334b676e972539fdd5becdc (diff)
downloadxen-45ce6547e6bde8cdf8f3dcaba833a3bda8f3c889.tar.gz
xen-45ce6547e6bde8cdf8f3dcaba833a3bda8f3c889.tar.bz2
xen-45ce6547e6bde8cdf8f3dcaba833a3bda8f3c889.zip
Replace sprintf with snprintf and strncpy with strlcpy.
There are various cases where no NULL-terminated strings are guaranteed and eventual possible overflows. This patch fixes them. From: Christoph Egger <Christoph.Egger@amd.com> Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/common/perfc.c')
-rw-r--r--xen/common/perfc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/xen/common/perfc.c b/xen/common/perfc.c
index 5ab8c6e9f3..86fda48e07 100644
--- a/xen/common/perfc.c
+++ b/xen/common/perfc.c
@@ -148,9 +148,8 @@ static int perfc_copy_info(XEN_GUEST_HANDLE_64(xen_sysctl_perfc_desc_t) desc,
{
for ( i = 0; i < NR_PERFCTRS; i++ )
{
- strncpy(perfc_d[i].name, perfc_info[i].name,
+ strlcpy(perfc_d[i].name, perfc_info[i].name,
sizeof(perfc_d[i].name));
- perfc_d[i].name[sizeof(perfc_d[i].name)-1] = '\0';
switch ( perfc_info[i].type )
{