diff options
author | Michael R Sweet <michael.r.sweet@gmail.com> | 2019-11-17 10:18:09 -0500 |
---|---|---|
committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2019-11-18 11:19:16 -0500 |
commit | f4a99aeb0252068ee78bf2158fb01fef6f4599ca (patch) | |
tree | 31028c3e796a4b1701a10a06ffe37d823360d783 /backend | |
parent | f950947148bd1867c247a211af7404056b2b2e36 (diff) | |
download | cups-f4a99aeb0252068ee78bf2158fb01fef6f4599ca.tar.gz |
Address multiple minor issues reported by the LGTM security scanner:
- Lots of usage of localtime and gmtime (use _r/_s versions instead -
Issue #5685)
- Some unnecessary comparisons
- Suppress checks that are not useful (header guards, short global names, and
the integer overflow checks which don't reflect the actual range of values)
Diffstat (limited to 'backend')
-rw-r--r-- | backend/lpd.c | 10 | ||||
-rw-r--r-- | backend/usb-libusb.c | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/backend/lpd.c b/backend/lpd.c index 45cdde8e7..efc7a9acc 100644 --- a/backend/lpd.c +++ b/backend/lpd.c @@ -71,7 +71,11 @@ static int abort_job = 0; /* Non-zero if we get SIGTERM */ */ static int cups_rresvport(int *port, int family); -static int lpd_command(int lpd_fd, char *format, ...); +static int lpd_command(int lpd_fd, char *format, ...) +# ifdef __GNUC__ +__attribute__ ((__format__ (__printf__, 2, 3))) +# endif /* __GNUC__ */ +; static int lpd_queue(const char *hostname, http_addrlist_t *addrlist, const char *printer, int print_fd, int snmp_fd, int mode, const char *user, const char *title, int copies, int banner, int format, int order, int reserve, int manual_copies, int timeout, int contimeout, const char *orighost) _CUPS_NONNULL((1,2,3,7,8,17)); static ssize_t lpd_write(int lpd_fd, char *buffer, size_t length); static void sigterm_handler(int sig); @@ -1042,7 +1046,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ * Send the control file... */ - if (lpd_command(fd, "\002%d cfA%03.3d%.15s\n", strlen(control), + if (lpd_command(fd, "\002%d cfA%03.3d%.15s\n", (int)strlen(control), (int)getpid() % 1000, localhost)) { close(fd); @@ -1175,7 +1179,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ * Send control file... */ - if (lpd_command(fd, "\002%d cfA%03.3d%.15s\n", strlen(control), + if (lpd_command(fd, "\002%d cfA%03.3d%.15s\n", (int)strlen(control), (int)getpid() % 1000, localhost)) { close(fd); diff --git a/backend/usb-libusb.c b/backend/usb-libusb.c index 1c4d9f117..9740c14d5 100644 --- a/backend/usb-libusb.c +++ b/backend/usb-libusb.c @@ -878,7 +878,7 @@ find_device(usb_cb_t cb, /* I - Callback function */ protocol = 0; for (altset = 0, altptr = ifaceptr->altsetting; - altset < ifaceptr->num_altsetting; + altset < (uint8_t)ifaceptr->num_altsetting; altset ++, altptr ++) { /* |