From: Remi Gacogne Date: Mon, 18 Oct 2021 13:02:20 +0000 (+0200) Subject: ZoneParserTNG: Explicitely use the size of the buffer X-Git-Tag: rec-4.6.0-beta1~19^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ea50e189164f887a15cc52fee3a2c97365efff6a;p=thirdparty%2Fpdns.git ZoneParserTNG: Explicitely use the size of the buffer --- 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);