Skip to content

Commit

Permalink
Mirror fix from master.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Apr 12, 2023
1 parent 47c7b38 commit 0c69b3d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Changes in v1.3.2
- Fixed PWG ImageBox values in raster page header
- Fixed a bug in the "ipp-attribute-fidelity" support
- Fixed printing of 1/2/4-bit grayscale PNG images (Issue #267)
- Fixed a potential buffer overflow in the logging code (Issue #272)
- Updated the Wi-Fi configuration page to support hidden networks.
- Updated the Wi-Fi configuration page reload time to 30 seconds.

Expand Down
12 changes: 6 additions & 6 deletions pappl/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ write_log(pappl_system_t *system, // I - System
case 'e' :
case 'f' :
case 'g' :
snprintf(bufptr, (size_t)(bufptr - bufend + 1), tformat, va_arg(ap, double));
snprintf(bufptr, (size_t)(bufend - bufptr), tformat, va_arg(ap, double));
bufptr += strlen(bufptr);
break;

Expand All @@ -579,18 +579,18 @@ write_log(pappl_system_t *system, // I - System
case 'x' :
# ifdef HAVE_LONG_LONG
if (size == 'L')
snprintf(bufptr, (size_t)(bufptr - bufend + 1), tformat, va_arg(ap, long long));
snprintf(bufptr, (size_t)(bufend - bufptr), tformat, va_arg(ap, long long));
else
# endif // HAVE_LONG_LONG
if (size == 'l')
snprintf(bufptr, (size_t)(bufptr - bufend + 1), tformat, va_arg(ap, long));
snprintf(bufptr, (size_t)(bufend - bufptr), tformat, va_arg(ap, long));
else
snprintf(bufptr, (size_t)(bufptr - bufend + 1), tformat, va_arg(ap, int));
snprintf(bufptr, (size_t)(bufend - bufptr), tformat, va_arg(ap, int));
bufptr += strlen(bufptr);
break;

case 'p' : // Log a pointer
snprintf(bufptr, (size_t)(bufptr - bufend + 1), "%p", va_arg(ap, void *));
snprintf(bufptr, (size_t)(bufend - bufptr), "%p", va_arg(ap, void *));
bufptr += strlen(bufptr);
break;

Expand Down Expand Up @@ -651,7 +651,7 @@ write_log(pappl_system_t *system, // I - System
break;

default : // Something else we don't support
papplCopyString(bufptr, tformat, (size_t)(bufptr - bufend + 1));
papplCopyString(bufptr, tformat, (size_t)(bufend - bufptr));
bufptr += strlen(bufptr);
break;
}
Expand Down

0 comments on commit 0c69b3d

Please sign in to comment.