- Security: All file, directory, user, and group settings are now stored
in a separate cups-files.conf configuration file that cannot be set
through the CUPS web interface or APIs (STR #4223)
+ - Coverity scan: fixed some minor issues (STR #4242)
- The scheduler did not remove color profiles after deleting a printer
(STR #4232)
- The CUPS library did not always detect a timed out connection to the
* If it didn't exit abort the pending read and wait an additional
* second...
*/
-
+
if (!g.read_thread_done)
{
- fputs("DEBUG: Read thread still active, aborting the pending read...\n",
+ fputs("DEBUG: Read thread still active, aborting the pending read...\n",
stderr);
g.wait_eof = 0;
gettimeofday(&tv, NULL);
cond_timeout.tv_sec = tv.tv_sec + 1;
cond_timeout.tv_nsec = tv.tv_usec * 1000;
-
+
while (!g.read_thread_done)
{
if (pthread_cond_timedwait(&g.read_thread_cond, &g.read_thread_mutex,
pthread_mutex_unlock(&g.read_thread_mutex);
}
- if (print_fd)
- close(print_fd);
-
/*
* Close the connection and input file and general clean up...
*/
*/
if (printer->origconf > 0 && printer->origconf != number2)
{
- fprintf(stderr, "DEBUG: Restoring USB device configuration: %d -> %d\n",
+ fprintf(stderr, "DEBUG: Restoring USB device configuration: %d -> %d\n",
number2, printer->origconf);
if ((errcode = libusb_set_configuration(printer->handle,
printer->origconf)) < 0)
*/
if (((altptr->bInterfaceClass != LIBUSB_CLASS_PRINTER ||
- altptr->bInterfaceSubClass != 1) &&
+ altptr->bInterfaceSubClass != 1) &&
((printer.quirks & USBLP_QUIRK_BAD_CLASS) == 0)) ||
(altptr->bInterfaceProtocol != 1 && /* Unidirectional */
altptr->bInterfaceProtocol != 2) || /* Bidirectional */
bEndpointAddress;
}
else
- fprintf(stderr, "DEBUG: Uni-directional USB communication "
+ fprintf(stderr, "DEBUG: Uni-directional USB communication "
"only!\n");
printer.write_endp = confptr->interface[printer.iface].
altsetting[printer.altset].
printer->origconf = current;
- if ((errcode =
+ if ((errcode =
libusb_get_config_descriptor (printer->device, printer->conf, &confptr))
< 0)
{
if (number1 != current)
{
- fprintf(stderr, "DEBUG: Switching USB device configuration: %d -> %d\n",
+ fprintf(stderr, "DEBUG: Switching USB device configuration: %d -> %d\n",
current, number1);
if ((errcode = libusb_set_configuration(printer->handle, number1)) < 0)
{
active = NULL;
}
- if (tries >= 0)
+ if (tries >= 100)
{
DEBUG_puts("1cupsCopyDestConflicts: Unable to resolve after 100 tries.");
have_conflicts = -1;
error));
#endif /* DEBUG */
}
+
+ httpAddrFreeList(addrlist);
}
}
error));
#endif /* DEBUG */
}
+
+ httpAddrFreeList(addrlist);
}
}
if (!strcmp(attrname, "document-state") &&
enumvalue >= 3 &&
- enumvalue <= (3 + (int)(sizeof(ipp_document_states) /
- sizeof(ipp_document_states[0]))))
+ enumvalue < (3 + (int)(sizeof(ipp_document_states) /
+ sizeof(ipp_document_states[0]))))
return (ipp_document_states[enumvalue - 3]);
else if (!strcmp(attrname, "finishings") ||
!strcmp(attrname, "finishings-actual") ||
!strcmp(attrname, "finishings-supported"))
{
if (enumvalue >= 3 &&
- enumvalue <= (3 + (int)(sizeof(ipp_finishings) /
- sizeof(ipp_finishings[0]))))
+ enumvalue < (3 + (int)(sizeof(ipp_finishings) /
+ sizeof(ipp_finishings[0]))))
return (ipp_finishings[enumvalue - 3]);
else if (enumvalue >= 0x40000000 &&
enumvalue <= (0x40000000 + (int)(sizeof(ipp_finishings_vendor) /
else if ((!strcmp(attrname, "job-collation-type") ||
!strcmp(attrname, "job-collation-type-actual")) &&
enumvalue >= 3 &&
- enumvalue <= (3 + (int)(sizeof(ipp_job_collation_types) /
- sizeof(ipp_job_collation_types[0]))))
+ enumvalue < (3 + (int)(sizeof(ipp_job_collation_types) /
+ sizeof(ipp_job_collation_types[0]))))
return (ipp_job_collation_types[enumvalue - 3]);
else if (!strcmp(attrname, "job-state") &&
enumvalue >= IPP_JOB_PENDING && enumvalue <= IPP_JOB_COMPLETED)
!strcmp(attrname, "orientation-requested-default") ||
!strcmp(attrname, "orientation-requested-supported")) &&
enumvalue >= 3 &&
- enumvalue <= (3 + (int)(sizeof(ipp_orientation_requesteds) /
- sizeof(ipp_orientation_requesteds[0]))))
+ enumvalue < (3 + (int)(sizeof(ipp_orientation_requesteds) /
+ sizeof(ipp_orientation_requesteds[0]))))
return (ipp_orientation_requesteds[enumvalue - 3]);
else if ((!strcmp(attrname, "print-quality") ||
!strcmp(attrname, "print-quality-actual") ||
!strcmp(attrname, "print-quality-default") ||
!strcmp(attrname, "print-quality-supported")) &&
enumvalue >= 3 &&
- enumvalue <= (3 + (int)(sizeof(ipp_print_qualities) /
- sizeof(ipp_print_qualities[0]))))
+ enumvalue < (3 + (int)(sizeof(ipp_print_qualities) /
+ sizeof(ipp_print_qualities[0]))))
return (ipp_print_qualities[enumvalue - 3]);
else if (!strcmp(attrname, "printer-state") &&
enumvalue >= IPP_PRINTER_IDLE && enumvalue <= IPP_PRINTER_STOPPED)
ipp->prev = ipp->current;
attr = ipp->current = ipp_add_attr(ipp, NULL, ipp->curtag, IPP_TAG_ZERO, 1);
+ if (!attr)
+ {
+ _cupsSetHTTPError(HTTP_ERROR);
+ DEBUG_puts("1ippReadIO: unable to allocate attribute.");
+ _cupsBufferRelease((char *)buffer);
+ return (IPP_ERROR);
+ }
DEBUG_printf(("2ippReadIO: membername, ipp->current=%p, ipp->prev=%p",
ipp->current, ipp->prev));
_cupsStrFree(attr->values[0].string.language);
attr->values[0].string.language = NULL;
}
+ /* Fall through to other string values */
case IPP_TAG_TEXT :
case IPP_TAG_NAME :
if (srctype)
{
+ /* sscanf return value already checked above */
sscanf(srctype, "%15[^/]/%255s", super, type);
if ((src = mimeType(mime, super, type)) == NULL)
{
return (1);
}
+ /* sscanf return value already checked above */
sscanf(dsttype, "%15[^/]/%255s", super, type);
if (!_cups_strcasecmp(super, "printer"))
dst = printer_type;
else
unload_job(job);
}
+ else
+ free(job);
}
cupsDirClose(dir);
if (!strcmp(name, "time-at-completed"))
{
- if (JobHistory < INT_MAX)
+ if (JobHistory < INT_MAX && attr)
job->history_time = attr->values[0].integer + JobHistory;
else
job->history_time = INT_MAX;
if (job->history_time < JobHistoryUpdate || !JobHistoryUpdate)
JobHistoryUpdate = job->history_time;
- if (JobFiles < INT_MAX)
+ if (JobFiles < INT_MAX && attr)
job->file_time = attr->values[0].integer + JobFiles;
else
job->file_time = INT_MAX;