diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2020-04-20 14:12:38 -0400 | 
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2020-04-20 19:14:33 -0400 | 
| commit | 772270f3b6a37a2dd9432541cce436e9b45bb6b9 (patch) | |
| tree | fc7f717a60d056b0300fcf43373a1fff30b94b13 /bgpd/bgp_dump.c | |
| parent | 3f0cc3ffb3ebbc67ebdc285b8093783ad572fa93 (diff) | |
*: sprintf -> snprintf
Replace sprintf with snprintf where straightforward to do so.
- sprintf's into local scope buffers of known size are replaced with the
  equivalent snprintf call
- snprintf's into local scope buffers of known size that use the buffer
  size expression now use sizeof(buffer)
- sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp
  buffer followed by strlcat
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_dump.c')
| -rw-r--r-- | bgpd/bgp_dump.c | 3 | 
1 files changed, 2 insertions, 1 deletions
diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index a79c5e0da0..9af90dbf26 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -115,7 +115,8 @@ static FILE *bgp_dump_open_file(struct bgp_dump *bgp_dump)  	localtime_r(&clock, &tm);  	if (bgp_dump->filename[0] != DIRECTORY_SEP) { -		sprintf(fullpath, "%s/%s", vty_get_cwd(), bgp_dump->filename); +		snprintf(fullpath, sizeof(fullpath), "%s/%s", vty_get_cwd(), +			 bgp_dump->filename);  		ret = strftime(realpath, MAXPATHLEN, fullpath, &tm);  	} else  		ret = strftime(realpath, MAXPATHLEN, bgp_dump->filename, &tm);  | 
