]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
ZoneParserTNG: Explicitely use the size of the buffer
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 18 Oct 2021 13:02:20 +0000 (15:02 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 26 Oct 2021 15:06:30 +0000 (17:06 +0200)
pdns/zoneparser-tng.cc

index 374d8148fb4cc84f0c55be55bd18b14b8bf447e8..ae2e64731963f2af12e94f6579e96515899f9c12 100644 (file)
@@ -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<int>(sizeof(tmp)));
+
         switch (radix) {
         case 'o':
           snprintf(tmp, sizeof(tmp), "%0*o", width, d_templatecounter + offset);