aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/rangeset.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/rangeset.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/rangeset.c')
-rw-r--r--xen/common/rangeset.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/xen/common/rangeset.c b/xen/common/rangeset.c
index d90a39b67b..3594db41e9 100644
--- a/xen/common/rangeset.c
+++ b/xen/common/rangeset.c
@@ -283,12 +283,11 @@ struct rangeset *rangeset_new(
if ( name != NULL )
{
- strncpy(r->name, name, sizeof(r->name));
- r->name[sizeof(r->name)-1] = '\0';
+ strlcpy(r->name, name, sizeof(r->name));
}
else
{
- sprintf(r->name, "(no name)");
+ snprintf(r->name, sizeof(r->name), "(no name)");
}
if ( (r->domain = d) != NULL )