Bug
1691347 - Work around a null argument bug in _platform_strstr in CUPS. r=dholbert
This is just a large conditional to check for the specific branches taken
that would result in the null string. The path in CUPS is as follows:
In cupsCopyDestInfo, CUPS_DEST_FLAG_DEVICE is set when the connection is not
null (same as CUPS_HTTP_DEFAULT), the print server is not the same as our
hostname and is not path-based (starts with a '/'), or the IPP port is
different than the global server IPP port.
https://github.com/apple/cups/blob/
c9da6f63b263faef5d50592fe8cf8056e0a58aa2/cups/dest-options.c#L718-L722
In _cupsGetDestResource, CUPS fetches the IPP options "printer-uri-supported"
and "device-uri". Importantly, IPP options are returned as null when missing.
https://github.com/apple/cups/blob/
23c45db76a8520fd6c3b1d9164dbe312f1ab1481/cups/dest.c#L1138-L1141
If the CUPS_DEST_FLAG_DEVICE is set or the "printer-uri-supported" option is
not set, CUPS checks for "._tcp" in the "device-uri" option without doing a
NULL-check first.
https://github.com/apple/cups/blob/
23c45db76a8520fd6c3b1d9164dbe312f1ab1481/cups/dest.c#L1144
If we find that those branches will be taken, don't actually fetch the CUPS
data and instead just return an empty printer info.
Differential Revision: https://phabricator.services.mozilla.com/
D128529