Commit 22e1dd69 authored by Rickard Strandqvist's avatar Rickard Strandqvist Committed by Greg Kroah-Hartman
Browse files

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: default avatarRickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Acked-by: default avatarChen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5a13503e
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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);