Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cups-browsed SEGFAULTs when cupsEnumDests() returned dest has no "device-uri" option #16

Closed
sideeffect42 opened this issue Feb 2, 2018 · 1 comment

Comments

@sideeffect42
Copy link

cups-browsed 1.20.0 crashes when starting up on Gentoo Linux.
I have a CUPS print server in my LAN that advertises printers through DNS-SD.

# cups-browsed --debug
Fri Feb  2 18:20:40 2018 Reading command line option --debug, turning on debug mode (Log on standard error).
Fri Feb  2 18:20:40 2018 cups-browsed of cups-filters version 1.20.0 starting.
Fri Feb  2 18:20:40 2018 Reading config: BrowseRemoteProtocols dnssd
Fri Feb  2 18:20:40 2018 Reading config: CreateIPPPrinterQueues All
Fri Feb  2 18:20:40 2018 No "Browse..." line at all, accept all servers ("BrowseOrder Deny,Allow").
Fri Feb  2 18:20:40 2018 main() in THREAD -1225566704
Fri Feb  2 18:20:40 2018 cups-browsed: Creating http connection to local CUPS daemon: /run/cups/cups.sock:631
Fri Feb  2 18:20:40 2018 update_netifs() in THREAD -1225566704
Fri Feb  2 18:20:40 2018 network interface at 192.168.0.38
Fri Feb  2 18:20:40 2018 cups-browsed [BrowsePoll /run/cups/cups.sock:0]: IPP-Create-Subscription
Fri Feb  2 18:20:40 2018 cups-browsed [BrowsePoll /run/cups/cups.sock:0]: subscription ID=58
Fri Feb  2 18:20:41 2018 cups-browsed (/run/cups/cups.sock): cupsEnumDests
Segmentation fault

I could debug it so far that in cups-browsed.c in get_local_printers(void) when iterating through dests, the device_uri is NULL (for some printers?).
For example:

{
  name = 0x7d714 "HP Deskjet 6940 @ Print-Server", 
  instance = 0x0, 
  is_default = 0, 
  num_options = 5, 
  options = 0x7fbe8 {
    {name = 0x7e2fc "printer-info", value = 0x7d714 "HP Deskjet 6940 @ Print-Server"}, 
    {name = 0x7bccc "printer-location", value = 0x7d904 "Keller"}, 
    {name = 0x7bd1c "printer-make-and-model", value = 0x7014c "HP Deskjet 6943 Printer"}, 
    {name = 0x7d144 "printer-type", value = 0x7d0fc "36894"}, 
    {name = 0x70a4c "printer-uri-supported", value = 0x7e314 "ipps://HP%20Deskjet%206940%20%40%20Print-Server._ipps._tcp.local/cups"}
  }
}

As a result the application segfaults in new_local_printer(device_uri, cups_browsed_controlled) on line 765, because device_uri is NULL

  printer->device_uri = strdup (device_uri);
@tillkamppeter
Copy link
Member

Fixed in 3dd9b4. Thank you for your bug report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants