diff options
author | Mark Wong <mark@2ndQuadrant.com> | 2020-04-10 17:54:04 -0700 |
---|---|---|
committer | Mark Wong <mark@2ndQuadrant.com> | 2020-04-10 17:54:04 -0700 |
commit | a775ed65a5c986cc55d26ffcb700af21fffe1a91 (patch) | |
tree | 52b4157f2d850963a9221ff03fbde05a4da8c785 | |
parent | b4c3cc1fde7f9c722b8a120f252e5c37855c38ce (diff) |
m_freebsd: update sprintf with snprintf
-rw-r--r-- | machine/m_freebsd.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/machine/m_freebsd.c b/machine/m_freebsd.c index d0099c3..8a692ac 100644 --- a/machine/m_freebsd.c +++ b/machine/m_freebsd.c @@ -699,7 +699,7 @@ format_next_process(caddr_t handle) { case SRUN: if (smpmode && PP(pp, oncpu) != 0xff) - sprintf(status, "CPU%d", PP(pp, oncpu)); + snprintf(status, sizeof(status), "CPU%d", PP(pp, oncpu)); else strcpy(status, "RUN"); break; @@ -707,9 +707,9 @@ format_next_process(caddr_t handle) if (PP(pp, wmesg) != NULL) { #if OSMAJOR <= 4 - sprintf(status, "%.6s", EP(pp, wmesg)); + snprintf(status, sizeof(status), "%.6s", EP(pp, wmesg)); #else - sprintf(status, "%.6s", PP(pp, wmesg)); + snprintf(status, sizeof(status), "%.6s", PP(pp, wmesg)); #endif break; } @@ -718,14 +718,14 @@ format_next_process(caddr_t handle) if (state >= 0 && state < sizeof(state_abbrev) / sizeof(*state_abbrev)) - sprintf(status, "%.6s", state_abbrev[(unsigned char) state]); + snprintf(status, sizeof(status), "%.6s", state_abbrev[(unsigned char) state]); else - sprintf(status, "?%5d", state); + snprintf(status, sizeof(status), "?%5d", state); break; } /* format this entry */ - sprintf(fmt, + snprintf(fmt, sizeof(fmt), smpmode ? smp_Proc_format : up_Proc_format, PP(pp, pid), namelength, namelength, |