aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTijl Coosemans <tijl@FreeBSD.org>2023-11-17 14:20:45 +0000
committerTijl Coosemans <tijl@FreeBSD.org>2023-11-17 15:44:22 +0000
commit519a7472d666302ea47f201a45219ef561f1fe09 (patch)
treed31201f5c8d37e5e39c7b6bf19ffcad8e4ac15ed
parent0d5c79852641be32b30b5bb23be689d33469d0a3 (diff)
downloadports-519a7472d666302ea47f201a45219ef561f1fe09.tar.gz
ports-519a7472d666302ea47f201a45219ef561f1fe09.zip
print/hplip: Fix snprintf calls when device URI contains %20
PR: 270741
-rw-r--r--print/hplip/Makefile1
-rw-r--r--print/hplip/files/patch-protocol_hp__ipp.c46
2 files changed, 47 insertions, 0 deletions
diff --git a/print/hplip/Makefile b/print/hplip/Makefile
index ef4be4e5a530..0d022ca4609c 100644
--- a/print/hplip/Makefile
+++ b/print/hplip/Makefile
@@ -1,5 +1,6 @@
PORTNAME= hplip
PORTVERSION= 3.23.8
+PORTREVISION= 1
CATEGORIES= print
MASTER_SITES= SF
diff --git a/print/hplip/files/patch-protocol_hp__ipp.c b/print/hplip/files/patch-protocol_hp__ipp.c
new file mode 100644
index 000000000000..f25f08f88867
--- /dev/null
+++ b/print/hplip/files/patch-protocol_hp__ipp.c
@@ -0,0 +1,46 @@
+--- protocol/hp_ipp.c.orig 2023-09-13 04:07:44 UTC
++++ protocol/hp_ipp.c
+@@ -108,9 +108,6 @@ int addCupsPrinter(char *name, char *device_uri, char
+ goto abort;
+ }
+
+- if ( info == NULL )
+- snprintf( info,sizeof(info), name );
+-
+ sprintf(printer_uri, "ipp://localhost/printers/%s", name);
+
+ cupsSetUser("root");
+@@ -514,27 +511,27 @@ int __parsePrinterAttributes(ipp_t *response, printer_
+
+ 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 ) {