Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1commit f103a260215016fc035bc1399c8accabf83b0264
2Author: Claudio Bley <claudio.bley@gmail.com>
3Date: Fri Jul 1 22:29:05 2022 +0200
4
5 Revert change to hp_ipp.c from 3.22.{4 -> 6}
6
7 This fails compilation:
8 ```
9 protocol/hp_ipp.c: In function ‘addCupsPrinter’:
10 protocol/hp_ipp.c:113:9: error: format not a string literal and no format arguments [-Werror=format-security]
11 113 | snprintf( info,sizeof(info), name );
12 | ^~~~~~~~
13 ```
14
15diff --git a/protocol/hp_ipp.c b/protocol/hp_ipp.c
16index 97d827d..af7013b 100644
17--- a/protocol/hp_ipp.c
18+++ b/protocol/hp_ipp.c
19@@ -110,7 +110,7 @@ int addCupsPrinter(char *name, char *device_uri, char *location, char *ppd_file,
20 }
21
22 if ( info == NULL )
23- snprintf( info,sizeof(info), name );
24+ strcpy( info, name );
25
26 sprintf( printer_uri, "ipp://localhost/printers/%s", name );
27
28@@ -511,27 +511,27 @@ int __parsePrinterAttributes(ipp_t *response, printer_t **printer_list)
29
30 if ( strcmp(attr_name, "printer-name") == 0 &&
31 val_tag == IPP_TAG_NAME ) {
32- snprintf(t_printer->name, sizeof(t_printer->name),ippGetString(attr, 0, NULL) );
33+ strcpy(t_printer->name, ippGetString(attr, 0, NULL) );
34 }
35 else if ( strcmp(attr_name, "device-uri") == 0 &&
36 val_tag == IPP_TAG_URI ) {
37- snprintf(t_printer->device_uri,sizeof(t_printer->device_uri), ippGetString(attr, 0, NULL) );
38+ strcpy(t_printer->device_uri, ippGetString(attr, 0, NULL) );
39 }
40 else if ( strcmp(attr_name, "printer-uri-supported") == 0 &&
41 val_tag == IPP_TAG_URI ) {
42- snprintf(t_printer->printer_uri,sizeof(t_printer->printer_uri), ippGetString(attr, 0, NULL) );
43+ strcpy(t_printer->printer_uri, ippGetString(attr, 0, NULL) );
44 }
45 else if ( strcmp(attr_name, "printer-info") == 0 &&
46 val_tag == IPP_TAG_TEXT ) {
47- snprintf(t_printer->info,sizeof(t_printer->info), ippGetString(attr, 0, NULL) );
48+ strcpy(t_printer->info, ippGetString(attr, 0, NULL) );
49 }
50 else if ( strcmp(attr_name, "printer-location") == 0 &&
51 val_tag == IPP_TAG_TEXT ) {
52- snprintf(t_printer->location,sizeof(t_printer->location),ippGetString(attr, 0, NULL) );
53+ strcpy(t_printer->location, ippGetString(attr, 0, NULL) );
54 }
55 else if ( strcmp(attr_name, "printer-make-and-model") == 0 &&
56 val_tag == IPP_TAG_TEXT ) {
57- snprintf(t_printer->make_model,sizeof(t_printer->make_model),ippGetString(attr, 0, NULL) );
58+ strcpy(t_printer->make_model, ippGetString(attr, 0, NULL) );
59 }
60 else if ( strcmp(attr_name, "printer-state") == 0 &&
61 val_tag == IPP_TAG_ENUM ) {