From ea50e189164f887a15cc52fee3a2c97365efff6a Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 18 Oct 2021 15:02:20 +0200 Subject: [PATCH] ZoneParserTNG: Explicitely use the size of the buffer --- pdns/zoneparser-tng.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pdns/zoneparser-tng.cc b/pdns/zoneparser-tng.cc index 374d8148fb..ae2e647319 100644 --- a/pdns/zoneparser-tng.cc +++ b/pdns/zoneparser-tng.cc @@ -201,10 +201,12 @@ bool ZoneParserTNG::getTemplateLine() if (width < 0) { throw PDNSException("Invalid width ("+std::to_string(width)+") for $GENERATE's lhs from '"+spec+"' "+getLineOfFile()); } - /* a width larger than the output buffer does not make any sense */ - width = std::min(width, 80); char tmp[80]; + + /* a width larger than the output buffer does not make any sense */ + width = std::min(width, static_cast(sizeof(tmp))); + switch (radix) { case 'o': snprintf(tmp, sizeof(tmp), "%0*o", width, d_templatecounter + offset); -- 2.47.2