diff options
author | Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> | 2014-10-12 17:55:33 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-10-29 16:25:23 +0800 |
commit | 22e1dd69fec2f0e887103f6b0dc8e310f649c1c1 (patch) | |
tree | 7a5e8fb488b19965199b339589d44267554317b1 /drivers/staging/lustre | |
parent | 5a13503ecdf3ee6127b2833ed37dfc5dccb6a3dd (diff) | |
download | linux-stable-22e1dd69fec2f0e887103f6b0dc8e310f649c1c1.tar.gz linux-stable-22e1dd69fec2f0e887103f6b0dc8e310f649c1c1.tar.bz2 linux-stable-22e1dd69fec2f0e887103f6b0dc8e310f649c1c1.zip |
staging: lustre: lustre: ptlrpc: sec.c: Replacing strncat with strlcat to avoid overwrite size
Changed from using strncat with strlcat to avoid overwrite the max size.
Take the opportunity to change a snprint to strlcpy.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Acked-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre')
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/sec.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c index 4ce76852e6ee..6ac8a8330c7c 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c @@ -209,7 +209,7 @@ EXPORT_SYMBOL(sptlrpc_flavor2name_bulk); char *sptlrpc_flavor2name(struct sptlrpc_flavor *sf, char *buf, int bufsize) { - snprintf(buf, bufsize, "%s", sptlrpc_flavor2name_base(sf->sf_rpc)); + strlcpy(buf, sptlrpc_flavor2name_base(sf->sf_rpc), bufsize); /* * currently we don't support customized bulk specification for @@ -220,10 +220,9 @@ char *sptlrpc_flavor2name(struct sptlrpc_flavor *sf, char *buf, int bufsize) bspec[0] = '-'; sptlrpc_flavor2name_bulk(sf, &bspec[1], sizeof(bspec) - 1); - strncat(buf, bspec, bufsize); + strlcat(buf, bspec, bufsize); } - buf[bufsize - 1] = '\0'; return buf; } EXPORT_SYMBOL(sptlrpc_flavor2name); |