Fix SEGV caused by format string on 32-bit platforms / armv7l, reported in #1587 (#1658)

Looks great. Thanks for this!
This commit is contained in:
David Baird 2022-05-06 12:11:47 -04:00 committed by GitHub
parent e9f8ecbf7e
commit eea93d2607
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -1724,11 +1724,11 @@ void Bond::dumpPathStatus(int64_t now, int pathIdx)
std::string aliveOrDead = _paths[pathIdx].alive ? std::string("alive") : std::string("dead");
std::string eligibleOrNot = _paths[pathIdx].eligible ? std::string("eligible") : std::string("ineligible");
std::string bondedOrNot = _paths[pathIdx].bonded ? std::string("bonded") : std::string("unbonded");
log("path[%2d] --- %5s (in %7d, out: %7d), %10s, %8s, flows=%-6d lat=%-8.3f pdv=%-7.3f err=%-6.4f loss=%-6.4f alloc=%-3d --- (%s)",
log("path[%2d] --- %5s (in %7lld, out: %7lld), %10s, %8s, flows=%-6d lat=%-8.3f pdv=%-7.3f err=%-6.4f loss=%-6.4f alloc=%-3d --- (%s)",
pathIdx,
aliveOrDead.c_str(),
_paths[pathIdx].p->age(now),
(now - _paths[pathIdx].p->_lastOut),
static_cast<long long int>(_paths[pathIdx].p->age(now)),
static_cast<long long int>(now - _paths[pathIdx].p->_lastOut),
eligibleOrNot.c_str(),
bondedOrNot.c_str(),
_paths[pathIdx].assignedFlowCount,

View File

@ -1141,6 +1141,9 @@ class Bond {
*
*/
void log(const char* fmt, ...)
#ifdef __GNUC__
__attribute__((format(printf, 2, 3)))
#endif
{
#ifdef ZT_TRACE
time_t rawtime;
@ -1170,6 +1173,9 @@ class Bond {
*
*/
void debug(const char* fmt, ...)
#ifdef __GNUC__
__attribute__((format(printf, 2, 3)))
#endif
{
#ifdef ZT_DEBUG
time_t rawtime;