summaryrefslogtreecommitdiff
path: root/lib/ptm_lib.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2020-04-20 14:12:38 -0400
committerQuentin Young <qlyoung@cumulusnetworks.com>2020-04-20 19:14:33 -0400
commit772270f3b6a37a2dd9432541cce436e9b45bb6b9 (patch)
treefc7f717a60d056b0300fcf43373a1fff30b94b13 /lib/ptm_lib.c
parent3f0cc3ffb3ebbc67ebdc285b8093783ad572fa93 (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 'lib/ptm_lib.c')
-rw-r--r--lib/ptm_lib.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/ptm_lib.c b/lib/ptm_lib.c
index b66ae221cf..e00dd54290 100644
--- a/lib/ptm_lib.c
+++ b/lib/ptm_lib.c
@@ -65,10 +65,10 @@ static csv_record_t *_ptm_lib_encode_header(csv_t *csv, csv_record_t *rec,
char client_buf[32];
csv_record_t *rec1;
- sprintf(msglen_buf, "%4d", msglen);
- sprintf(vers_buf, "%4d", version);
- sprintf(type_buf, "%4d", type);
- sprintf(cmdid_buf, "%4d", cmd_id);
+ snprintf(msglen_buf, sizeof(msglen_buf), "%4d", msglen);
+ snprintf(vers_buf, sizeof(vers_buf), "%4d", version);
+ snprintf(type_buf, sizeof(type_buf), "%4d", type);
+ snprintf(cmdid_buf, sizeof(cmdid_buf), "%4d", cmd_id);
snprintf(client_buf, 17, "%16.16s", client_name);
if (rec) {
rec1 = csv_encode_record(csv, rec, 5, msglen_buf, vers_buf,