diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-01-29 10:52:17 +0000 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-01-29 10:52:17 +0000 |
commit | 45ce6547e6bde8cdf8f3dcaba833a3bda8f3c889 (patch) | |
tree | 9ce439909a9e3816fbac7b29bac84009fced953e /xen/common/kernel.c | |
parent | c642ec17d0d541835334b676e972539fdd5becdc (diff) | |
download | xen-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/kernel.c')
-rw-r--r-- | xen/common/kernel.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/xen/common/kernel.c b/xen/common/kernel.c index 016270b2c5..4c22cf8803 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -72,8 +72,7 @@ void cmdline_parse(char *cmdline) switch ( param->type ) { case OPT_STR: - strncpy(param->var, optval, param->len); - ((char *)param->var)[param->len-1] = '\0'; + strlcpy(param->var, optval, param->len); break; case OPT_UINT: *(unsigned int *)param->var = |