]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix snprintf emulation function (Issue #67)
authorMichael R Sweet <msweet@msweet.org>
Mon, 1 Feb 2021 20:26:53 +0000 (15:26 -0500)
committerMichael R Sweet <msweet@msweet.org>
Mon, 1 Feb 2021 20:48:28 +0000 (15:48 -0500)
CHANGES-OPENPRINTING.md
cups/snprintf.c

index c9715c07acca6402027845914d32adb84909312b..f7997716995d74157a6ed0a95189803eea5a763c 100644 (file)
@@ -11,6 +11,7 @@ Changes in CUPS v2.3.3op2
 - Fixed directory/permission defaults for Debian kfreebsd-based systems
   (Issue #60, Issue #61)
 - Fixed crash bug in `ppdOpen` (Issue #64, Issue #78)
+- Fixed regression in `snprintf` emulation function (Issue #67)
 - The scheduler's systemd service file now waits for the nslcd service to start
   (Issue #69)
 - Fixed segfault in help.cgi when searching in man pages (Issue #81)
index a4d17b5be3df69ef09e26c8f8a5f43727de41e3f..e559ebfc4eb9219b66ed160b0da7e0b4eba411b5 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * snprintf functions for CUPS.
  *
+ * Copyright © 2021 by Michael R Sweet
  * Copyright © 2007-2019 by Apple Inc.
  * Copyright © 1997-2007 by Easy Software Products.
  *
@@ -81,7 +82,8 @@ _cups_vsnprintf(char       *buffer,   /* O - Output buffer */
        format ++;
        width = va_arg(ap, int);
 
-       snprintf(tptr, sizeof(tformat) - (tptr - tformat), "%d", width);
+        /* Note: Can't use snprintf here since we are implementing this function... */
+       sprintf(tptr, "%d", width);
        tptr += strlen(tptr);
       }
       else
@@ -113,7 +115,8 @@ _cups_vsnprintf(char       *buffer, /* O - Output buffer */
          format ++;
          prec = va_arg(ap, int);
 
-         snprintf(tptr, sizeof(tformat) - (tptr - tformat), "%d", prec);
+          /* Note: Can't use snprintf here since we are implementing this function... */
+         sprintf(tptr, "%d", prec);
          tptr += strlen(tptr);
        }
        else
@@ -171,7 +174,8 @@ _cups_vsnprintf(char       *buffer, /* O - Output buffer */
            if ((width + 2) > sizeof(temp))
              break;
 
-           snprintf(temp, sizeof(temp), tformat, va_arg(ap, double));
+            /* Note: Can't use snprintf here since we are implementing this function... */
+           sprintf(temp, tformat, va_arg(ap, double));
            templen = strlen(temp);
 
             bytes += (int)templen;
@@ -202,7 +206,8 @@ _cups_vsnprintf(char       *buffer, /* O - Output buffer */
            if ((width + 2) > sizeof(temp))
              break;
 
-           snprintf(temp, sizeof(temp), tformat, va_arg(ap, int));
+           /* Note: Can't use snprintf here since we are implementing this function... */
+           sprintf(temp, tformat, va_arg(ap, int));
            templen = strlen(temp);
 
             bytes += (int)templen;
@@ -226,7 +231,8 @@ _cups_vsnprintf(char       *buffer, /* O - Output buffer */
            if ((width + 2) > sizeof(temp))
              break;
 
-           snprintf(temp, sizeof(temp), tformat, va_arg(ap, void *));
+           /* Note: Can't use snprintf here since we are implementing this function... */
+           sprintf(temp, tformat, va_arg(ap, void *));
            templen = strlen(temp);
 
             bytes += (int)templen;