Quiet sign comparision warnings.
This commit is contained in:
@@ -168,7 +168,8 @@ lock_file(int fd, int lockit)
|
|||||||
ssize_t
|
ssize_t
|
||||||
sudo_parseln(char **bufp, size_t *bufsizep, unsigned int *lineno, FILE *fp)
|
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;
|
char *cp, *line = NULL;
|
||||||
bool continued;
|
bool continued;
|
||||||
debug_decl(sudo_parseln, SUDO_DEBUG_UTIL)
|
debug_decl(sudo_parseln, SUDO_DEBUG_UTIL)
|
||||||
|
@@ -77,7 +77,7 @@ lbuf_destroy(struct lbuf *lbuf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lbuf_expand(struct lbuf *lbuf, size_t extra)
|
lbuf_expand(struct lbuf *lbuf, int extra)
|
||||||
{
|
{
|
||||||
if (lbuf->len + extra + 1 >= lbuf->size) {
|
if (lbuf->len + extra + 1 >= lbuf->size) {
|
||||||
do {
|
do {
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
* Verify that path is the right type and not writable by other users.
|
* Verify that path is the right type and not writable by other users.
|
||||||
*/
|
*/
|
||||||
int
|
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;
|
struct stat sb;
|
||||||
int rval = SUDO_PATH_MISSING;
|
int rval = SUDO_PATH_MISSING;
|
||||||
|
@@ -119,6 +119,7 @@ static int sudo_debug_fd = -1;
|
|||||||
static int sudo_debug_mode;
|
static int sudo_debug_mode;
|
||||||
static char sudo_debug_pidstr[(((sizeof(int) * 8) + 2) / 3) + 3];
|
static char sudo_debug_pidstr[(((sizeof(int) * 8) + 2) / 3) + 3];
|
||||||
static size_t sudo_debug_pidlen;
|
static size_t sudo_debug_pidlen;
|
||||||
|
static const int num_subsystems = NUM_SUBSYSTEMS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse settings string from sudo.conf and open debugfile.
|
* 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;
|
return 1;
|
||||||
|
|
||||||
/* Init per-subsystems settings to -1 since 0 is a valid priority. */
|
/* 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;
|
sudo_debug_settings[i] = -1;
|
||||||
|
|
||||||
/* Open debug file if specified. */
|
/* 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);
|
subsys = SUDO_DEBUG_SUBSYS(level);
|
||||||
|
|
||||||
/* Make sure we want debug info at this 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;
|
buflen = fmt ? vasprintf(&buf, fmt, ap) : 0;
|
||||||
if (buflen != -1) {
|
if (buflen != -1) {
|
||||||
int errcode = ISSET(level, SUDO_DEBUG_ERRNO) ? saved_errno : 0;
|
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);
|
subsys = SUDO_DEBUG_SUBSYS(level);
|
||||||
|
|
||||||
/* Make sure we want debug info at this 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;
|
return;
|
||||||
|
|
||||||
/* Log envp for debug level "debug". */
|
/* Log envp for debug level "debug". */
|
||||||
|
@@ -26,6 +26,6 @@
|
|||||||
|
|
||||||
int sudo_secure_dir(const char *path, uid_t uid, gid_t gid, struct stat *sbp);
|
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_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 */
|
#endif /* _SUDO_SECURE_PATH_H */
|
||||||
|
@@ -105,7 +105,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path,
|
|||||||
* Resolve the path and exit the loop if found.
|
* Resolve the path and exit the loop if found.
|
||||||
*/
|
*/
|
||||||
len = snprintf(command, sizeof(command), "%s/%s", path, infile);
|
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;
|
errno = ENAMETOOLONG;
|
||||||
fatal("%s", infile);
|
fatal("%s", infile);
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path,
|
|||||||
*/
|
*/
|
||||||
if (!found && checkdot) {
|
if (!found && checkdot) {
|
||||||
len = snprintf(command, sizeof(command), "./%s", infile);
|
len = snprintf(command, sizeof(command), "./%s", infile);
|
||||||
if (len <= 0 || len >= sizeof(command)) {
|
if (len <= 0 || (size_t)len >= sizeof(command)) {
|
||||||
errno = ENAMETOOLONG;
|
errno = ENAMETOOLONG;
|
||||||
fatal("%s", infile);
|
fatal("%s", infile);
|
||||||
}
|
}
|
||||||
|
@@ -1049,7 +1049,7 @@ static int yygrowstack()
|
|||||||
#else
|
#else
|
||||||
#define YY_SIZE_MAX 0x7fffffff
|
#define YY_SIZE_MAX 0x7fffffff
|
||||||
#endif
|
#endif
|
||||||
if (YY_SIZE_MAX / newsize < sizeof *newss)
|
if (YY_SIZE_MAX / (unsigned int)newsize < sizeof *newss)
|
||||||
goto bail;
|
goto bail;
|
||||||
i = yyssp - yyss;
|
i = yyssp - yyss;
|
||||||
newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
|
newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
|
||||||
|
@@ -86,7 +86,7 @@ group_plugin_load(char *plugin_info)
|
|||||||
len = snprintf(path, sizeof(path), "%s%s",
|
len = snprintf(path, sizeof(path), "%s%s",
|
||||||
(*plugin_info != '/') ? _PATH_SUDO_PLUGIN_DIR : "", plugin_info);
|
(*plugin_info != '/') ? _PATH_SUDO_PLUGIN_DIR : "", plugin_info);
|
||||||
}
|
}
|
||||||
if (len <= 0 || len >= sizeof(path)) {
|
if (len <= 0 || (size_t)len >= sizeof(path)) {
|
||||||
errno = ENAMETOOLONG;
|
errno = ENAMETOOLONG;
|
||||||
warning("%s%s",
|
warning("%s%s",
|
||||||
(*plugin_info != '/') ? _PATH_SUDO_PLUGIN_DIR : "", plugin_info);
|
(*plugin_info != '/') ? _PATH_SUDO_PLUGIN_DIR : "", plugin_info);
|
||||||
|
@@ -37,7 +37,7 @@ union sudo_in_addr_un {
|
|||||||
*/
|
*/
|
||||||
struct interface {
|
struct interface {
|
||||||
SLIST_ENTRY(interface) entries;
|
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 addr;
|
||||||
union sudo_in_addr_un netmask;
|
union sudo_in_addr_un netmask;
|
||||||
};
|
};
|
||||||
|
@@ -176,7 +176,7 @@ io_nextid(char *iolog_dir, char *iolog_dir_fallback, char sessid[7])
|
|||||||
* Open sequence file
|
* Open sequence file
|
||||||
*/
|
*/
|
||||||
len = snprintf(pathbuf, sizeof(pathbuf), "%s/seq", iolog_dir);
|
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;
|
errno = ENAMETOOLONG;
|
||||||
log_fatal(USE_ERRNO, "%s/seq", pathbuf);
|
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",
|
len = snprintf(fallback, sizeof(fallback), "%s/seq",
|
||||||
iolog_dir_fallback);
|
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);
|
int fd2 = open(fallback, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
|
||||||
if (fd2 != -1) {
|
if (fd2 != -1) {
|
||||||
nread = read(fd2, buf, sizeof(buf));
|
nread = read(fd2, buf, sizeof(buf));
|
||||||
|
@@ -194,7 +194,7 @@ expand_iolog_path(const char *prefix, const char *dir, const char *file,
|
|||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
/* Trim trailing slashes from dir component. */
|
/* Trim trailing slashes from dir component. */
|
||||||
while (dst - path - 1 > prelen && dst[-1] == '/')
|
while (dst > path + prelen + 1 && dst[-1] == '/')
|
||||||
dst--;
|
dst--;
|
||||||
/* The NUL will be replaced with a '/' at the end. */
|
/* The NUL will be replaced with a '/' at the end. */
|
||||||
if (dst + 1 >= pathend)
|
if (dst + 1 >= pathend)
|
||||||
|
@@ -398,10 +398,12 @@ sudo_ldap_conf_add_ports(void)
|
|||||||
|
|
||||||
char *host, *port, defport[13];
|
char *host, *port, defport[13];
|
||||||
char hostbuf[LINE_MAX * 2];
|
char hostbuf[LINE_MAX * 2];
|
||||||
|
int len;
|
||||||
debug_decl(sudo_ldap_conf_add_ports, SUDO_DEBUG_LDAP)
|
debug_decl(sudo_ldap_conf_add_ports, SUDO_DEBUG_LDAP)
|
||||||
|
|
||||||
hostbuf[0] = '\0';
|
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"));
|
fatalx(_("sudo_ldap_conf_add_ports: port too large"));
|
||||||
|
|
||||||
for ((host = strtok(ldap_conf.host, " \t")); host; (host = strtok(NULL, " \t"))) {
|
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. */
|
/* Build filter. */
|
||||||
bytes = snprintf(buffer, buffersize, "(&(|(!(sudoNotAfter=*))(sudoNotAfter>=%s))(|(!(sudoNotBefore=*))(sudoNotBefore<=%s)))",
|
bytes = snprintf(buffer, buffersize, "(&(|(!(sudoNotAfter=*))(sudoNotAfter>=%s))(|(!(sudoNotBefore=*))(sudoNotBefore<=%s)))",
|
||||||
timebuffer, timebuffer);
|
timebuffer, timebuffer);
|
||||||
if (bytes < 0 || bytes >= buffersize) {
|
if (bytes <= 0 || (size_t)bytes >= buffersize) {
|
||||||
warning(_("unable to build time filter"));
|
warning(_("unable to build time filter"));
|
||||||
bytes = 0;
|
bytes = 0;
|
||||||
}
|
}
|
||||||
|
@@ -198,7 +198,7 @@ do_logfile(char *msg)
|
|||||||
def_logfile, strerror(errno));
|
def_logfile, strerror(errno));
|
||||||
} else {
|
} else {
|
||||||
time(&now);
|
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) */
|
/* Don't pretty-print long log file lines (hard to grep) */
|
||||||
if (def_log_host) {
|
if (def_log_host) {
|
||||||
(void) fprintf(fp, "%s : %s : HOST=%s : %s\n",
|
(void) fprintf(fp, "%s : %s : HOST=%s : %s\n",
|
||||||
|
@@ -55,9 +55,9 @@ addr_matches_if(char *n)
|
|||||||
union sudo_in_addr_un addr;
|
union sudo_in_addr_un addr;
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
#ifdef HAVE_STRUCT_IN6_ADDR
|
#ifdef HAVE_STRUCT_IN6_ADDR
|
||||||
int j;
|
unsigned int j;
|
||||||
#endif
|
#endif
|
||||||
int family;
|
unsigned int family;
|
||||||
debug_decl(addr_matches_if, SUDO_DEBUG_MATCH)
|
debug_decl(addr_matches_if, SUDO_DEBUG_MATCH)
|
||||||
|
|
||||||
#ifdef HAVE_STRUCT_IN6_ADDR
|
#ifdef HAVE_STRUCT_IN6_ADDR
|
||||||
@@ -102,13 +102,13 @@ addr_matches_if(char *n)
|
|||||||
static bool
|
static bool
|
||||||
addr_matches_if_netmask(char *n, char *m)
|
addr_matches_if_netmask(char *n, char *m)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
union sudo_in_addr_un addr, mask;
|
union sudo_in_addr_un addr, mask;
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
#ifdef HAVE_STRUCT_IN6_ADDR
|
#ifdef HAVE_STRUCT_IN6_ADDR
|
||||||
int j;
|
unsigned int j;
|
||||||
#endif
|
#endif
|
||||||
int family;
|
unsigned int family;
|
||||||
debug_decl(addr_matches_if, SUDO_DEBUG_MATCH)
|
debug_decl(addr_matches_if, SUDO_DEBUG_MATCH)
|
||||||
|
|
||||||
#ifdef HAVE_STRUCT_IN6_ADDR
|
#ifdef HAVE_STRUCT_IN6_ADDR
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
#define SUDO_DIGEST_INVALID 4
|
#define SUDO_DIGEST_INVALID 4
|
||||||
|
|
||||||
struct sudo_digest {
|
struct sudo_digest {
|
||||||
int digest_type;
|
unsigned int digest_type;
|
||||||
char *digest_str;
|
char *digest_str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -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 :
|
egid = runas_gr ? (unsigned int)runas_gr->gr_gid :
|
||||||
(unsigned int)runas_pw->pw_gid;
|
(unsigned int)runas_pw->pw_gid;
|
||||||
len = snprintf(cp, glsize - (cp - gid_list), "%u", egid);
|
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");
|
fatalx(_("internal error, %s overflow"), "runas_groups");
|
||||||
cp += len;
|
cp += len;
|
||||||
for (i = 0; i < grlist->ngids; i++) {
|
for (i = 0; i < grlist->ngids; i++) {
|
||||||
if (grlist->gids[i] != egid) {
|
if (grlist->gids[i] != egid) {
|
||||||
len = snprintf(cp, glsize - (cp - gid_list), ",%u",
|
len = snprintf(cp, glsize - (cp - gid_list), ",%u",
|
||||||
(unsigned int) grlist->gids[i]);
|
(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");
|
fatalx(_("internal error, %s overflow"), "runas_groups");
|
||||||
cp += len;
|
cp += len;
|
||||||
}
|
}
|
||||||
|
@@ -110,14 +110,14 @@ expand_prompt(const char *old_prompt, const char *user, const char *host)
|
|||||||
case 'h':
|
case 'h':
|
||||||
p++;
|
p++;
|
||||||
n = strlcpy(np, user_shost, np - endp);
|
n = strlcpy(np, user_shost, np - endp);
|
||||||
if (n >= np - endp)
|
if (n >= (size_t)(np - endp))
|
||||||
goto oflow;
|
goto oflow;
|
||||||
np += n;
|
np += n;
|
||||||
continue;
|
continue;
|
||||||
case 'H':
|
case 'H':
|
||||||
p++;
|
p++;
|
||||||
n = strlcpy(np, user_host, np - endp);
|
n = strlcpy(np, user_host, np - endp);
|
||||||
if (n >= np - endp)
|
if (n >= (size_t)(np - endp))
|
||||||
goto oflow;
|
goto oflow;
|
||||||
np += n;
|
np += n;
|
||||||
continue;
|
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);
|
n = strlcpy(np, runas_pw->pw_name, np - endp);
|
||||||
else
|
else
|
||||||
n = strlcpy(np, user_name, np - endp);
|
n = strlcpy(np, user_name, np - endp);
|
||||||
if (n >= np - endp)
|
if (n >= (size_t)(np - endp))
|
||||||
goto oflow;
|
goto oflow;
|
||||||
np += n;
|
np += n;
|
||||||
continue;
|
continue;
|
||||||
case 'u':
|
case 'u':
|
||||||
p++;
|
p++;
|
||||||
n = strlcpy(np, user_name, np - endp);
|
n = strlcpy(np, user_name, np - endp);
|
||||||
if (n >= np - endp)
|
if (n >= (size_t)(np - endp))
|
||||||
goto oflow;
|
goto oflow;
|
||||||
np += n;
|
np += n;
|
||||||
continue;
|
continue;
|
||||||
case 'U':
|
case 'U':
|
||||||
p++;
|
p++;
|
||||||
n = strlcpy(np, runas_pw->pw_name, np - endp);
|
n = strlcpy(np, runas_pw->pw_name, np - endp);
|
||||||
if (n >= np - endp)
|
if (n >= (size_t)(np - endp))
|
||||||
goto oflow;
|
goto oflow;
|
||||||
np += n;
|
np += n;
|
||||||
continue;
|
continue;
|
||||||
|
@@ -229,12 +229,12 @@ sudo_make_grlist_item(struct passwd *pw, char * const *unused1,
|
|||||||
char * const *unused2)
|
char * const *unused2)
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
size_t i, nsize, ngroups, total, len;
|
size_t nsize, ngroups, total, len;
|
||||||
struct cache_item_grlist *grlitem;
|
struct cache_item_grlist *grlitem;
|
||||||
struct group_list *grlist;
|
struct group_list *grlist;
|
||||||
GETGROUPS_T *gids;
|
GETGROUPS_T *gids;
|
||||||
struct group *grp;
|
struct group *grp;
|
||||||
int ngids, groupname_len;
|
int i, ngids, groupname_len;
|
||||||
debug_decl(sudo_make_grlist_item, SUDO_DEBUG_NSS)
|
debug_decl(sudo_make_grlist_item, SUDO_DEBUG_NSS)
|
||||||
|
|
||||||
if (pw == sudo_user.pw && sudo_user.gids != NULL) {
|
if (pw == sudo_user.pw && sudo_user.gids != NULL) {
|
||||||
|
@@ -79,9 +79,9 @@ static struct perm_state perm_stack[PERM_STACK_MAX];
|
|||||||
static int perm_stack_depth = 0;
|
static int perm_stack_depth = 0;
|
||||||
|
|
||||||
#undef ID
|
#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
|
#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
|
void
|
||||||
rewind_perms(void)
|
rewind_perms(void)
|
||||||
|
@@ -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 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 struct log_info *parse_logfile(char *logfile);
|
||||||
static void free_log_info(struct log_info *li);
|
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_handler(int);
|
||||||
static void sudoreplay_cleanup(void);
|
static void sudoreplay_cleanup(void);
|
||||||
|
|
||||||
@@ -327,13 +327,13 @@ main(int argc, char *argv[])
|
|||||||
if (VALID_ID(id)) {
|
if (VALID_ID(id)) {
|
||||||
plen = snprintf(path, sizeof(path), "%s/%.2s/%.2s/%.2s/timing",
|
plen = snprintf(path, sizeof(path), "%s/%.2s/%.2s/%.2s/timing",
|
||||||
session_dir, id, &id[2], &id[4]);
|
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,
|
fatalx(_("%s/%.2s/%.2s/%.2s/timing: %s"), session_dir,
|
||||||
id, &id[2], &id[4], strerror(ENAMETOOLONG));
|
id, &id[2], &id[4], strerror(ENAMETOOLONG));
|
||||||
} else {
|
} else {
|
||||||
plen = snprintf(path, sizeof(path), "%s/%s/timing",
|
plen = snprintf(path, sizeof(path), "%s/%s/timing",
|
||||||
session_dir, id);
|
session_dir, id);
|
||||||
if (plen <= 0 || plen >= sizeof(path))
|
if (plen <= 0 || (size_t)plen >= sizeof(path))
|
||||||
fatalx(_("%s/%s/timing: %s"), session_dir,
|
fatalx(_("%s/%s/timing: %s"), session_dir,
|
||||||
id, strerror(ENAMETOOLONG));
|
id, strerror(ENAMETOOLONG));
|
||||||
}
|
}
|
||||||
@@ -469,7 +469,7 @@ main(int argc, char *argv[])
|
|||||||
cp = ep + 1;
|
cp = ep + 1;
|
||||||
remainder -= linelen;
|
remainder -= linelen;
|
||||||
}
|
}
|
||||||
if (cp - buf != nread) {
|
if ((size_t)(cp - buf) != nread) {
|
||||||
/*
|
/*
|
||||||
* Partial line without a linefeed or multiple lines
|
* Partial line without a linefeed or multiple lines
|
||||||
* with \r\n pairs.
|
* 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
|
* Call writev(), restarting as needed and handling EAGAIN since
|
||||||
* fd may be in non-blocking mode.
|
* fd may be in non-blocking mode.
|
||||||
*/
|
*/
|
||||||
static size_t
|
static ssize_t
|
||||||
atomic_writev(int fd, struct iovec *iov, int iovcnt)
|
atomic_writev(int fd, struct iovec *iov, int iovcnt)
|
||||||
{
|
{
|
||||||
ssize_t n, nwritten = 0;
|
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 dirent *dp;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
size_t sdlen, sessions_len = 0, sessions_size = 36*36;
|
size_t sdlen, sessions_len = 0, sessions_size = 36*36;
|
||||||
int i, len;
|
unsigned int i;
|
||||||
|
int len;
|
||||||
char pathbuf[PATH_MAX], **sessions = NULL;
|
char pathbuf[PATH_MAX], **sessions = NULL;
|
||||||
#ifdef HAVE_STRUCT_DIRENT_D_TYPE
|
#ifdef HAVE_STRUCT_DIRENT_D_TYPE
|
||||||
bool checked_type = true;
|
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++) {
|
for (i = 0; i < sessions_len; i++) {
|
||||||
len = snprintf(&pathbuf[sdlen], sizeof(pathbuf) - sdlen,
|
len = snprintf(&pathbuf[sdlen], sizeof(pathbuf) - sdlen,
|
||||||
"%s/log", sessions[i]);
|
"%s/log", sessions[i]);
|
||||||
if (len <= 0 || len >= sizeof(pathbuf) - sdlen) {
|
if (len <= 0 || (size_t)len >= sizeof(pathbuf) - sdlen) {
|
||||||
errno = ENAMETOOLONG;
|
errno = ENAMETOOLONG;
|
||||||
fatal("%s/%s/log", dir, sessions[i]);
|
fatal("%s/%s/log", dir, sessions[i]);
|
||||||
}
|
}
|
||||||
|
@@ -88,7 +88,7 @@ build_timestamp(struct passwd *pw)
|
|||||||
timestampfile[0] = '\0';
|
timestampfile[0] = '\0';
|
||||||
len = snprintf(timestampdir, sizeof(timestampdir), "%s/%s", dirparent,
|
len = snprintf(timestampdir, sizeof(timestampdir), "%s/%s", dirparent,
|
||||||
user_name);
|
user_name);
|
||||||
if (len <= 0 || len >= sizeof(timestampdir))
|
if (len <= 0 || (size_t)len >= sizeof(timestampdir))
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -103,7 +103,7 @@ build_timestamp(struct passwd *pw)
|
|||||||
/* No tty, use parent pid. */
|
/* No tty, use parent pid. */
|
||||||
len = snprintf(pidbuf, sizeof(pidbuf), "pid%u",
|
len = snprintf(pidbuf, sizeof(pidbuf), "pid%u",
|
||||||
(unsigned int)getppid());
|
(unsigned int)getppid());
|
||||||
if (len <= 0 || len >= sizeof(pidbuf))
|
if (len <= 0 || (size_t)len >= sizeof(pidbuf))
|
||||||
goto bad;
|
goto bad;
|
||||||
p = pidbuf;
|
p = pidbuf;
|
||||||
} else if ((p = strrchr(user_tty, '/'))) {
|
} else if ((p = strrchr(user_tty, '/'))) {
|
||||||
@@ -118,12 +118,12 @@ build_timestamp(struct passwd *pw)
|
|||||||
len = snprintf(timestampfile, sizeof(timestampfile), "%s/%s/%s",
|
len = snprintf(timestampfile, sizeof(timestampfile), "%s/%s/%s",
|
||||||
dirparent, user_name, p);
|
dirparent, user_name, p);
|
||||||
}
|
}
|
||||||
if (len <= 0 || len >= sizeof(timestampfile))
|
if (len <= 0 || (size_t)len >= sizeof(timestampfile))
|
||||||
goto bad;
|
goto bad;
|
||||||
} else if (def_targetpw) {
|
} else if (def_targetpw) {
|
||||||
len = snprintf(timestampfile, sizeof(timestampfile), "%s/%s/%s",
|
len = snprintf(timestampfile, sizeof(timestampfile), "%s/%s/%s",
|
||||||
dirparent, user_name, runas_pw->pw_name);
|
dirparent, user_name, runas_pw->pw_name);
|
||||||
if (len <= 0 || len >= sizeof(timestampfile))
|
if (len <= 0 || (size_t)len >= sizeof(timestampfile))
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
sudo_debug_printf(SUDO_DEBUG_INFO, "using timestamp file %s", timestampfile);
|
sudo_debug_printf(SUDO_DEBUG_INFO, "using timestamp file %s", timestampfile);
|
||||||
|
@@ -2500,7 +2500,7 @@ YY_RULE_SETUP
|
|||||||
#line 289 "toke.l"
|
#line 289 "toke.l"
|
||||||
{
|
{
|
||||||
/* Only return DIGEST if the length is correct. */
|
/* Only return DIGEST if the length is correct. */
|
||||||
size_t len;
|
int len;
|
||||||
if (sudoerstext[sudoersleng - 1] == '=') {
|
if (sudoerstext[sudoersleng - 1] == '=') {
|
||||||
/* use padding */
|
/* use padding */
|
||||||
len = 4 * ((digest_len + 2) / 3);
|
len = 4 * ((digest_len + 2) / 3);
|
||||||
|
@@ -288,7 +288,7 @@ DEFVAR [a-z_]+
|
|||||||
|
|
||||||
<WANTDIGEST>[A-Za-z0-9\+/=]+ {
|
<WANTDIGEST>[A-Za-z0-9\+/=]+ {
|
||||||
/* Only return DIGEST if the length is correct. */
|
/* Only return DIGEST if the length is correct. */
|
||||||
size_t len;
|
int len;
|
||||||
if (sudoerstext[sudoersleng - 1] == '=') {
|
if (sudoerstext[sudoersleng - 1] == '=') {
|
||||||
/* use padding */
|
/* use padding */
|
||||||
len = 4 * ((digest_len + 2) / 3);
|
len = 4 * ((digest_len + 2) / 3);
|
||||||
|
@@ -172,7 +172,7 @@ fill_args(const char *s, int len, int addspace)
|
|||||||
p = sudoerslval.command.args + arg_len;
|
p = sudoerslval.command.args + arg_len;
|
||||||
if (addspace)
|
if (addspace)
|
||||||
*p++ = ' ';
|
*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 */
|
warningx(_("fill_args: buffer overflow")); /* paranoia */
|
||||||
sudoerserror(NULL);
|
sudoerserror(NULL);
|
||||||
debug_return_bool(false);
|
debug_return_bool(false);
|
||||||
|
@@ -74,8 +74,9 @@ sudo_stat_plugin(struct plugin_info *info, char *fullpath,
|
|||||||
}
|
}
|
||||||
status = stat(fullpath, sb);
|
status = stat(fullpath, sb);
|
||||||
} else {
|
} else {
|
||||||
if (snprintf(fullpath, pathsize, "%s%s", _PATH_SUDO_PLUGIN_DIR,
|
int len = snprintf(fullpath, pathsize, "%s%s", _PATH_SUDO_PLUGIN_DIR,
|
||||||
info->path) >= pathsize) {
|
info->path);
|
||||||
|
if (len <= 0 || (size_t)len >= pathsize) {
|
||||||
warningx(_("error in %s, line %d while loading plugin `%s'"),
|
warningx(_("error in %s, line %d while loading plugin `%s'"),
|
||||||
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
_PATH_SUDO_CONF, info->lineno, info->symbol_name);
|
||||||
warningx(_("%s%s: %s"), _PATH_SUDO_PLUGIN_DIR, info->path,
|
warningx(_("%s%s: %s"), _PATH_SUDO_PLUGIN_DIR, info->path,
|
||||||
|
@@ -767,7 +767,7 @@ sudo_check_suid(const char *sudo)
|
|||||||
if ((colon = strchr(cp, ':')))
|
if ((colon = strchr(cp, ':')))
|
||||||
*colon = '\0';
|
*colon = '\0';
|
||||||
len = snprintf(pathbuf, sizeof(pathbuf), "%s/%s", cp, sudo);
|
len = snprintf(pathbuf, sizeof(pathbuf), "%s/%s", cp, sudo);
|
||||||
if (len <= 0 || len >= sizeof(pathbuf))
|
if (len <= 0 || (size_t)len >= sizeof(pathbuf))
|
||||||
continue;
|
continue;
|
||||||
if (access(pathbuf, X_OK) == 0) {
|
if (access(pathbuf, X_OK) == 0) {
|
||||||
sudo = pathbuf;
|
sudo = pathbuf;
|
||||||
|
@@ -371,7 +371,7 @@ get_process_ttyname(void)
|
|||||||
rc = sysctl(mib, sudo_kp_namelen, ki_proc, &size, NULL, 0);
|
rc = sysctl(mib, sudo_kp_namelen, ki_proc, &size, NULL, 0);
|
||||||
} while (rc == -1 && errno == ENOMEM);
|
} while (rc == -1 && errno == ENOMEM);
|
||||||
if (rc != -1) {
|
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);
|
tty = sudo_ttyname_dev(ki_proc->sudo_kp_tdev);
|
||||||
if (tty == NULL) {
|
if (tty == NULL) {
|
||||||
sudo_debug_printf(SUDO_DEBUG_WARN,
|
sudo_debug_printf(SUDO_DEBUG_WARN,
|
||||||
|
Reference in New Issue
Block a user