]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Check that the number of trays is consistent before fetching anymore data 692/head
authorRose <83477269+AtariDreams@users.noreply.github.com>
Sat, 13 May 2023 19:14:34 +0000 (15:14 -0400)
committerRose <83477269+AtariDreams@users.noreply.github.com>
Sat, 13 May 2023 21:21:50 +0000 (17:21 -0400)
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

index c41deeecf8aa5d54626f9f8c41f9410301629e6f..041a468ef7b3cf88620bd6109aee169b0666ca8e 100644 (file)
@@ -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, "<p>Error: Different number of trays in media-source-supported and printer-input-tray defined for printer.</p>\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...
   */