From 8b6ca611fcb274c3c29c042cb9a297c52392fa57 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 15 Oct 2024 11:27:48 -0400 Subject: [PATCH] Mirror fixes from libcups: - Allow empty resolution values in ipptool files. - Fix memory leak in httpConnectAgain. - Remove dead code in ipp_read_io. --- cups/http.c | 2 ++ cups/ipp-file.c | 2 +- cups/ipp.c | 8 +------- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/cups/http.c b/cups/http.c index 140dcff956..ded6ff2340 100644 --- a/cups/http.c +++ b/cups/http.c @@ -558,6 +558,8 @@ httpConnectAgain(http_t *http, // I - HTTP connection return (false); } + + free(new_creds); } free(orig_creds); diff --git a/cups/ipp-file.c b/cups/ipp-file.c index d8f3b4ee01..0a6e61430c 100644 --- a/cups/ipp-file.c +++ b/cups/ipp-file.c @@ -1706,7 +1706,7 @@ parse_value(ipp_file_t *file, // I - IPP data file yres = (int)strtol(ptr + 1, (char **)&ptr, 10); } - if (ptr <= value || xres <= 0 || yres <= 0 || !ptr || (_cups_strcasecmp(ptr, "dpi") && _cups_strcasecmp(ptr, "dpc") && _cups_strcasecmp(ptr, "dpcm") && _cups_strcasecmp(ptr, "other"))) + if (*value && (ptr <= value || xres <= 0 || yres <= 0 || !ptr || (_cups_strcasecmp(ptr, "dpi") && _cups_strcasecmp(ptr, "dpc") && _cups_strcasecmp(ptr, "dpcm") && _cups_strcasecmp(ptr, "other")))) { report_error(file, "Bad resolution value \"%s\" on line %d of '%s'.", value, file->linenum, file->filename); return (false); diff --git a/cups/ipp.c b/cups/ipp.c index 52621b1f5e..7cb6910471 100644 --- a/cups/ipp.c +++ b/cups/ipp.c @@ -5863,13 +5863,7 @@ ipp_read_io(void *src, // I - Data source case IPP_TAG_MEMBERNAME : // The value the name of the member in the collection, which // we need to carry over... - if (!attr) - { - _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("IPP memberName with no attribute."), 1); - DEBUG_puts("1ipp_read_io: Member name without attribute."); - goto rollback; - } - else if (n == 0) + if (n == 0) { _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("IPP memberName value is empty."), 1); DEBUG_puts("1ipp_read_io: Empty member name value.");