michaelrsweet / pappl

PAPPL - Printer Application Framework
https://www.msweet.org/pappl
Apache License 2.0
309 stars 49 forks source link

SEGV in pappl_snmp_find because cur_device->uri is NULL #121

Closed prlw1 closed 3 years ago

prlw1 commented 3 years ago

Just managed to compile ps-printer-app. Ran "ps-printer-app server", and "ps-printer-app devices". (No configuring had happened.) This gave me a SEGV in device-network.c

   843      if (!strcmp(make, "HP") && !strncmp(model, "HP ", 3))
   844        snprintf(info, sizeof(info), "%s (Network Printer %s)", model, cur_device->uri + 7);
   845      else
   846        snprintf(info, sizeof(info), "%s %s (Network Printer %s)", make, model, cur_device->uri + 7);

because

(gdb) print cur_device->uri
$3 = 0x0

Could be because I didn't configure any devices, but we probably shouldn't dump core as a result...

michaelrsweet commented 3 years ago

@prlw1 Hmm, we should never do the callback if the URI isn't filled in. Investigating...

michaelrsweet commented 3 years ago

[master a47b0eb] Fix crash from partially discovered SNMP printer (Issue #121)