kopia lustrzana https://gitlab.com/sane-project/backends
dell1600n_net: return empty list when local devices are requested
!502 made the dell1600n_net backend return GOOD status when local devices are requested. This is problematic since in that case the caller may assume that the passed device list has been populated. However, this is not the case for this backend, since the device list is not modified in any way in that case. The caller trying to access the device list may lead to undesired consequences. Fix that by returning an empty list if 'local_only' is true.merge-requests/540/head
rodzic
245564dffe
commit
0f9b481fee
|
@ -233,6 +233,9 @@ static void JpegDecompTermSource (j_decompress_ptr cinfo);
|
|||
/* Results of last call to sane_get_devices */
|
||||
static struct DeviceRecord *gKnownDevices[MAX_SCANNERS];
|
||||
|
||||
/* Empty list for when network devices are not wanted */
|
||||
static const SANE_Device *gEmptyDeviceList[1];
|
||||
|
||||
/* Array of open scanner device states.
|
||||
:NOTE: (int)SANE_Handle is an offset into this array */
|
||||
static struct ScannerState *gOpenScanners[MAX_SCANNERS];
|
||||
|
@ -306,15 +309,17 @@ sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only)
|
|||
const char *pVal;
|
||||
int valLen;
|
||||
|
||||
if (local_only) {
|
||||
*device_list = gEmptyDeviceList;
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
/* init variables */
|
||||
ret = SANE_STATUS_GOOD;
|
||||
sock = 0;
|
||||
pDevice = NULL;
|
||||
optYes = 1;
|
||||
|
||||
if (local_only)
|
||||
return ret;
|
||||
|
||||
InitComBuf (&queryPacket);
|
||||
|
||||
/* clear previous results */
|
||||
|
|
Ładowanie…
Reference in New Issue