From ac27694580b0b56f53e0f6d391637017d683d685 Mon Sep 17 00:00:00 2001 From: Rose <83477269+AtariDreams@users.noreply.github.com> Date: Sat, 13 May 2023 15:14:34 -0400 Subject: [PATCH] Check that the number of trays is consistent before fetching anymore data There is no point in getting this data otherwise if the number of sources defined for the media_sources and for the input_tray differ. --- tools/ippeveprinter.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/ippeveprinter.c b/tools/ippeveprinter.c index c41deeecf8..041a468ef7 100644 --- a/tools/ippeveprinter.c +++ b/tools/ippeveprinter.c @@ -7864,11 +7864,12 @@ show_media(ippeve_client_t *client) /* I - Client connection */ return (1); } - num_ready = ippGetCount(media_col_ready); - num_sizes = ippGetCount(media_sizes); num_sources = ippGetCount(media_sources); - num_types = ippGetCount(media_types); + /* + * Make sure the number of trays is consistent. + */ + if (num_sources != ippGetCount(input_tray)) { html_printf(client, "
Error: Different number of trays in media-source-supported and printer-input-tray defined for printer.
\n"); @@ -7876,6 +7877,10 @@ show_media(ippeve_client_t *client) /* I - Client connection */ return (1); } + num_ready = ippGetCount(media_col_ready); + num_sizes = ippGetCount(media_sizes); + num_types = ippGetCount(media_types); + /* * Process form data if present... */ -- 2.47.2