diff --git a/mgmtd/mgmt_history.h b/mgmtd/mgmt_history.h index d3f7958952..5d9b662694 100644 --- a/mgmtd/mgmt_history.h +++ b/mgmtd/mgmt_history.h @@ -74,9 +74,11 @@ mgmt_time_to_string(struct timespec *tv, bool long_fmt, char *buffer, size_t sz) if (long_fmt) { n = strftime(buffer, sz, MGMT_LONG_TIME_FMT, &tm); + assert(n < sz); snprintf(&buffer[n], sz - n, ",%09lu", tv->tv_nsec); } else { n = strftime(buffer, sz, MGMT_SHORT_TIME_FMT, &tm); + assert(n < sz); snprintf(&buffer[n], sz - n, "%09lu", tv->tv_nsec); }