git: 519a7472d666 - main - print/hplip: Fix snprintf calls when device URI contains %20
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 Nov 2023 15:46:10 UTC
The branch main has been updated by tijl: URL: https://cgit.FreeBSD.org/ports/commit/?id=519a7472d666302ea47f201a45219ef561f1fe09 commit 519a7472d666302ea47f201a45219ef561f1fe09 Author: Tijl Coosemans <tijl@FreeBSD.org> AuthorDate: 2023-11-17 14:20:45 +0000 Commit: Tijl Coosemans <tijl@FreeBSD.org> CommitDate: 2023-11-17 15:44:22 +0000 print/hplip: Fix snprintf calls when device URI contains %20 PR: 270741 --- print/hplip/Makefile | 1 + print/hplip/files/patch-protocol_hp__ipp.c | 46 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) 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 ) {