hplip/hplip-snprintf-format.patch
2023-06-06 16:15:52 +02:00

52 lines
3.1 KiB
Diff

diff -up hplip-3.23.3/protocol/hp_ipp.c.snprintf-format hplip-3.23.3/protocol/hp_ipp.c
--- hplip-3.23.3/protocol/hp_ipp.c.snprintf-format 2023-03-28 09:26:11.000000000 +0200
+++ hplip-3.23.3/protocol/hp_ipp.c 2023-05-29 14:21:30.872871575 +0200
@@ -108,10 +108,10 @@ int addCupsPrinter(char *name, char *dev
goto abort;
}
- if ( info == NULL )
- snprintf( info,sizeof(info), name );
+ if ( info == NULL )
+ info = name;
- sprintf(printer_uri, "ipp://localhost/printers/%s", name);
+ snprintf( printer_uri, sizeof(printer_uri), "ipp://localhost/printers/%s", name);
cupsSetUser("root");
/* Connect to the HTTP server */
@@ -514,27 +514,27 @@ int __parsePrinterAttributes(ipp_t *resp
if ( strcmp(attr_name, "printer-name") == 0 &&
val_tag == IPP_TAG_NAME ) {
- snprintf(t_printer->name, sizeof(t_printer->name),ippGetString(attr, 0, NULL) );
+ snprintf(t_printer->name, sizeof(t_printer->name), "%s", ippGetString(attr, 0, NULL));
}
else if ( strcmp(attr_name, "device-uri") == 0 &&
val_tag == IPP_TAG_URI ) {
- snprintf(t_printer->device_uri,sizeof(t_printer->device_uri), ippGetString(attr, 0, NULL) );
+ snprintf(t_printer->device_uri, sizeof(t_printer->device_uri), "%s", ippGetString(attr, 0, NULL));
}
else if ( strcmp(attr_name, "printer-uri-supported") == 0 &&
val_tag == IPP_TAG_URI ) {
- snprintf(t_printer->printer_uri,sizeof(t_printer->printer_uri), ippGetString(attr, 0, NULL) );
+ snprintf(t_printer->printer_uri, sizeof(t_printer->printer_uri), "%s", ippGetString(attr, 0, NULL));
}
else if ( strcmp(attr_name, "printer-info") == 0 &&
val_tag == IPP_TAG_TEXT ) {
- snprintf(t_printer->info,sizeof(t_printer->info), ippGetString(attr, 0, NULL) );
+ snprintf(t_printer->info, sizeof(t_printer->info), "%s", ippGetString(attr, 0, NULL));
}
else if ( strcmp(attr_name, "printer-location") == 0 &&
val_tag == IPP_TAG_TEXT ) {
- snprintf(t_printer->location,sizeof(t_printer->location),ippGetString(attr, 0, NULL) );
+ snprintf(t_printer->location, sizeof(t_printer->location), "%s", ippGetString(attr, 0, NULL));
}
else if ( strcmp(attr_name, "printer-make-and-model") == 0 &&
val_tag == IPP_TAG_TEXT ) {
- snprintf(t_printer->make_model,sizeof(t_printer->make_model),ippGetString(attr, 0, NULL) );
+ snprintf(t_printer->make_model, sizeof(t_printer->make_model), "%s", ippGetString(attr, 0, NULL));
}
else if ( strcmp(attr_name, "printer-state") == 0 &&
val_tag == IPP_TAG_ENUM ) {