]> granicus.if.org Git - sudo/commitdiff
Quiet sign comparision warnings.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 23 Oct 2013 21:03:31 +0000 (15:03 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 23 Oct 2013 21:03:31 +0000 (15:03 -0600)
27 files changed:
common/fileops.c
common/lbuf.c
common/secure_path.c
common/sudo_debug.c
include/secure_path.h
plugins/sudoers/find_path.c
plugins/sudoers/getdate.c
plugins/sudoers/group_plugin.c
plugins/sudoers/interfaces.h
plugins/sudoers/iolog.c
plugins/sudoers/iolog_path.c
plugins/sudoers/ldap.c
plugins/sudoers/logging.c
plugins/sudoers/match_addr.c
plugins/sudoers/parse.h
plugins/sudoers/policy.c
plugins/sudoers/prompt.c
plugins/sudoers/pwutil_impl.c
plugins/sudoers/set_perms.c
plugins/sudoers/sudoreplay.c
plugins/sudoers/timestamp.c
plugins/sudoers/toke.c
plugins/sudoers/toke.l
plugins/sudoers/toke_util.c
src/load_plugins.c
src/sudo.c
src/ttyname.c

index 577bf10a4e2d8be70bfe76445ce04ee1575da916..89f7ffcf67649b40c8b5a60b52ffccd15cc56cef 100644 (file)
@@ -168,7 +168,8 @@ lock_file(int fd, int lockit)
 ssize_t
 sudo_parseln(char **bufp, size_t *bufsizep, unsigned int *lineno, FILE *fp)
 {
-    size_t len, linesize = 0, total = 0;
+    size_t linesize = 0, total = 0;
+    ssize_t len;
     char *cp, *line = NULL;
     bool continued;
     debug_decl(sudo_parseln, SUDO_DEBUG_UTIL)
index fe87a75341d9303edca9974448e8fe85b62c63b5..58ac88f152d1fb19c5ee661f3ef9c74644605ac8 100644 (file)
@@ -77,7 +77,7 @@ lbuf_destroy(struct lbuf *lbuf)
 }
 
 static void
-lbuf_expand(struct lbuf *lbuf, size_t extra)
+lbuf_expand(struct lbuf *lbuf, int extra)
 {
     if (lbuf->len + extra + 1 >= lbuf->size) {
        do {
index 6eaf2fc850f429e09843bcb5fe37b03eb2360e36..fd2f75c07274946ed6e993b90232cbfef2842b02 100644 (file)
@@ -38,7 +38,7 @@
  * Verify that path is the right type and not writable by other users.
  */
 int
-sudo_secure_path(const char *path, int type, uid_t uid, gid_t gid, struct stat *sbp)
+sudo_secure_path(const char *path, unsigned int type, uid_t uid, gid_t gid, struct stat *sbp)
 {
     struct stat sb;
     int rval = SUDO_PATH_MISSING;
index 4a737f83585e04ed16ef831b34105cd5653a3e63..7e51ff279632c5bfee83f707813eaa9d33183cbc 100644 (file)
@@ -119,6 +119,7 @@ static int sudo_debug_fd = -1;
 static int sudo_debug_mode;
 static char sudo_debug_pidstr[(((sizeof(int) * 8) + 2) / 3) + 3];
 static size_t sudo_debug_pidlen;
+static const int num_subsystems = NUM_SUBSYSTEMS;
 
 /*
  * Parse settings string from sudo.conf and open debugfile.
@@ -135,7 +136,7 @@ int sudo_debug_init(const char *debugfile, const char *settings)
        return 1;
 
     /* Init per-subsystems settings to -1 since 0 is a valid priority. */
-    for (i = 0; i < NUM_SUBSYSTEMS; i++)
+    for (i = 0; i < num_subsystems; i++)
        sudo_debug_settings[i] = -1;
 
     /* Open debug file if specified. */
@@ -442,7 +443,7 @@ sudo_debug_vprintf2(const char *func, const char *file, int lineno, int level,
     subsys = SUDO_DEBUG_SUBSYS(level);
 
     /* Make sure we want debug info at this level. */
-    if (subsys < NUM_SUBSYSTEMS && sudo_debug_settings[subsys] >= pri) {
+    if (subsys < num_subsystems && sudo_debug_settings[subsys] >= pri) {
        buflen = fmt ? vasprintf(&buf, fmt, ap) : 0;
        if (buflen != -1) {
            int errcode = ISSET(level, SUDO_DEBUG_ERRNO) ? saved_errno : 0;
@@ -484,7 +485,7 @@ sudo_debug_execve2(int level, const char *path, char *const argv[], char *const
     subsys = SUDO_DEBUG_SUBSYS(level);
 
     /* Make sure we want debug info at this level. */
-    if (subsys >= NUM_SUBSYSTEMS || sudo_debug_settings[subsys] < pri)
+    if (subsys >= num_subsystems || sudo_debug_settings[subsys] < pri)
        return;
 
     /* Log envp for debug level "debug". */
index b96b89b544ffffb9c6b8c7d587e4e8e90b721c3b..aa4f8de651775535908015b3d417b3abd59c42c0 100644 (file)
@@ -26,6 +26,6 @@
 
 int sudo_secure_dir(const char *path, uid_t uid, gid_t gid, struct stat *sbp);
 int sudo_secure_file(const char *path, uid_t uid, gid_t gid, struct stat *sbp);
-int sudo_secure_path(const char *path, int type, uid_t uid, gid_t gid, struct stat *sbp);
+int sudo_secure_path(const char *path, unsigned int type, uid_t uid, gid_t gid, struct stat *sbp);
 
 #endif /* _SUDO_SECURE_PATH_H */
index 2d5261372975649325fa0e7f61cc6840996a970d..7dea1edacbc8e7980524793e495feb7dd2c3a5d8 100644 (file)
@@ -105,7 +105,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path,
         * Resolve the path and exit the loop if found.
         */
        len = snprintf(command, sizeof(command), "%s/%s", path, infile);
-       if (len <= 0 || len >= sizeof(command)) {
+       if (len <= 0 || (size_t)len >= sizeof(command)) {
            errno = ENAMETOOLONG;
            fatal("%s", infile);
        }
@@ -122,7 +122,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path,
      */
     if (!found && checkdot) {
        len = snprintf(command, sizeof(command), "./%s", infile);
-       if (len <= 0 || len >= sizeof(command)) {
+       if (len <= 0 || (size_t)len >= sizeof(command)) {
            errno = ENAMETOOLONG;
            fatal("%s", infile);
        }
index c64dcf811a86888b813a0097183751f13afb3b17..9cc2d5a72757cee5a83bd366013884c9903be4f3 100644 (file)
@@ -1049,7 +1049,7 @@ static int yygrowstack()
 #else
 #define YY_SIZE_MAX 0x7fffffff
 #endif
-    if (YY_SIZE_MAX / newsize < sizeof *newss)
+    if (YY_SIZE_MAX / (unsigned int)newsize < sizeof *newss)
         goto bail;
     i = yyssp - yyss;
     newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
index fcb1eecc21b13f9be6e9123bccf8c4be978e6d82..9dd2ebaf1ee2603b9c1d1f05af8fd1038d341713 100644 (file)
@@ -86,7 +86,7 @@ group_plugin_load(char *plugin_info)
        len = snprintf(path, sizeof(path), "%s%s",
            (*plugin_info != '/') ? _PATH_SUDO_PLUGIN_DIR : "", plugin_info);
     }
-    if (len <= 0 || len >= sizeof(path)) {
+    if (len <= 0 || (size_t)len >= sizeof(path)) {
        errno = ENAMETOOLONG;
        warning("%s%s",
            (*plugin_info != '/') ? _PATH_SUDO_PLUGIN_DIR : "", plugin_info);
index 26e669824bd2e361b9c1087daf366dfc11ee6933..f60ba1d7af369dacb05431786c30beecee352384 100644 (file)
@@ -37,7 +37,7 @@ union sudo_in_addr_un {
  */
 struct interface {
     SLIST_ENTRY(interface) entries;
-    int family;        /* AF_INET or AF_INET6 */
+    unsigned int family;       /* AF_INET or AF_INET6 */
     union sudo_in_addr_un addr;
     union sudo_in_addr_un netmask;
 };
index 6dc8a26343aa4bd46b194df6cd2f4763b9010715..e6ef6c5e6022357a6b112b21dc5a580c47313c27 100644 (file)
@@ -176,7 +176,7 @@ io_nextid(char *iolog_dir, char *iolog_dir_fallback, char sessid[7])
      * Open sequence file
      */
     len = snprintf(pathbuf, sizeof(pathbuf), "%s/seq", iolog_dir);
-    if (len <= 0 || len >= sizeof(pathbuf)) {
+    if (len <= 0 || (size_t)len >= sizeof(pathbuf)) {
        errno = ENAMETOOLONG;
        log_fatal(USE_ERRNO, "%s/seq", pathbuf);
     }
@@ -196,7 +196,7 @@ io_nextid(char *iolog_dir, char *iolog_dir_fallback, char sessid[7])
 
        len = snprintf(fallback, sizeof(fallback), "%s/seq",
            iolog_dir_fallback);
-       if (len > 0 && len < sizeof(fallback)) {
+       if (len > 0 && (size_t)len < sizeof(fallback)) {
            int fd2 = open(fallback, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
            if (fd2 != -1) {
                nread = read(fd2, buf, sizeof(buf));
index 2d3ac90b5bf2f62d5fed0b7600346a13112adbfb..b533e21bc525c20bfe4ac4aa79e3906e44c7f8b2 100644 (file)
@@ -194,7 +194,7 @@ expand_iolog_path(const char *prefix, const char *dir, const char *file,
            break;
        case 1:
            /* Trim trailing slashes from dir component. */
-           while (dst - path - 1 > prelen && dst[-1] == '/')
+           while (dst > path + prelen + 1 && dst[-1] == '/')
                dst--;
            /* The NUL will be replaced with a '/' at the end. */
            if (dst + 1 >= pathend)
index 3e93ccd69ff0a835a5051788b5af13d6d18595ae..4fffe04db3e8c74ad1d78ff4f97b5d5bb4a61946 100644 (file)
@@ -398,10 +398,12 @@ sudo_ldap_conf_add_ports(void)
 
     char *host, *port, defport[13];
     char hostbuf[LINE_MAX * 2];
+    int len;
     debug_decl(sudo_ldap_conf_add_ports, SUDO_DEBUG_LDAP)
 
     hostbuf[0] = '\0';
-    if (snprintf(defport, sizeof(defport), ":%d", ldap_conf.port) >= sizeof(defport))
+    len = snprintf(defport, sizeof(defport), ":%d", ldap_conf.port);
+    if (len <= 0 || (size_t)len >= sizeof(defport))
        fatalx(_("sudo_ldap_conf_add_ports: port too large"));
 
     for ((host = strtok(ldap_conf.host, " \t")); host; (host = strtok(NULL, " \t"))) {
@@ -1099,7 +1101,7 @@ sudo_ldap_timefilter(char *buffer, size_t buffersize)
     /* Build filter. */
     bytes = snprintf(buffer, buffersize, "(&(|(!(sudoNotAfter=*))(sudoNotAfter>=%s))(|(!(sudoNotBefore=*))(sudoNotBefore<=%s)))",
        timebuffer, timebuffer);
-    if (bytes < 0 || bytes >= buffersize) {
+    if (bytes <= 0 || (size_t)bytes >= buffersize) {
        warning(_("unable to build time filter"));
        bytes = 0;
     }
index b454b21bd48c9eba1adfd8407e5519f65274abdc..449eaee37ec5f1cfbdd71ea8284b5829b6e87ee4 100644 (file)
@@ -198,7 +198,7 @@ do_logfile(char *msg)
            def_logfile, strerror(errno));
     } else {
        time(&now);
-       if (def_loglinelen < sizeof(LOG_INDENT)) {
+       if ((size_t)def_loglinelen < sizeof(LOG_INDENT)) {
            /* Don't pretty-print long log file lines (hard to grep) */
            if (def_log_host) {
                (void) fprintf(fp, "%s : %s : HOST=%s : %s\n",
index 29bfd52dc3b10fa47a091f086e870ec2c3929fba..1d757c814148b4de0d339dd101ed375a1a922082 100644 (file)
@@ -55,9 +55,9 @@ addr_matches_if(char *n)
     union sudo_in_addr_un addr;
     struct interface *ifp;
 #ifdef HAVE_STRUCT_IN6_ADDR
-    int j;
+    unsigned int j;
 #endif
-    int family;
+    unsigned int family;
     debug_decl(addr_matches_if, SUDO_DEBUG_MATCH)
 
 #ifdef HAVE_STRUCT_IN6_ADDR
@@ -102,13 +102,13 @@ addr_matches_if(char *n)
 static bool
 addr_matches_if_netmask(char *n, char *m)
 {
-    int i;
+    unsigned int i;
     union sudo_in_addr_un addr, mask;
     struct interface *ifp;
 #ifdef HAVE_STRUCT_IN6_ADDR
-    int j;
+    unsigned int j;
 #endif
-    int family;
+    unsigned int family;
     debug_decl(addr_matches_if, SUDO_DEBUG_MATCH)
 
 #ifdef HAVE_STRUCT_IN6_ADDR
index 62bb8acbcd966f7021cbd2f067655dc6ecbb63ec..a29951649a0d8d0ae244e1be4366f805c0de43c3 100644 (file)
@@ -34,7 +34,7 @@
 #define SUDO_DIGEST_INVALID    4
 
 struct sudo_digest {
-    int digest_type;
+    unsigned int digest_type;
     char *digest_str;
 };
 
index a87d5a2d3889333ea709936b3711cbdd8402cf0f..2d04c33e0eaf91f6bd2a4937ccd2693e0d8b66f8 100644 (file)
@@ -463,14 +463,14 @@ sudoers_policy_exec_setup(char *argv[], char *envp[], mode_t cmnd_umask,
        egid = runas_gr ? (unsigned int)runas_gr->gr_gid :
            (unsigned int)runas_pw->pw_gid;
        len = snprintf(cp, glsize - (cp - gid_list), "%u", egid);
-       if (len < 0 || len >= glsize - (cp - gid_list))
+       if (len < 0 || (size_t)len >= glsize - (cp - gid_list))
            fatalx(_("internal error, %s overflow"), "runas_groups");
        cp += len;
        for (i = 0; i < grlist->ngids; i++) {
            if (grlist->gids[i] != egid) {
                len = snprintf(cp, glsize - (cp - gid_list), ",%u",
                     (unsigned int) grlist->gids[i]);
-               if (len < 0 || len >= glsize - (cp - gid_list))
+               if (len < 0 || (size_t)len >= glsize - (cp - gid_list))
                    fatalx(_("internal error, %s overflow"), "runas_groups");
                cp += len;
            }
index e98c8eeecc8b800b71d80c7a245e02e87b56c043..af1dc125dac98714a72eadd44caff9058a8f3675 100644 (file)
@@ -110,14 +110,14 @@ expand_prompt(const char *old_prompt, const char *user, const char *host)
                    case 'h':
                        p++;
                        n = strlcpy(np, user_shost, np - endp);
-                       if (n >= np - endp)
+                       if (n >= (size_t)(np - endp))
                            goto oflow;
                        np += n;
                        continue;
                    case 'H':
                        p++;
                        n = strlcpy(np, user_host, np - endp);
-                       if (n >= np - endp)
+                       if (n >= (size_t)(np - endp))
                            goto oflow;
                        np += n;
                        continue;
@@ -129,21 +129,21 @@ expand_prompt(const char *old_prompt, const char *user, const char *host)
                                n = strlcpy(np, runas_pw->pw_name, np - endp);
                        else
                                n = strlcpy(np, user_name, np - endp);
-                       if (n >= np - endp)
+                       if (n >= (size_t)(np - endp))
                                goto oflow;
                        np += n;
                        continue;
                    case 'u':
                        p++;
                        n = strlcpy(np, user_name, np - endp);
-                       if (n >= np - endp)
+                       if (n >= (size_t)(np - endp))
                            goto oflow;
                        np += n;
                        continue;
                    case 'U':
                        p++;
                        n = strlcpy(np,  runas_pw->pw_name, np - endp);
-                       if (n >= np - endp)
+                       if (n >= (size_t)(np - endp))
                            goto oflow;
                        np += n;
                        continue;
index 8702b886ac1256242e89d6c1be558794330ecb7f..ac335490929f309f91ec8dc1f42d861f1f571f04 100644 (file)
@@ -229,12 +229,12 @@ sudo_make_grlist_item(struct passwd *pw, char * const *unused1,
     char * const *unused2)
 {
     char *cp;
-    size_t i, nsize, ngroups, total, len;
+    size_t nsize, ngroups, total, len;
     struct cache_item_grlist *grlitem;
     struct group_list *grlist;
     GETGROUPS_T *gids;
     struct group *grp;
-    int ngids, groupname_len;
+    int i, ngids, groupname_len;
     debug_decl(sudo_make_grlist_item, SUDO_DEBUG_NSS)
 
     if (pw == sudo_user.pw && sudo_user.gids != NULL) {
index a38cb3a364c528f23e60528c3d326bf62b00839d..095cf62319e81b83356d3f8c0bf214fd9b494182 100644 (file)
@@ -79,9 +79,9 @@ static struct perm_state perm_stack[PERM_STACK_MAX];
 static int perm_stack_depth = 0;
 
 #undef ID
-#define ID(x) (state->x == ostate->x ? -1 : state->x)
+#define ID(x) (state->x == ostate->x ? (id_t)-1 : state->x)
 #undef OID
-#define OID(x) (ostate->x == state->x ? -1 : ostate->x)
+#define OID(x) (ostate->x == state->x ? (id_t)-1 : ostate->x)
 
 void
 rewind_perms(void)
index fcf2eafbc38d9e78dd5836e21ae95819480fae91..922ef9e805f535c9c7af8a7e5eedbccc0f6c5967 100644 (file)
@@ -194,7 +194,7 @@ static int open_io_fd(char *path, int len, struct io_log_file *iol);
 static int parse_timing(const char *buf, const char *decimal, int *idx, double *seconds, size_t *nbytes);
 static struct log_info *parse_logfile(char *logfile);
 static void free_log_info(struct log_info *li);
-static size_t atomic_writev(int fd, struct iovec *iov, int iovcnt);
+static ssize_t atomic_writev(int fd, struct iovec *iov, int iovcnt);
 static void sudoreplay_handler(int);
 static void sudoreplay_cleanup(void);
 
@@ -327,13 +327,13 @@ main(int argc, char *argv[])
     if (VALID_ID(id)) {
        plen = snprintf(path, sizeof(path), "%s/%.2s/%.2s/%.2s/timing",
            session_dir, id, &id[2], &id[4]);
-       if (plen <= 0 || plen >= sizeof(path))
+       if (plen <= 0 || (size_t)plen >= sizeof(path))
            fatalx(_("%s/%.2s/%.2s/%.2s/timing: %s"), session_dir,
                id, &id[2], &id[4], strerror(ENAMETOOLONG));
     } else {
        plen = snprintf(path, sizeof(path), "%s/%s/timing",
            session_dir, id);
-       if (plen <= 0 || plen >= sizeof(path))
+       if (plen <= 0 || (size_t)plen >= sizeof(path))
            fatalx(_("%s/%s/timing: %s"), session_dir,
                id, strerror(ENAMETOOLONG));
     }
@@ -469,7 +469,7 @@ main(int argc, char *argv[])
                    cp = ep + 1;
                    remainder -= linelen;
                }
-               if (cp - buf != nread) {
+               if ((size_t)(cp - buf) != nread) {
                    /*
                     * Partial line without a linefeed or multiple lines
                     * with \r\n pairs.
@@ -542,7 +542,7 @@ open_io_fd(char *path, int len, struct io_log_file *iol)
  * Call writev(), restarting as needed and handling EAGAIN since
  * fd may be in non-blocking mode.
  */
-static size_t
+static ssize_t
 atomic_writev(int fd, struct iovec *iov, int iovcnt)
 {
     ssize_t n, nwritten = 0;
@@ -945,7 +945,8 @@ find_sessions(const char *dir, REGEX_T *re, const char *user, const char *tty)
     struct dirent *dp;
     struct stat sb;
     size_t sdlen, sessions_len = 0, sessions_size = 36*36;
-    int i, len;
+    unsigned int i;
+    int len;
     char pathbuf[PATH_MAX], **sessions = NULL;
 #ifdef HAVE_STRUCT_DIRENT_D_TYPE
     bool checked_type = true;
@@ -999,7 +1000,7 @@ find_sessions(const char *dir, REGEX_T *re, const char *user, const char *tty)
     for (i = 0; i < sessions_len; i++) {
        len = snprintf(&pathbuf[sdlen], sizeof(pathbuf) - sdlen,
            "%s/log", sessions[i]);
-       if (len <= 0 || len >= sizeof(pathbuf) - sdlen) {
+       if (len <= 0 || (size_t)len >= sizeof(pathbuf) - sdlen) {
            errno = ENAMETOOLONG;
            fatal("%s/%s/log", dir, sessions[i]);
        }
index 7f39548837f4f419d9dc3b1a5b697e7a7e27e824..eb50e5ff0c204aee8f4a3e57bc3228e5100b623c 100644 (file)
@@ -88,7 +88,7 @@ build_timestamp(struct passwd *pw)
     timestampfile[0] = '\0';
     len = snprintf(timestampdir, sizeof(timestampdir), "%s/%s", dirparent,
        user_name);
-    if (len <= 0 || len >= sizeof(timestampdir))
+    if (len <= 0 || (size_t)len >= sizeof(timestampdir))
        goto bad;
 
     /*
@@ -103,7 +103,7 @@ build_timestamp(struct passwd *pw)
            /* No tty, use parent pid. */
            len = snprintf(pidbuf, sizeof(pidbuf), "pid%u",
                (unsigned int)getppid());
-           if (len <= 0 || len >= sizeof(pidbuf))
+           if (len <= 0 || (size_t)len >= sizeof(pidbuf))
                goto bad;
            p = pidbuf;
        } else if ((p = strrchr(user_tty, '/'))) {
@@ -118,12 +118,12 @@ build_timestamp(struct passwd *pw)
            len = snprintf(timestampfile, sizeof(timestampfile), "%s/%s/%s",
                dirparent, user_name, p);
        }
-       if (len <= 0 || len >= sizeof(timestampfile))
+       if (len <= 0 || (size_t)len >= sizeof(timestampfile))
            goto bad;
     } else if (def_targetpw) {
        len = snprintf(timestampfile, sizeof(timestampfile), "%s/%s/%s",
            dirparent, user_name, runas_pw->pw_name);
-       if (len <= 0 || len >= sizeof(timestampfile))
+       if (len <= 0 || (size_t)len >= sizeof(timestampfile))
            goto bad;
     }
     sudo_debug_printf(SUDO_DEBUG_INFO, "using timestamp file %s", timestampfile);
index 936c93b88849913efbfc9ae523e30dd864b340b1..8dfedb4fe75025ff28a85bc1a4a32f888d564e42 100644 (file)
@@ -2500,7 +2500,7 @@ YY_RULE_SETUP
 #line 289 "toke.l"
 {
                            /* Only return DIGEST if the length is correct. */
-                           size_t len;
+                           int len;
                            if (sudoerstext[sudoersleng - 1] == '=') {
                                /* use padding */
                                len = 4 * ((digest_len + 2) / 3);
index e90405d4a3987f4e077485008fc468dafc6f7272..413adc9e3b8da666fefb8736e5f4bf385058b763 100644 (file)
@@ -288,7 +288,7 @@ DEFVAR                      [a-z_]+
 
 <WANTDIGEST>[A-Za-z0-9\+/=]+ {
                            /* Only return DIGEST if the length is correct. */
-                           size_t len;
+                           int len;
                            if (sudoerstext[sudoersleng - 1] == '=') {
                                /* use padding */
                                len = 4 * ((digest_len + 2) / 3);
index 505dc8ee7091c2cf8bc688c4082a2a5ee53e3493..cb334f6158489f1b88d7c5c835e3f284d9e1ee8d 100644 (file)
@@ -172,7 +172,7 @@ fill_args(const char *s, int len, int addspace)
     p = sudoerslval.command.args + arg_len;
     if (addspace)
        *p++ = ' ';
-    if (strlcpy(p, s, arg_size - (p - sudoerslval.command.args)) != len) {
+    if (strlcpy(p, s, arg_size - (p - sudoerslval.command.args)) != (size_t)len) {
        warningx(_("fill_args: buffer overflow"));      /* paranoia */
        sudoerserror(NULL);
        debug_return_bool(false);
index c84dacbf15912c6649b0275ae0f4060150c88a1b..ac5611ffd5d2e2d02ce2cd17077e8d423262c5e8 100644 (file)
@@ -74,8 +74,9 @@ sudo_stat_plugin(struct plugin_info *info, char *fullpath,
        }
        status = stat(fullpath, sb);
     } else {
-       if (snprintf(fullpath, pathsize, "%s%s", _PATH_SUDO_PLUGIN_DIR,
-           info->path) >= pathsize) {
+       int len = snprintf(fullpath, pathsize, "%s%s", _PATH_SUDO_PLUGIN_DIR,
+           info->path);
+       if (len <= 0 || (size_t)len >= pathsize) {
            warningx(_("error in %s, line %d while loading plugin `%s'"),
                _PATH_SUDO_CONF, info->lineno, info->symbol_name);
            warningx(_("%s%s: %s"), _PATH_SUDO_PLUGIN_DIR, info->path,
index a3a36ba207656e5023d46e68c78d42b3b38f9f95..a87cae5966a30559001610a59c71bafb02e4ed05 100644 (file)
@@ -767,7 +767,7 @@ sudo_check_suid(const char *sudo)
                    if ((colon = strchr(cp, ':')))
                        *colon = '\0';
                    len = snprintf(pathbuf, sizeof(pathbuf), "%s/%s", cp, sudo);
-                   if (len <= 0 || len >= sizeof(pathbuf))
+                   if (len <= 0 || (size_t)len >= sizeof(pathbuf))
                        continue;
                    if (access(pathbuf, X_OK) == 0) {
                        sudo = pathbuf;
index 02480ef0a2e5023d0b621c006f838b6a5f6333c7..0e77c644e0c8caa2fb2fdab8d662e9d79f9438ec 100644 (file)
@@ -371,7 +371,7 @@ get_process_ttyname(void)
        rc = sysctl(mib, sudo_kp_namelen, ki_proc, &size, NULL, 0);
     } while (rc == -1 && errno == ENOMEM);
     if (rc != -1) {
-       if (ki_proc->sudo_kp_tdev != (dev_t)-1) {
+       if ((dev_t)ki_proc->sudo_kp_tdev != (dev_t)-1) {
            tty = sudo_ttyname_dev(ki_proc->sudo_kp_tdev);
            if (tty == NULL) {
                sudo_debug_printf(SUDO_DEBUG_WARN,