Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Leap:15.5:Update
hplip
fix-printer-attributes-parsing.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix-printer-attributes-parsing.patch of Package hplip
Index: hplip-3.21.10/protocol/hp_ipp.c =================================================================== --- hplip-3.21.10.orig/protocol/hp_ipp.c +++ hplip-3.21.10/protocol/hp_ipp.c @@ -43,6 +43,12 @@ Boston, MA 02110-1301, USA. #define _STRINGIZE(x) #x #define STRINGIZE(x) _STRINGIZE(x) +#define hplip_strlcpy(dst, src, size) \ + do { \ + if (!memccpy(dst, src, '\0', size)) \ + dst[size - 1] = '\0'; \ + } while (0) + http_t* acquireCupsInstance() { @@ -113,7 +119,7 @@ int addCupsPrinter(char *name, char *dev } if ( info == NULL ) - strcpy( info, name ); + hplip_strlcpy( info, name, sizeof(info)); sprintf( printer_uri, "ipp://localhost/printers/%s", name ); @@ -514,27 +520,27 @@ int __parsePrinterAttributes(ipp_t *resp if ( strcmp(attr_name, "printer-name") == 0 && val_tag == IPP_TAG_NAME ) { - strcpy(t_printer->name, ippGetString(attr, 0, NULL) ); + hplip_strlcpy(t_printer->name, ippGetString(attr, 0, NULL), sizeof(t_printer->name) ); } else if ( strcmp(attr_name, "device-uri") == 0 && val_tag == IPP_TAG_URI ) { - strcpy(t_printer->device_uri, ippGetString(attr, 0, NULL) ); + hplip_strlcpy(t_printer->device_uri, ippGetString(attr, 0, NULL), sizeof(t_printer->device_uri) ); } else if ( strcmp(attr_name, "printer-uri-supported") == 0 && val_tag == IPP_TAG_URI ) { - strcpy(t_printer->printer_uri, ippGetString(attr, 0, NULL) ); + hplip_strlcpy(t_printer->printer_uri, ippGetString(attr, 0, NULL), sizeof(t_printer->printer_uri) ); } else if ( strcmp(attr_name, "printer-info") == 0 && val_tag == IPP_TAG_TEXT ) { - strcpy(t_printer->info, ippGetString(attr, 0, NULL) ); + hplip_strlcpy(t_printer->info, ippGetString(attr, 0, NULL), sizeof(t_printer->info) ); } else if ( strcmp(attr_name, "printer-location") == 0 && val_tag == IPP_TAG_TEXT ) { - strcpy(t_printer->location, ippGetString(attr, 0, NULL) ); + hplip_strlcpy(t_printer->location, ippGetString(attr, 0, NULL), sizeof(t_printer->location) ); } else if ( strcmp(attr_name, "printer-make-and-model") == 0 && val_tag == IPP_TAG_TEXT ) { - strcpy(t_printer->make_model, ippGetString(attr, 0, NULL) ); + hplip_strlcpy(t_printer->make_model, ippGetString(attr, 0, NULL), sizeof(t_printer->make_model)); } else if ( strcmp(attr_name, "printer-state") == 0 && val_tag == IPP_TAG_ENUM ) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor