project
stringclasses 633
values | commit_id
stringlengths 7
81
| target
int64 0
1
| func
stringlengths 5
484k
| cwe
stringclasses 131
values | big_vul_idx
float64 0
189k
⌀ | idx
int64 0
522k
| hash
stringlengths 34
39
| size
float64 1
24k
⌀ | message
stringlengths 0
11.5k
⌀ | dataset
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_is_errno_eagain_or_ewouldblock (void)
{
return errno == EAGAIN || errno == EWOULDBLOCK;
}
|
CWE-20
| 3,740 | 13,664 |
99177288238997346764846498967010140417
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_monotonic_time (long *tv_sec,
long *tv_usec)
{
#ifdef HAVE_MONOTONIC_CLOCK
struct timespec ts;
clock_gettime (CLOCK_MONOTONIC, &ts);
if (tv_sec)
*tv_sec = ts.tv_sec;
if (tv_usec)
*tv_usec = ts.tv_nsec / 1000;
#else
struct timeval t;
gettimeofday (&t, NULL);
if (tv_sec)
*tv_sec = t.tv_sec;
if (tv_usec)
*tv_usec = t.tv_usec;
#endif
}
|
CWE-20
| 3,741 | 13,665 |
210687883572513285192459964291786858152
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_real_time (long *tv_sec,
long *tv_usec)
{
struct timeval t;
gettimeofday (&t, NULL);
if (tv_sec)
*tv_sec = t.tv_sec;
if (tv_usec)
*tv_usec = t.tv_usec;
}
|
CWE-20
| 3,742 | 13,666 |
249225560796788918236825401057254399059
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_standard_system_servicedirs (DBusList **dirs)
{
/*
* DBUS_DATADIR may be the same as one of the standard directories. However,
* the config parser should take care of the duplicates.
*
* Also, append /lib as counterpart of /usr/share on the root
* directory (the root directory does not know /share), in order to
* facilitate early boot system bus activation where /usr might not
* be available.
*/
static const char standard_search_path[] =
"/usr/local/share:"
"/usr/share:"
DBUS_DATADIR ":"
"/lib";
DBusString servicedir_path;
_dbus_string_init_const (&servicedir_path, standard_search_path);
return _dbus_split_paths_and_append (&servicedir_path,
DBUS_UNIX_STANDARD_SYSTEM_SERVICEDIR,
dirs);
}
|
CWE-20
| 3,743 | 13,667 |
54952413556491032608452299376121529268
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_geteuid (void)
{
return geteuid ();
}
|
CWE-20
| 3,744 | 13,668 |
228074007883998099889934886335470504352
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_getuid (void)
{
return getuid ();
}
|
CWE-20
| 3,745 | 13,669 |
195402933171088084561918383050573137348
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_listen_systemd_sockets (int **fds,
DBusError *error)
{
int r, n;
unsigned fd;
int *new_fds;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
n = sd_listen_fds (TRUE);
if (n < 0)
{
dbus_set_error (error, _dbus_error_from_errno (-n),
"Failed to acquire systemd socket: %s",
_dbus_strerror (-n));
return -1;
}
if (n <= 0)
{
dbus_set_error (error, DBUS_ERROR_BAD_ADDRESS,
"No socket received.");
return -1;
}
for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd ++)
{
r = sd_is_socket (fd, AF_UNSPEC, SOCK_STREAM, 1);
if (r < 0)
{
dbus_set_error (error, _dbus_error_from_errno (-r),
"Failed to verify systemd socket type: %s",
_dbus_strerror (-r));
return -1;
}
if (!r)
{
dbus_set_error (error, DBUS_ERROR_BAD_ADDRESS,
"Passed socket has wrong type.");
return -1;
}
}
/* OK, the file descriptors are all good, so let's take posession of
them then. */
new_fds = dbus_new (int, n);
if (!new_fds)
{
dbus_set_error (error, DBUS_ERROR_NO_MEMORY,
"Failed to allocate file handle array.");
goto fail;
}
for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd ++)
{
if (!_dbus_set_local_creds (fd, TRUE))
{
dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to enable LOCAL_CREDS on systemd socket: %s",
_dbus_strerror (errno));
goto fail;
}
if (!_dbus_set_fd_nonblocking (fd, error))
{
_DBUS_ASSERT_ERROR_IS_SET (error);
goto fail;
}
new_fds[fd - SD_LISTEN_FDS_START] = fd;
}
*fds = new_fds;
return n;
fail:
for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd ++)
{
_dbus_close (fd, NULL);
}
dbus_free (new_fds);
return -1;
}
|
CWE-20
| 3,746 | 13,670 |
206847839605747660015792342344487671313
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_listen_tcp_socket (const char *host,
const char *port,
const char *family,
DBusString *retport,
int **fds_p,
DBusError *error)
{
int saved_errno;
int nlisten_fd = 0, *listen_fd = NULL, res, i;
struct addrinfo hints;
struct addrinfo *ai, *tmp;
unsigned int reuseaddr;
*fds_p = NULL;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
_DBUS_ZERO (hints);
if (!family)
hints.ai_family = AF_UNSPEC;
else if (!strcmp(family, "ipv4"))
hints.ai_family = AF_INET;
else if (!strcmp(family, "ipv6"))
hints.ai_family = AF_INET6;
else
{
dbus_set_error (error,
DBUS_ERROR_BAD_ADDRESS,
"Unknown address family %s", family);
return -1;
}
hints.ai_protocol = IPPROTO_TCP;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_ADDRCONFIG | AI_PASSIVE;
redo_lookup_with_port:
ai = NULL;
if ((res = getaddrinfo(host, port, &hints, &ai)) != 0 || !ai)
{
dbus_set_error (error,
_dbus_error_from_errno (errno),
"Failed to lookup host/port: \"%s:%s\": %s (%d)",
host ? host : "*", port, gai_strerror(res), res);
goto failed;
}
tmp = ai;
while (tmp)
{
int fd = -1, *newlisten_fd;
if (!_dbus_open_socket (&fd, tmp->ai_family, SOCK_STREAM, 0, error))
{
_DBUS_ASSERT_ERROR_IS_SET(error);
goto failed;
}
_DBUS_ASSERT_ERROR_IS_CLEAR(error);
reuseaddr = 1;
if (setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(reuseaddr))==-1)
{
_dbus_warn ("Failed to set socket option \"%s:%s\": %s",
host ? host : "*", port, _dbus_strerror (errno));
}
if (bind (fd, (struct sockaddr*) tmp->ai_addr, tmp->ai_addrlen) < 0)
{
saved_errno = errno;
_dbus_close(fd, NULL);
if (saved_errno == EADDRINUSE)
{
/* Depending on kernel policy, it may or may not
be neccessary to bind to both IPv4 & 6 addresses
so ignore EADDRINUSE here */
tmp = tmp->ai_next;
continue;
}
dbus_set_error (error, _dbus_error_from_errno (saved_errno),
"Failed to bind socket \"%s:%s\": %s",
host ? host : "*", port, _dbus_strerror (saved_errno));
goto failed;
}
if (listen (fd, 30 /* backlog */) < 0)
{
saved_errno = errno;
_dbus_close (fd, NULL);
dbus_set_error (error, _dbus_error_from_errno (saved_errno),
"Failed to listen on socket \"%s:%s\": %s",
host ? host : "*", port, _dbus_strerror (saved_errno));
goto failed;
}
newlisten_fd = dbus_realloc(listen_fd, sizeof(int)*(nlisten_fd+1));
if (!newlisten_fd)
{
saved_errno = errno;
_dbus_close (fd, NULL);
dbus_set_error (error, _dbus_error_from_errno (saved_errno),
"Failed to allocate file handle array: %s",
_dbus_strerror (saved_errno));
goto failed;
}
listen_fd = newlisten_fd;
listen_fd[nlisten_fd] = fd;
nlisten_fd++;
if (!_dbus_string_get_length(retport))
{
/* If the user didn't specify a port, or used 0, then
the kernel chooses a port. After the first address
is bound to, we need to force all remaining addresses
to use the same port */
if (!port || !strcmp(port, "0"))
{
int result;
struct sockaddr_storage addr;
socklen_t addrlen;
char portbuf[50];
addrlen = sizeof(addr);
result = getsockname(fd, (struct sockaddr*) &addr, &addrlen);
if (result == -1 ||
(res = getnameinfo ((struct sockaddr*)&addr, addrlen, NULL, 0,
portbuf, sizeof(portbuf),
NI_NUMERICHOST)) != 0)
{
dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to resolve port \"%s:%s\": %s (%s)",
host ? host : "*", port, gai_strerror(res), res);
goto failed;
}
if (!_dbus_string_append(retport, portbuf))
{
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
goto failed;
}
/* Release current address list & redo lookup */
port = _dbus_string_get_const_data(retport);
freeaddrinfo(ai);
goto redo_lookup_with_port;
}
else
{
if (!_dbus_string_append(retport, port))
{
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
goto failed;
}
}
}
tmp = tmp->ai_next;
}
freeaddrinfo(ai);
ai = NULL;
if (!nlisten_fd)
{
errno = EADDRINUSE;
dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to bind socket \"%s:%s\": %s",
host ? host : "*", port, _dbus_strerror (errno));
goto failed;
}
for (i = 0 ; i < nlisten_fd ; i++)
{
if (!_dbus_set_fd_nonblocking (listen_fd[i], error))
{
goto failed;
}
}
*fds_p = listen_fd;
return nlisten_fd;
failed:
if (ai)
freeaddrinfo(ai);
for (i = 0 ; i < nlisten_fd ; i++)
_dbus_close(listen_fd[i], NULL);
dbus_free(listen_fd);
return -1;
}
|
CWE-20
| 3,747 | 13,671 |
85303063791985373880550785457834643366
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_listen_unix_socket (const char *path,
dbus_bool_t abstract,
DBusError *error)
{
int listen_fd;
struct sockaddr_un addr;
size_t path_len;
unsigned int reuseaddr;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
_dbus_verbose ("listening on unix socket %s abstract=%d\n",
path, abstract);
if (!_dbus_open_unix_socket (&listen_fd, error))
{
_DBUS_ASSERT_ERROR_IS_SET(error);
return -1;
}
_DBUS_ASSERT_ERROR_IS_CLEAR(error);
_DBUS_ZERO (addr);
addr.sun_family = AF_UNIX;
path_len = strlen (path);
if (abstract)
{
#ifdef HAVE_ABSTRACT_SOCKETS
/* remember that abstract names aren't nul-terminated so we rely
* on sun_path being filled in with zeroes above.
*/
addr.sun_path[0] = '\0'; /* this is what says "use abstract" */
path_len++; /* Account for the extra nul byte added to the start of sun_path */
if (path_len > _DBUS_MAX_SUN_PATH_LENGTH)
{
dbus_set_error (error, DBUS_ERROR_BAD_ADDRESS,
"Abstract socket name too long\n");
_dbus_close (listen_fd, NULL);
return -1;
}
strncpy (&addr.sun_path[1], path, path_len);
/* _dbus_verbose_bytes (addr.sun_path, sizeof (addr.sun_path)); */
#else /* HAVE_ABSTRACT_SOCKETS */
dbus_set_error (error, DBUS_ERROR_NOT_SUPPORTED,
"Operating system does not support abstract socket namespace\n");
_dbus_close (listen_fd, NULL);
return -1;
#endif /* ! HAVE_ABSTRACT_SOCKETS */
}
else
{
/* Discussed security implications of this with Nalin,
* and we couldn't think of where it would kick our ass, but
* it still seems a bit sucky. It also has non-security suckage;
* really we'd prefer to exit if the socket is already in use.
* But there doesn't seem to be a good way to do this.
*
* Just to be extra careful, I threw in the stat() - clearly
* the stat() can't *fix* any security issue, but it at least
* avoids inadvertent/accidental data loss.
*/
{
struct stat sb;
if (stat (path, &sb) == 0 &&
S_ISSOCK (sb.st_mode))
unlink (path);
}
if (path_len > _DBUS_MAX_SUN_PATH_LENGTH)
{
dbus_set_error (error, DBUS_ERROR_BAD_ADDRESS,
"Abstract socket name too long\n");
_dbus_close (listen_fd, NULL);
return -1;
}
strncpy (addr.sun_path, path, path_len);
}
reuseaddr = 1;
if (setsockopt (listen_fd, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(reuseaddr))==-1)
{
_dbus_warn ("Failed to set socket option\"%s\": %s",
path, _dbus_strerror (errno));
}
if (bind (listen_fd, (struct sockaddr*) &addr, _DBUS_STRUCT_OFFSET (struct sockaddr_un, sun_path) + path_len) < 0)
{
dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to bind socket \"%s\": %s",
path, _dbus_strerror (errno));
_dbus_close (listen_fd, NULL);
return -1;
}
if (listen (listen_fd, 30 /* backlog */) < 0)
{
dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to listen on socket \"%s\": %s",
path, _dbus_strerror (errno));
_dbus_close (listen_fd, NULL);
return -1;
}
if (!_dbus_set_local_creds (listen_fd, TRUE))
{
dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to enable LOCAL_CREDS on socket \"%s\": %s",
path, _dbus_strerror (errno));
close (listen_fd);
return -1;
}
if (!_dbus_set_fd_nonblocking (listen_fd, error))
{
_DBUS_ASSERT_ERROR_IS_SET (error);
_dbus_close (listen_fd, NULL);
return -1;
}
/* Try opening up the permissions, but if we can't, just go ahead
* and continue, maybe it will be good enough.
*/
if (!abstract && chmod (path, 0777) < 0)
_dbus_warn ("Could not set mode 0777 on socket %s\n",
path);
return listen_fd;
}
|
CWE-20
| 3,748 | 13,672 |
187931840747196978590593478051346810034
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_lookup_launchd_socket (DBusString *socket_path,
const char *launchd_env_var,
DBusError *error)
{
#ifdef DBUS_ENABLE_LAUNCHD
char *argv[4];
int i;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
if (_dbus_check_setuid ())
{
dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED,
"Unable to find launchd socket when setuid");
return FALSE;
}
i = 0;
argv[i] = "launchctl";
++i;
argv[i] = "getenv";
++i;
argv[i] = (char*)launchd_env_var;
++i;
argv[i] = NULL;
++i;
_dbus_assert (i == _DBUS_N_ELEMENTS (argv));
if (!_read_subprocess_line_argv(argv[0], TRUE, argv, socket_path, error))
{
return FALSE;
}
/* no error, but no result either */
if (_dbus_string_get_length(socket_path) == 0)
{
return FALSE;
}
/* strip the carriage-return */
_dbus_string_shorten(socket_path, 1);
return TRUE;
#else /* DBUS_ENABLE_LAUNCHD */
dbus_set_error(error, DBUS_ERROR_NOT_SUPPORTED,
"can't lookup socket from launchd; launchd support not compiled in");
return FALSE;
#endif
}
|
CWE-20
| 3,749 | 13,673 |
208959378221917067924262558711675211852
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_lookup_session_address (dbus_bool_t *supported,
DBusString *address,
DBusError *error)
{
#ifdef DBUS_ENABLE_LAUNCHD
*supported = TRUE;
return _dbus_lookup_session_address_launchd (address, error);
#else
/* On non-Mac Unix platforms, if the session address isn't already
* set in DBUS_SESSION_BUS_ADDRESS environment variable, we punt and
* fall back to the autolaunch: global default; see
* init_session_address in dbus/dbus-bus.c. */
*supported = FALSE;
return TRUE;
#endif
}
|
CWE-20
| 3,750 | 13,674 |
94583722377183082589737486669623207665
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_lookup_session_address_launchd (DBusString *address, DBusError *error)
{
dbus_bool_t valid_socket;
DBusString socket_path;
if (_dbus_check_setuid ())
{
dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED,
"Unable to find launchd socket when setuid");
return FALSE;
}
if (!_dbus_string_init (&socket_path))
{
_DBUS_SET_OOM (error);
return FALSE;
}
valid_socket = _dbus_lookup_launchd_socket (&socket_path, "DBUS_LAUNCHD_SESSION_BUS_SOCKET", error);
if (dbus_error_is_set(error))
{
_dbus_string_free(&socket_path);
return FALSE;
}
if (!valid_socket)
{
dbus_set_error(error, "no socket path",
"launchd did not provide a socket path, "
"verify that org.freedesktop.dbus-session.plist is loaded!");
_dbus_string_free(&socket_path);
return FALSE;
}
if (!_dbus_string_append (address, "unix:path="))
{
_DBUS_SET_OOM (error);
_dbus_string_free(&socket_path);
return FALSE;
}
if (!_dbus_string_copy (&socket_path, 0, address,
_dbus_string_get_length (address)))
{
_DBUS_SET_OOM (error);
_dbus_string_free(&socket_path);
return FALSE;
}
_dbus_string_free(&socket_path);
return TRUE;
}
|
CWE-20
| 3,751 | 13,675 |
329457787448720834120796300457073592501
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_open_socket (int *fd_p,
int domain,
int type,
int protocol,
DBusError *error)
{
#ifdef SOCK_CLOEXEC
dbus_bool_t cloexec_done;
*fd_p = socket (domain, type | SOCK_CLOEXEC, protocol);
cloexec_done = *fd_p >= 0;
/* Check if kernel seems to be too old to know SOCK_CLOEXEC */
if (*fd_p < 0 && errno == EINVAL)
#endif
{
*fd_p = socket (domain, type, protocol);
}
if (*fd_p >= 0)
{
#ifdef SOCK_CLOEXEC
if (!cloexec_done)
#endif
{
_dbus_fd_set_close_on_exec(*fd_p);
}
_dbus_verbose ("socket fd %d opened\n", *fd_p);
return TRUE;
}
else
{
dbus_set_error(error,
_dbus_error_from_errno (errno),
"Failed to open socket: %s",
_dbus_strerror (errno));
return FALSE;
}
}
|
CWE-20
| 3,752 | 13,676 |
254303442158649872955541138241932456773
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_open_unix_socket (int *fd,
DBusError *error)
{
return _dbus_open_socket(fd, PF_UNIX, SOCK_STREAM, 0, error);
}
|
CWE-20
| 3,753 | 13,677 |
256260554159101627914899264543657927988
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_parse_uid (const DBusString *uid_str,
dbus_uid_t *uid)
{
int end;
long val;
if (_dbus_string_get_length (uid_str) == 0)
{
_dbus_verbose ("UID string was zero length\n");
return FALSE;
}
val = -1;
end = 0;
if (!_dbus_string_parse_int (uid_str, 0, &val,
&end))
{
_dbus_verbose ("could not parse string as a UID\n");
return FALSE;
}
if (end != _dbus_string_get_length (uid_str))
{
_dbus_verbose ("string contained trailing stuff after UID\n");
return FALSE;
}
*uid = val;
return TRUE;
}
|
CWE-20
| 3,754 | 13,678 |
313028859694452604088420263945602338755
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_poll (DBusPollFD *fds,
int n_fds,
int timeout_milliseconds)
{
#if defined(HAVE_POLL) && !defined(BROKEN_POLL)
/* This big thing is a constant expression and should get optimized
* out of existence. So it's more robust than a configure check at
* no cost.
*/
if (_DBUS_POLLIN == POLLIN &&
_DBUS_POLLPRI == POLLPRI &&
_DBUS_POLLOUT == POLLOUT &&
_DBUS_POLLERR == POLLERR &&
_DBUS_POLLHUP == POLLHUP &&
_DBUS_POLLNVAL == POLLNVAL &&
sizeof (DBusPollFD) == sizeof (struct pollfd) &&
_DBUS_STRUCT_OFFSET (DBusPollFD, fd) ==
_DBUS_STRUCT_OFFSET (struct pollfd, fd) &&
_DBUS_STRUCT_OFFSET (DBusPollFD, events) ==
_DBUS_STRUCT_OFFSET (struct pollfd, events) &&
_DBUS_STRUCT_OFFSET (DBusPollFD, revents) ==
_DBUS_STRUCT_OFFSET (struct pollfd, revents))
{
return poll ((struct pollfd*) fds,
n_fds,
timeout_milliseconds);
}
else
{
/* We have to convert the DBusPollFD to an array of
* struct pollfd, poll, and convert back.
*/
_dbus_warn ("didn't implement poll() properly for this system yet\n");
return -1;
}
#else /* ! HAVE_POLL */
fd_set read_set, write_set, err_set;
int max_fd = 0;
int i;
struct timeval tv;
int ready;
FD_ZERO (&read_set);
FD_ZERO (&write_set);
FD_ZERO (&err_set);
for (i = 0; i < n_fds; i++)
{
DBusPollFD *fdp = &fds[i];
if (fdp->events & _DBUS_POLLIN)
FD_SET (fdp->fd, &read_set);
if (fdp->events & _DBUS_POLLOUT)
FD_SET (fdp->fd, &write_set);
FD_SET (fdp->fd, &err_set);
max_fd = MAX (max_fd, fdp->fd);
}
tv.tv_sec = timeout_milliseconds / 1000;
tv.tv_usec = (timeout_milliseconds % 1000) * 1000;
ready = select (max_fd + 1, &read_set, &write_set, &err_set,
timeout_milliseconds < 0 ? NULL : &tv);
if (ready > 0)
{
for (i = 0; i < n_fds; i++)
{
DBusPollFD *fdp = &fds[i];
fdp->revents = 0;
if (FD_ISSET (fdp->fd, &read_set))
fdp->revents |= _DBUS_POLLIN;
if (FD_ISSET (fdp->fd, &write_set))
fdp->revents |= _DBUS_POLLOUT;
if (FD_ISSET (fdp->fd, &err_set))
fdp->revents |= _DBUS_POLLERR;
}
}
return ready;
#endif
}
|
CWE-20
| 3,756 | 13,679 |
46775899165197094994598333107285129377
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_print_backtrace (void)
{
#if defined (HAVE_BACKTRACE) && defined (DBUS_BUILT_R_DYNAMIC)
void *bt[500];
int bt_size;
int i;
char **syms;
bt_size = backtrace (bt, 500);
syms = backtrace_symbols (bt, bt_size);
i = 0;
while (i < bt_size)
{
/* don't use dbus_warn since it can _dbus_abort() */
fprintf (stderr, " %s\n", syms[i]);
++i;
}
fflush (stderr);
free (syms);
#elif defined (HAVE_BACKTRACE) && ! defined (DBUS_BUILT_R_DYNAMIC)
fprintf (stderr, " D-Bus not built with -rdynamic so unable to print a backtrace\n");
#else
fprintf (stderr, " D-Bus not compiled with backtrace support so unable to print a backtrace\n");
#endif
}
|
CWE-20
| 3,757 | 13,680 |
177408840091025016624867352273968207272
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_accept (int listen_fd)
{
int client_fd;
retry:
client_fd = accept (listen_fd, NULL, NULL);
if (DBUS_SOCKET_IS_INVALID (client_fd))
{
DBUS_SOCKET_SET_ERRNO ();
if (errno == EINTR)
goto retry;
}
_dbus_verbose ("client fd %d accepted\n", client_fd);
return client_fd;
}
|
CWE-20
| 3,758 | 13,681 |
141986496008672424026432484193197441655
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_append_keyring_directory_for_credentials (DBusString *directory,
DBusCredentials *credentials)
{
DBusString homedir;
DBusString dotdir;
const char *homepath;
const char *homedrive;
_dbus_assert (credentials != NULL);
_dbus_assert (!_dbus_credentials_are_anonymous (credentials));
if (!_dbus_string_init (&homedir))
return FALSE;
homedrive = _dbus_getenv("HOMEDRIVE");
if (homedrive != NULL && *homedrive != '\0')
{
_dbus_string_append(&homedir,homedrive);
}
homepath = _dbus_getenv("HOMEPATH");
if (homepath != NULL && *homepath != '\0')
{
_dbus_string_append(&homedir,homepath);
}
#ifdef DBUS_BUILD_TESTS
{
const char *override;
override = _dbus_getenv ("DBUS_TEST_HOMEDIR");
if (override != NULL && *override != '\0')
{
_dbus_string_set_length (&homedir, 0);
if (!_dbus_string_append (&homedir, override))
goto failed;
_dbus_verbose ("Using fake homedir for testing: %s\n",
_dbus_string_get_const_data (&homedir));
}
else
{
static dbus_bool_t already_warned = FALSE;
if (!already_warned)
{
_dbus_warn ("Using your real home directory for testing, set DBUS_TEST_HOMEDIR to avoid\n");
already_warned = TRUE;
}
}
}
#endif
#ifdef DBUS_WINCE
/* It's not possible to create a .something directory in Windows CE
using the file explorer. */
#define KEYRING_DIR "dbus-keyrings"
#else
#define KEYRING_DIR ".dbus-keyrings"
#endif
_dbus_string_init_const (&dotdir, KEYRING_DIR);
if (!_dbus_concat_dir_and_file (&homedir,
&dotdir))
goto failed;
if (!_dbus_string_copy (&homedir, 0,
directory, _dbus_string_get_length (directory))) {
goto failed;
}
_dbus_string_free (&homedir);
return TRUE;
failed:
_dbus_string_free (&homedir);
return FALSE;
}
|
CWE-20
| 3,759 | 13,682 |
169512687687641009957392146938922864791
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_append_session_config_file (DBusString *str)
{
return _dbus_get_config_file_name(str, "session.conf");
}
|
CWE-20
| 3,760 | 13,683 |
183150751517907809701874992845359288157
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_append_system_config_file (DBusString *str)
{
return _dbus_get_config_file_name(str, "system.conf");
}
|
CWE-20
| 3,761 | 13,684 |
166226715473506913732371824860889105283
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_append_user_from_current_process (DBusString *str)
{
dbus_bool_t retval = FALSE;
char *sid = NULL;
if (!_dbus_getsid(&sid))
return FALSE;
retval = _dbus_string_append (str,sid);
LocalFree(sid);
return retval;
}
|
CWE-20
| 3,762 | 13,685 |
230099171809491699503806966085692631542
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_atomic_dec (DBusAtomic *atomic)
{
return InterlockedDecrement (&atomic->value) + 1;
}
|
CWE-20
| 3,763 | 13,686 |
81433723527204338085746592879284043010
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_atomic_get (DBusAtomic *atomic)
{
/* this is what GLib does, hopefully it's right... */
MemoryBarrier ();
return atomic->value;
}
|
CWE-20
| 3,764 | 13,687 |
279205390810581258679174730855841350981
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_atomic_inc (DBusAtomic *atomic)
{
return InterlockedIncrement (&atomic->value) - 1;
}
|
CWE-20
| 3,765 | 13,688 |
157921639798753550632250988266718814143
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_check_dir_is_private_to_user (DBusString *dir, DBusError *error)
{
/* TODO */
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
return TRUE;
}
|
CWE-20
| 3,766 | 13,689 |
142061551181946423195972553107806317283
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_check_setuid (void)
{
return FALSE;
}
|
CWE-20
| 3,767 | 13,690 |
301809479585961928222046606974651274032
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_close_socket (int fd,
DBusError *error)
{
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
again:
if (closesocket (fd) == SOCKET_ERROR)
{
DBUS_SOCKET_SET_ERRNO ();
if (errno == EINTR)
goto again;
dbus_set_error (error, _dbus_error_from_errno (errno),
"Could not close socket: socket=%d, , %s",
fd, _dbus_strerror_from_errno ());
return FALSE;
}
_dbus_verbose ("_dbus_close_socket: socket=%d, \n", fd);
return TRUE;
}
|
CWE-20
| 3,768 | 13,691 |
200029053603700676943653127302878502422
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_concat_dir_and_file (DBusString *dir,
const DBusString *next_component)
{
dbus_bool_t dir_ends_in_slash;
dbus_bool_t file_starts_with_slash;
if (_dbus_string_get_length (dir) == 0 ||
_dbus_string_get_length (next_component) == 0)
return TRUE;
dir_ends_in_slash =
('/' == _dbus_string_get_byte (dir, _dbus_string_get_length (dir) - 1) ||
'\\' == _dbus_string_get_byte (dir, _dbus_string_get_length (dir) - 1));
file_starts_with_slash =
('/' == _dbus_string_get_byte (next_component, 0) ||
'\\' == _dbus_string_get_byte (next_component, 0));
if (dir_ends_in_slash && file_starts_with_slash)
{
_dbus_string_shorten (dir, 1);
}
else if (!(dir_ends_in_slash || file_starts_with_slash))
{
if (!_dbus_string_append_byte (dir, '\\'))
return FALSE;
}
return _dbus_string_copy (next_component, 0, dir,
_dbus_string_get_length (dir));
}
|
CWE-20
| 3,769 | 13,692 |
272837788171434916116646751018271526383
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_connect_named_pipe (const char *path,
DBusError *error)
{
_dbus_assert_not_reached ("not implemented");
}
|
CWE-20
| 3,770 | 13,693 |
252663569700464413189213602890871699927
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_connect_tcp_socket_with_nonce (const char *host,
const char *port,
const char *family,
const char *noncefile,
DBusError *error)
{
int fd = -1, res;
struct addrinfo hints;
struct addrinfo *ai, *tmp;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
_dbus_win_startup_winsock ();
_DBUS_ZERO (hints);
if (!family)
hints.ai_family = AF_UNSPEC;
else if (!strcmp(family, "ipv4"))
hints.ai_family = AF_INET;
else if (!strcmp(family, "ipv6"))
hints.ai_family = AF_INET6;
else
{
dbus_set_error (error,
DBUS_ERROR_INVALID_ARGS,
"Unknown address family %s", family);
return -1;
}
hints.ai_protocol = IPPROTO_TCP;
hints.ai_socktype = SOCK_STREAM;
#ifdef AI_ADDRCONFIG
hints.ai_flags = AI_ADDRCONFIG;
#else
hints.ai_flags = 0;
#endif
if ((res = getaddrinfo(host, port, &hints, &ai)) != 0 || !ai)
{
dbus_set_error (error,
_dbus_error_from_errno (res),
"Failed to lookup host/port: \"%s:%s\": %s (%d)",
host, port, _dbus_strerror(res), res);
return -1;
}
tmp = ai;
while (tmp)
{
if ((fd = socket (tmp->ai_family, SOCK_STREAM, 0)) == INVALID_SOCKET)
{
DBUS_SOCKET_SET_ERRNO ();
dbus_set_error (error,
_dbus_error_from_errno (errno),
"Failed to open socket: %s",
_dbus_strerror_from_errno ());
freeaddrinfo(ai);
return -1;
}
_DBUS_ASSERT_ERROR_IS_CLEAR(error);
if (connect (fd, (struct sockaddr*) tmp->ai_addr, tmp->ai_addrlen) == SOCKET_ERROR)
{
DBUS_SOCKET_SET_ERRNO ();
closesocket(fd);
fd = -1;
tmp = tmp->ai_next;
continue;
}
break;
}
freeaddrinfo(ai);
if (fd == -1)
{
dbus_set_error (error,
_dbus_error_from_errno (errno),
"Failed to connect to socket \"%s:%s\" %s",
host, port, _dbus_strerror_from_errno ());
return -1;
}
if (noncefile != NULL)
{
DBusString noncefileStr;
dbus_bool_t ret;
if (!_dbus_string_init (&noncefileStr) ||
!_dbus_string_append(&noncefileStr, noncefile))
{
closesocket (fd);
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
return -1;
}
ret = _dbus_send_nonce (fd, &noncefileStr, error);
_dbus_string_free (&noncefileStr);
if (!ret)
{
closesocket (fd);
return -1;
}
}
_dbus_fd_set_close_on_exec (fd);
if (!_dbus_set_fd_nonblocking (fd, error))
{
closesocket (fd);
return -1;
}
return fd;
}
|
CWE-20
| 3,772 | 13,694 |
96790277546913043303821144807883704081
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_create_directory (const DBusString *filename,
DBusError *error)
{
const char *filename_c;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
filename_c = _dbus_string_get_const_data (filename);
if (!CreateDirectoryA (filename_c, NULL))
{
if (GetLastError () == ERROR_ALREADY_EXISTS)
return TRUE;
dbus_set_error (error, DBUS_ERROR_FAILED,
"Failed to create directory %s: %s\n",
filename_c, _dbus_strerror_from_errno ());
return FALSE;
}
else
return TRUE;
}
|
CWE-20
| 3,773 | 13,695 |
221131161069128876793932318234686467379
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_daemon_already_runs (DBusString *address, DBusString *shm_name, const char *scope)
{
HANDLE lock;
HANDLE daemon;
DBusString mutex_name;
dbus_bool_t bRet = TRUE;
if (!_dbus_get_mutex_name(&mutex_name,scope))
{
_dbus_string_free( &mutex_name );
return FALSE;
}
lock = _dbus_global_lock( cUniqueDBusInitMutex );
daemon = CreateMutexA( NULL, FALSE, _dbus_string_get_const_data(&mutex_name) );
if(WaitForSingleObject( daemon, 10 ) != WAIT_TIMEOUT)
{
ReleaseMutex (daemon);
CloseHandle (daemon);
_dbus_global_unlock( lock );
_dbus_string_free( &mutex_name );
return FALSE;
}
bRet = _dbus_get_autolaunch_shm( address, shm_name );
CloseHandle ( daemon );
_dbus_global_unlock( lock );
_dbus_string_free( &mutex_name );
return bRet;
}
|
CWE-20
| 3,776 | 13,696 |
318566410745555612333787943637643228075
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_daemon_is_session_bus_address_published (const char *scope)
{
HANDLE lock;
DBusString mutex_name;
if (!_dbus_get_mutex_name(&mutex_name,scope))
{
_dbus_string_free( &mutex_name );
return FALSE;
}
if (hDBusDaemonMutex)
return TRUE;
lock = _dbus_global_lock( cUniqueDBusInitMutex );
hDBusDaemonMutex = CreateMutexA( NULL, FALSE, _dbus_string_get_const_data(&mutex_name) );
/* The client uses mutex ownership to detect a running server, so the server should do so too.
Fortunally the client deletes the mutex in the lock protected area, so checking presence
will work too. */
_dbus_global_unlock( lock );
_dbus_string_free( &mutex_name );
if (hDBusDaemonMutex == NULL)
return FALSE;
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
CloseHandle(hDBusDaemonMutex);
hDBusDaemonMutex = NULL;
return TRUE;
}
return FALSE;
}
|
CWE-20
| 3,777 | 13,697 |
141220207535382007273780580622782445774
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_daemon_publish_session_bus_address (const char* address, const char *scope)
{
HANDLE lock;
char *shared_addr = NULL;
DBusString shm_name;
DBusString mutex_name;
_dbus_assert (address);
if (!_dbus_get_mutex_name(&mutex_name,scope))
{
_dbus_string_free( &mutex_name );
return FALSE;
}
lock = _dbus_global_lock( cUniqueDBusInitMutex );
if (!hDBusDaemonMutex)
{
hDBusDaemonMutex = CreateMutexA( NULL, FALSE, _dbus_string_get_const_data(&mutex_name) );
}
_dbus_string_free( &mutex_name );
if (WaitForSingleObject( hDBusDaemonMutex, 10 ) != WAIT_OBJECT_0)
{
_dbus_global_unlock( lock );
CloseHandle( hDBusDaemonMutex );
return FALSE;
}
if (!_dbus_get_shm_name(&shm_name,scope))
{
_dbus_string_free( &shm_name );
_dbus_global_unlock( lock );
return FALSE;
}
hDBusSharedMem = CreateFileMappingA( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
0, strlen( address ) + 1, _dbus_string_get_const_data(&shm_name) );
_dbus_assert( hDBusSharedMem );
shared_addr = MapViewOfFile( hDBusSharedMem, FILE_MAP_WRITE, 0, 0, 0 );
_dbus_assert (shared_addr);
strcpy( shared_addr, address);
UnmapViewOfFile( shared_addr );
_dbus_global_unlock( lock );
_dbus_verbose( "published session bus address at %s\n",_dbus_string_get_const_data (&shm_name) );
_dbus_string_free( &shm_name );
return TRUE;
}
|
CWE-20
| 3,778 | 13,698 |
172195685314882016313773660768172556412
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_daemon_unpublish_session_bus_address (void)
{
HANDLE lock;
lock = _dbus_global_lock( cUniqueDBusInitMutex );
CloseHandle( hDBusSharedMem );
hDBusSharedMem = NULL;
ReleaseMutex( hDBusDaemonMutex );
CloseHandle( hDBusDaemonMutex );
hDBusDaemonMutex = NULL;
_dbus_global_unlock( lock );
}
|
CWE-20
| 3,779 | 13,699 |
216636122531999637123200847821700308256
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_delete_file (const DBusString *filename,
DBusError *error)
{
const char *filename_c;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
filename_c = _dbus_string_get_const_data (filename);
if (DeleteFileA (filename_c) == 0)
{
dbus_set_error (error, DBUS_ERROR_FAILED,
"Failed to delete file %s: %s\n",
filename_c, _dbus_strerror_from_errno ());
return FALSE;
}
else
return TRUE;
}
|
CWE-20
| 3,781 | 13,700 |
6058611879515318225630499616062826428
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_disable_sigpipe (void)
{
}
|
CWE-20
| 3,782 | 13,701 |
131664290672777460515492589992847700048
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_fd_set_close_on_exec (intptr_t handle)
{
if ( !SetHandleInformation( (HANDLE) handle,
HANDLE_FLAG_INHERIT | HANDLE_FLAG_PROTECT_FROM_CLOSE,
0 /*disable both flags*/ ) )
{
_dbus_win_warn_win_error ("Disabling socket handle inheritance failed:", GetLastError());
}
}
|
CWE-20
| 3,783 | 13,702 |
10287363417492224439850960100902008280
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_file_exists (const char *file)
{
DWORD attributes = GetFileAttributesA (file);
if (attributes != INVALID_FILE_ATTRIBUTES && GetLastError() != ERROR_PATH_NOT_FOUND)
return TRUE;
else
return FALSE;
}
|
CWE-20
| 3,784 | 13,703 |
28328613276361906771190779779569407721
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_flush_caches (void)
{
}
|
CWE-20
| 3,785 | 13,704 |
211846263513939930423685876664947489801
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_full_duplex_pipe (int *fd1,
int *fd2,
dbus_bool_t blocking,
DBusError *error)
{
SOCKET temp, socket1 = -1, socket2 = -1;
struct sockaddr_in saddr;
int len;
u_long arg;
_dbus_win_startup_winsock ();
temp = socket (AF_INET, SOCK_STREAM, 0);
if (temp == INVALID_SOCKET)
{
DBUS_SOCKET_SET_ERRNO ();
goto out0;
}
_DBUS_ZERO (saddr);
saddr.sin_family = AF_INET;
saddr.sin_port = 0;
saddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
if (bind (temp, (struct sockaddr *)&saddr, sizeof (saddr)) == SOCKET_ERROR)
{
DBUS_SOCKET_SET_ERRNO ();
goto out0;
}
if (listen (temp, 1) == SOCKET_ERROR)
{
DBUS_SOCKET_SET_ERRNO ();
goto out0;
}
len = sizeof (saddr);
if (getsockname (temp, (struct sockaddr *)&saddr, &len) == SOCKET_ERROR)
{
DBUS_SOCKET_SET_ERRNO ();
goto out0;
}
socket1 = socket (AF_INET, SOCK_STREAM, 0);
if (socket1 == INVALID_SOCKET)
{
DBUS_SOCKET_SET_ERRNO ();
goto out0;
}
if (connect (socket1, (struct sockaddr *)&saddr, len) == SOCKET_ERROR)
{
DBUS_SOCKET_SET_ERRNO ();
goto out1;
}
socket2 = accept (temp, (struct sockaddr *) &saddr, &len);
if (socket2 == INVALID_SOCKET)
{
DBUS_SOCKET_SET_ERRNO ();
goto out1;
}
if (!blocking)
{
arg = 1;
if (ioctlsocket (socket1, FIONBIO, &arg) == SOCKET_ERROR)
{
DBUS_SOCKET_SET_ERRNO ();
goto out2;
}
arg = 1;
if (ioctlsocket (socket2, FIONBIO, &arg) == SOCKET_ERROR)
{
DBUS_SOCKET_SET_ERRNO ();
goto out2;
}
}
*fd1 = socket1;
*fd2 = socket2;
_dbus_verbose ("full-duplex pipe %d:%d <-> %d:%d\n",
*fd1, socket1, *fd2, socket2);
closesocket (temp);
return TRUE;
out2:
closesocket (socket2);
out1:
closesocket (socket1);
out0:
closesocket (temp);
dbus_set_error (error, _dbus_error_from_errno (errno),
"Could not setup socket pair: %s",
_dbus_strerror_from_errno ());
return FALSE;
}
|
CWE-20
| 3,786 | 13,705 |
21873620443769171177518861296255185575
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_generate_random_bytes (DBusString *str,
int n_bytes)
{
int old_len;
char *p;
HCRYPTPROV hprov;
old_len = _dbus_string_get_length (str);
if (!_dbus_string_lengthen (str, n_bytes))
return FALSE;
p = _dbus_string_get_data_len (str, old_len, n_bytes);
if (!CryptAcquireContext (&hprov, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
return FALSE;
if (!CryptGenRandom (hprov, n_bytes, p))
{
CryptReleaseContext (hprov, 0);
return FALSE;
}
CryptReleaseContext (hprov, 0);
return TRUE;
}
|
CWE-20
| 3,787 | 13,706 |
13114657216297344994978804132941806023
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_address_string (DBusString *out, const char *basestring, const char *scope)
{
_dbus_string_init(out);
_dbus_string_append(out,basestring);
if (!scope)
{
return TRUE;
}
else if (strcmp(scope,"*install-path") == 0
|| strcmp(scope,"install-path") == 0)
{
DBusString temp;
if (!_dbus_get_install_root_as_hash(&temp))
{
_dbus_string_free(out);
return FALSE;
}
_dbus_string_append(out,"-");
_dbus_string_append(out,_dbus_string_get_const_data(&temp));
_dbus_string_free(&temp);
}
else if (strcmp(scope,"*user") == 0)
{
_dbus_string_append(out,"-");
if (!_dbus_append_user_from_current_process(out))
{
_dbus_string_free(out);
return FALSE;
}
}
else if (strlen(scope) > 0)
{
_dbus_string_append(out,"-");
_dbus_string_append(out,scope);
return TRUE;
}
return TRUE;
}
|
CWE-20
| 3,788 | 13,707 |
269681738568088092351005748192812845356
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_autolaunch_address (const char *scope, DBusString *address,
DBusError *error)
{
HANDLE mutex;
STARTUPINFOA si;
PROCESS_INFORMATION pi;
dbus_bool_t retval = FALSE;
LPSTR lpFile;
char dbus_exe_path[MAX_PATH];
char dbus_args[MAX_PATH * 2];
const char * daemon_name = DBUS_DAEMON_NAME ".exe";
DBusString shm_name;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
if (!_dbus_get_shm_name(&shm_name,scope))
{
dbus_set_error_const (error, DBUS_ERROR_FAILED, "could not determine shm name");
return FALSE;
}
mutex = _dbus_global_lock ( cDBusAutolaunchMutex );
if (_dbus_daemon_already_runs(address,&shm_name,scope))
{
_dbus_verbose( "found running dbus daemon at %s\n",
_dbus_string_get_const_data (&shm_name) );
retval = TRUE;
goto out;
}
if (!SearchPathA(NULL, daemon_name, NULL, sizeof(dbus_exe_path), dbus_exe_path, &lpFile))
{
HMODULE hmod;
char dbus_module_path[MAX_PATH];
DWORD rc;
_dbus_verbose( "did not found dbus daemon executable on default search path, "
"trying path where dbus shared library is located");
hmod = _dbus_win_get_dll_hmodule();
rc = GetModuleFileNameA(hmod, dbus_module_path, sizeof(dbus_module_path));
if (rc <= 0)
{
dbus_set_error_const (error, DBUS_ERROR_FAILED, "could not retrieve dbus shared library file name");
retval = FALSE;
goto out;
}
else
{
char *ext_idx = strrchr(dbus_module_path, '\\');
if (ext_idx)
*ext_idx = '\0';
if (!SearchPathA(dbus_module_path, daemon_name, NULL, sizeof(dbus_exe_path), dbus_exe_path, &lpFile))
{
dbus_set_error_const (error, DBUS_ERROR_FAILED, "could not find dbus-daemon executable");
retval = FALSE;
printf ("please add the path to %s to your PATH environment variable\n", daemon_name);
printf ("or start the daemon manually\n\n");
goto out;
}
_dbus_verbose( "found dbus daemon executable at %s",dbus_module_path);
}
}
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
_snprintf(dbus_args, sizeof(dbus_args) - 1, "\"%s\" %s", dbus_exe_path, " --session");
if(CreateProcessA(dbus_exe_path, dbus_args, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi))
{
CloseHandle (pi.hThread);
CloseHandle (pi.hProcess);
retval = _dbus_get_autolaunch_shm( address, &shm_name );
if (retval == FALSE)
dbus_set_error_const (error, DBUS_ERROR_FAILED, "Failed to get autolaunch address from launched dbus-daemon");
}
else
{
dbus_set_error_const (error, DBUS_ERROR_FAILED, "Failed to launch dbus-daemon");
retval = FALSE;
}
out:
if (retval)
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
else
_DBUS_ASSERT_ERROR_IS_SET (error);
_dbus_global_unlock (mutex);
return retval;
}
|
CWE-20
| 3,789 | 13,708 |
309045159089777481512049770815741735775
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_autolaunch_shm (DBusString *address, DBusString *shm_name)
{
HANDLE sharedMem;
char *shared_addr;
int i;
for(i=0;i<20;++i) {
sharedMem = OpenFileMappingA( FILE_MAP_READ, FALSE, _dbus_string_get_const_data(shm_name));
if( sharedMem == 0 )
Sleep( 100 );
if ( sharedMem != 0)
break;
}
if( sharedMem == 0 )
return FALSE;
shared_addr = MapViewOfFile( sharedMem, FILE_MAP_READ, 0, 0, 0 );
if( !shared_addr )
return FALSE;
_dbus_string_init( address );
_dbus_string_append( address, shared_addr );
UnmapViewOfFile( shared_addr );
CloseHandle( sharedMem );
return TRUE;
}
|
CWE-20
| 3,790 | 13,709 |
200404151503445836597602253377387534715
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_config_file_name(DBusString *config_file, char *s)
{
char path[MAX_PATH*2];
int path_size = sizeof(path);
if (!_dbus_get_install_root(path,path_size))
return FALSE;
if(strlen(s) + 4 + strlen(path) > sizeof(path)-2)
return FALSE;
strcat(path,"etc\\");
strcat(path,s);
if (_dbus_file_exists(path))
{
if (!_dbus_string_append (config_file, path))
return FALSE;
}
else
{
if (!_dbus_get_install_root(path,path_size))
return FALSE;
if(strlen(s) + 11 + strlen(path) > sizeof(path)-2)
return FALSE;
strcat(path,"etc\\dbus-1\\");
strcat(path,s);
if (_dbus_file_exists(path))
{
if (!_dbus_string_append (config_file, path))
return FALSE;
}
else
{
if (!_dbus_get_install_root(path,path_size))
return FALSE;
if(strlen(s) + 4 + strlen(path) > sizeof(path)-2)
return FALSE;
strcat(path,"bus\\");
strcat(path,s);
if (_dbus_file_exists(path))
{
if (!_dbus_string_append (config_file, path))
return FALSE;
}
}
}
return TRUE;
}
|
CWE-20
| 3,791 | 13,710 |
270017623277578056567488455542349963713
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_install_root(char *prefix, int len)
{
DWORD pathLength;
char *lastSlash;
SetLastError( 0 );
pathLength = GetModuleFileNameA(_dbus_win_get_dll_hmodule(), prefix, len);
if ( pathLength == 0 || GetLastError() != 0 ) {
*prefix = '\0';
return FALSE;
}
lastSlash = _mbsrchr(prefix, '\\');
if (lastSlash == NULL) {
*prefix = '\0';
return FALSE;
}
lastSlash[1] = 0;
if (lastSlash - prefix >= 4 && strnicmp(lastSlash - 4, "\\bin", 4) == 0)
lastSlash[-3] = 0;
else if (lastSlash - prefix >= 10 && strnicmp(lastSlash - 10, "\\bin\\debug", 10) == 0)
lastSlash[-9] = 0;
else if (lastSlash - prefix >= 12 && strnicmp(lastSlash - 12, "\\bin\\release", 12) == 0)
lastSlash[-11] = 0;
return TRUE;
}
|
CWE-20
| 3,792 | 13,711 |
159258985151003171161501654178776903787
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_install_root_as_hash(DBusString *out)
{
DBusString install_path;
char path[MAX_PATH*2];
int path_size = sizeof(path);
if (!_dbus_get_install_root(path,path_size))
return FALSE;
_dbus_string_init(&install_path);
_dbus_string_append(&install_path,path);
_dbus_string_init(out);
_dbus_string_tolower_ascii(&install_path,0,_dbus_string_get_length(&install_path));
if (!_dbus_sha_compute (&install_path, out))
return FALSE;
return TRUE;
}
|
CWE-20
| 3,793 | 13,712 |
308233448687413371163866253254177166749
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_is_errno_eagain_or_ewouldblock (void)
{
return errno == WSAEWOULDBLOCK;
}
|
CWE-20
| 3,794 | 13,713 |
173544244510802878803531073293423237280
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_monotonic_time (long *tv_sec,
long *tv_usec)
{
/* no implementation yet, fall back to wall-clock time */
_dbus_get_real_time (tv_sec, tv_usec);
}
|
CWE-20
| 3,795 | 13,714 |
81163158675498934024330181725063949329
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_mutex_name (DBusString *out,const char *scope)
{
return _dbus_get_address_string (out,cDBusDaemonMutex,scope);
}
|
CWE-20
| 3,796 | 13,715 |
154680577293282414230899994308859978036
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_real_time (long *tv_sec,
long *tv_usec)
{
FILETIME ft;
dbus_uint64_t time64;
GetSystemTimeAsFileTime (&ft);
memcpy (&time64, &ft, sizeof (time64));
/* Convert from 100s of nanoseconds since 1601-01-01
* to Unix epoch. Yes, this is Y2038 unsafe.
*/
time64 -= DBUS_INT64_CONSTANT (116444736000000000);
time64 /= 10;
if (tv_sec)
*tv_sec = time64 / 1000000;
if (tv_usec)
*tv_usec = time64 % 1000000;
}
|
CWE-20
| 3,797 | 13,716 |
64701808813819140087398292584006909746
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_shm_name (DBusString *out,const char *scope)
{
return _dbus_get_address_string (out,cDBusDaemonAddressInfo,scope);
}
|
CWE-20
| 3,798 | 13,717 |
196641861376189204240379805806233626734
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_standard_session_servicedirs (DBusList **dirs)
{
const char *common_progs;
DBusString servicedir_path;
if (!_dbus_string_init (&servicedir_path))
return FALSE;
#ifdef DBUS_WINCE
{
/* On Windows CE, we adjust datadir dynamically to installation location. */
const char *data_dir = _dbus_getenv ("DBUS_DATADIR");
if (data_dir != NULL)
{
if (!_dbus_string_append (&servicedir_path, data_dir))
goto oom;
if (!_dbus_string_append (&servicedir_path, _DBUS_PATH_SEPARATOR))
goto oom;
}
}
#else
/*
the code for accessing services requires absolute base pathes
in case DBUS_DATADIR is relative make it absolute
*/
#ifdef DBUS_WIN
{
DBusString p;
_dbus_string_init_const (&p, DBUS_DATADIR);
if (!_dbus_path_is_absolute (&p))
{
char install_root[1000];
if (_dbus_get_install_root (install_root, sizeof(install_root)))
if (!_dbus_string_append (&servicedir_path, install_root))
goto oom;
}
}
#endif
if (!_dbus_string_append (&servicedir_path, DBUS_DATADIR))
goto oom;
if (!_dbus_string_append (&servicedir_path, _DBUS_PATH_SEPARATOR))
goto oom;
#endif
common_progs = _dbus_getenv ("CommonProgramFiles");
if (common_progs != NULL)
{
if (!_dbus_string_append (&servicedir_path, common_progs))
goto oom;
if (!_dbus_string_append (&servicedir_path, _DBUS_PATH_SEPARATOR))
goto oom;
}
if (!_dbus_split_paths_and_append (&servicedir_path,
DBUS_STANDARD_SESSION_SERVICEDIR,
dirs))
goto oom;
_dbus_string_free (&servicedir_path);
return TRUE;
oom:
_dbus_string_free (&servicedir_path);
return FALSE;
}
|
CWE-20
| 3,799 | 13,718 |
298835353140255813481464289934518948332
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_standard_system_servicedirs (DBusList **dirs)
{
*dirs = NULL;
return TRUE;
}
|
CWE-20
| 3,800 | 13,719 |
138861855474738629983826834277879336514
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_get_tmpdir(void)
{
static const char* tmpdir = NULL;
static char buf[1000];
if (tmpdir == NULL)
{
char *last_slash;
if (!GetTempPathA (sizeof (buf), buf))
{
_dbus_warn ("GetTempPath failed\n");
_dbus_abort ();
}
/* Drop terminating backslash or slash */
last_slash = _mbsrchr (buf, '\\');
if (last_slash > buf && last_slash[1] == '\0')
last_slash[0] = '\0';
last_slash = _mbsrchr (buf, '/');
if (last_slash > buf && last_slash[1] == '\0')
last_slash[0] = '\0';
tmpdir = buf;
}
_dbus_assert(tmpdir != NULL);
return tmpdir;
}
|
CWE-20
| 3,801 | 13,720 |
222144308432965432985792395488538043677
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_getpid (void)
{
return GetCurrentProcessId ();
}
|
CWE-20
| 3,802 | 13,721 |
278476281379427730423833051094217208469
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
HANDLE _dbus_global_lock (const char *mutexname)
{
HANDLE mutex;
DWORD gotMutex;
mutex = CreateMutexA( NULL, FALSE, mutexname );
if( !mutex )
{
return FALSE;
}
gotMutex = WaitForSingleObject( mutex, INFINITE );
switch( gotMutex )
{
case WAIT_ABANDONED:
ReleaseMutex (mutex);
CloseHandle (mutex);
return 0;
case WAIT_FAILED:
case WAIT_TIMEOUT:
return 0;
}
return mutex;
}
|
CWE-20
| 3,803 | 13,722 |
266563372292707274909970203044194317405
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
void _dbus_global_unlock (HANDLE mutex)
{
ReleaseMutex (mutex);
CloseHandle (mutex);
}
|
CWE-20
| 3,804 | 13,723 |
166717836240500034963029729673215963936
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_lookup_session_address (dbus_bool_t *supported,
DBusString *address,
DBusError *error)
{
/* Probably fill this in with something based on COM? */
*supported = FALSE;
return TRUE;
}
|
CWE-20
| 3,806 | 13,724 |
283416410519248545457306917065469026844
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_make_file_world_readable(const DBusString *filename,
DBusError *error)
{
return TRUE;
}
|
CWE-20
| 3,807 | 13,725 |
108558569084726018691274993690315937206
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_path_is_absolute (const DBusString *filename)
{
if (_dbus_string_get_length (filename) > 0)
return _dbus_string_get_byte (filename, 1) == ':'
|| _dbus_string_get_byte (filename, 0) == '\\'
|| _dbus_string_get_byte (filename, 0) == '/';
else
return FALSE;
}
|
CWE-20
| 3,808 | 13,726 |
319255951289305779092981536773823826403
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_poll (DBusPollFD *fds,
int n_fds,
int timeout_milliseconds)
{
#define USE_CHRIS_IMPL 0
#if USE_CHRIS_IMPL
#define DBUS_POLL_CHAR_BUFFER_SIZE 2000
char msg[DBUS_POLL_CHAR_BUFFER_SIZE];
char *msgp;
int ret = 0;
int i;
struct timeval tv;
int ready;
#define DBUS_STACK_WSAEVENTS 256
WSAEVENT eventsOnStack[DBUS_STACK_WSAEVENTS];
WSAEVENT *pEvents = NULL;
if (n_fds > DBUS_STACK_WSAEVENTS)
pEvents = calloc(sizeof(WSAEVENT), n_fds);
else
pEvents = eventsOnStack;
#ifdef DBUS_ENABLE_VERBOSE_MODE
msgp = msg;
msgp += sprintf (msgp, "WSAEventSelect: to=%d\n\t", timeout_milliseconds);
for (i = 0; i < n_fds; i++)
{
DBusPollFD *fdp = &fds[i];
if (fdp->events & _DBUS_POLLIN)
msgp += sprintf (msgp, "R:%d ", fdp->fd);
if (fdp->events & _DBUS_POLLOUT)
msgp += sprintf (msgp, "W:%d ", fdp->fd);
msgp += sprintf (msgp, "E:%d\n\t", fdp->fd);
if (msgp >= msg + DBUS_POLL_CHAR_BUFFER_SIZE)
{
_dbus_assert_not_reached ("buffer overflow in _dbus_poll");
}
}
msgp += sprintf (msgp, "\n");
_dbus_verbose ("%s",msg);
#endif
for (i = 0; i < n_fds; i++)
{
DBusPollFD *fdp = &fds[i];
WSAEVENT ev;
long lNetworkEvents = FD_OOB;
ev = WSACreateEvent();
if (fdp->events & _DBUS_POLLIN)
lNetworkEvents |= FD_READ | FD_ACCEPT | FD_CLOSE;
if (fdp->events & _DBUS_POLLOUT)
lNetworkEvents |= FD_WRITE | FD_CONNECT;
WSAEventSelect(fdp->fd, ev, lNetworkEvents);
pEvents[i] = ev;
}
ready = WSAWaitForMultipleEvents (n_fds, pEvents, FALSE, timeout_milliseconds, FALSE);
if (DBUS_SOCKET_API_RETURNS_ERROR (ready))
{
DBUS_SOCKET_SET_ERRNO ();
if (errno != WSAEWOULDBLOCK)
_dbus_verbose ("WSAWaitForMultipleEvents: failed: %s\n", _dbus_strerror_from_errno ());
ret = -1;
}
else if (ready == WSA_WAIT_TIMEOUT)
{
_dbus_verbose ("WSAWaitForMultipleEvents: WSA_WAIT_TIMEOUT\n");
ret = 0;
}
else if (ready >= WSA_WAIT_EVENT_0 && ready < (int)(WSA_WAIT_EVENT_0 + n_fds))
{
msgp = msg;
msgp += sprintf (msgp, "WSAWaitForMultipleEvents: =%d\n\t", ready);
for (i = 0; i < n_fds; i++)
{
DBusPollFD *fdp = &fds[i];
WSANETWORKEVENTS ne;
fdp->revents = 0;
WSAEnumNetworkEvents(fdp->fd, pEvents[i], &ne);
if (ne.lNetworkEvents & (FD_READ | FD_ACCEPT | FD_CLOSE))
fdp->revents |= _DBUS_POLLIN;
if (ne.lNetworkEvents & (FD_WRITE | FD_CONNECT))
fdp->revents |= _DBUS_POLLOUT;
if (ne.lNetworkEvents & (FD_OOB))
fdp->revents |= _DBUS_POLLERR;
if (ne.lNetworkEvents & (FD_READ | FD_ACCEPT | FD_CLOSE))
msgp += sprintf (msgp, "R:%d ", fdp->fd);
if (ne.lNetworkEvents & (FD_WRITE | FD_CONNECT))
msgp += sprintf (msgp, "W:%d ", fdp->fd);
if (ne.lNetworkEvents & (FD_OOB))
msgp += sprintf (msgp, "E:%d ", fdp->fd);
msgp += sprintf (msgp, "lNetworkEvents:%d ", ne.lNetworkEvents);
if(ne.lNetworkEvents)
ret++;
WSAEventSelect(fdp->fd, pEvents[i], 0);
}
msgp += sprintf (msgp, "\n");
_dbus_verbose ("%s",msg);
}
else
{
_dbus_verbose ("WSAWaitForMultipleEvents: failed for unknown reason!");
ret = -1;
}
for(i = 0; i < n_fds; i++)
{
WSACloseEvent(pEvents[i]);
}
if (n_fds > DBUS_STACK_WSAEVENTS)
free(pEvents);
return ret;
#else /* USE_CHRIS_IMPL */
#define DBUS_POLL_CHAR_BUFFER_SIZE 2000
char msg[DBUS_POLL_CHAR_BUFFER_SIZE];
char *msgp;
fd_set read_set, write_set, err_set;
int max_fd = 0;
int i;
struct timeval tv;
int ready;
FD_ZERO (&read_set);
FD_ZERO (&write_set);
FD_ZERO (&err_set);
#ifdef DBUS_ENABLE_VERBOSE_MODE
msgp = msg;
msgp += sprintf (msgp, "select: to=%d\n\t", timeout_milliseconds);
for (i = 0; i < n_fds; i++)
{
DBusPollFD *fdp = &fds[i];
if (fdp->events & _DBUS_POLLIN)
msgp += sprintf (msgp, "R:%d ", fdp->fd);
if (fdp->events & _DBUS_POLLOUT)
msgp += sprintf (msgp, "W:%d ", fdp->fd);
msgp += sprintf (msgp, "E:%d\n\t", fdp->fd);
if (msgp >= msg + DBUS_POLL_CHAR_BUFFER_SIZE)
{
_dbus_assert_not_reached ("buffer overflow in _dbus_poll");
}
}
msgp += sprintf (msgp, "\n");
_dbus_verbose ("%s",msg);
#endif
for (i = 0; i < n_fds; i++)
{
DBusPollFD *fdp = &fds[i];
if (fdp->events & _DBUS_POLLIN)
FD_SET (fdp->fd, &read_set);
if (fdp->events & _DBUS_POLLOUT)
FD_SET (fdp->fd, &write_set);
FD_SET (fdp->fd, &err_set);
max_fd = MAX (max_fd, fdp->fd);
}
tv.tv_sec = timeout_milliseconds < 0 ? 1 : timeout_milliseconds / 1000;
tv.tv_usec = timeout_milliseconds < 0 ? 0 : (timeout_milliseconds % 1000) * 1000;
ready = select (max_fd + 1, &read_set, &write_set, &err_set, &tv);
if (DBUS_SOCKET_API_RETURNS_ERROR (ready))
{
DBUS_SOCKET_SET_ERRNO ();
if (errno != WSAEWOULDBLOCK)
_dbus_verbose ("select: failed: %s\n", _dbus_strerror_from_errno ());
}
else if (ready == 0)
_dbus_verbose ("select: = 0\n");
else
if (ready > 0)
{
#ifdef DBUS_ENABLE_VERBOSE_MODE
msgp = msg;
msgp += sprintf (msgp, "select: = %d:\n\t", ready);
for (i = 0; i < n_fds; i++)
{
DBusPollFD *fdp = &fds[i];
if (FD_ISSET (fdp->fd, &read_set))
msgp += sprintf (msgp, "R:%d ", fdp->fd);
if (FD_ISSET (fdp->fd, &write_set))
msgp += sprintf (msgp, "W:%d ", fdp->fd);
if (FD_ISSET (fdp->fd, &err_set))
msgp += sprintf (msgp, "E:%d\n\t", fdp->fd);
}
msgp += sprintf (msgp, "\n");
_dbus_verbose ("%s",msg);
#endif
for (i = 0; i < n_fds; i++)
{
DBusPollFD *fdp = &fds[i];
fdp->revents = 0;
if (FD_ISSET (fdp->fd, &read_set))
fdp->revents |= _DBUS_POLLIN;
if (FD_ISSET (fdp->fd, &write_set))
fdp->revents |= _DBUS_POLLOUT;
if (FD_ISSET (fdp->fd, &err_set))
fdp->revents |= _DBUS_POLLERR;
}
}
return ready;
#endif /* USE_CHRIS_IMPL */
}
|
CWE-20
| 3,809 | 13,727 |
313513451664492900623318026903206039997
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
void _dbus_print_backtrace(void)
{
init_backtrace();
dump_backtrace();
}
|
CWE-20
| 3,810 | 13,728 |
98671623080210792124572206929732741768
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
dbus_bool_t _dbus_read_local_machine_uuid (DBusGUID *machine_id,
dbus_bool_t create_if_not_found,
DBusError *error)
{
#ifdef DBUS_WINCE
return TRUE;
#else
HW_PROFILE_INFOA info;
char *lpc = &info.szHwProfileGuid[0];
dbus_uint32_t u;
if(!GetCurrentHwProfileA(&info))
{
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); // FIXME
return FALSE;
}
lpc++;
u = ((fromAscii(lpc[0]) << 0) |
(fromAscii(lpc[1]) << 4) |
(fromAscii(lpc[2]) << 8) |
(fromAscii(lpc[3]) << 12) |
(fromAscii(lpc[4]) << 16) |
(fromAscii(lpc[5]) << 20) |
(fromAscii(lpc[6]) << 24) |
(fromAscii(lpc[7]) << 28));
machine_id->as_uint32s[0] = u;
lpc += 9;
u = ((fromAscii(lpc[0]) << 0) |
(fromAscii(lpc[1]) << 4) |
(fromAscii(lpc[2]) << 8) |
(fromAscii(lpc[3]) << 12) |
(fromAscii(lpc[5]) << 16) |
(fromAscii(lpc[6]) << 20) |
(fromAscii(lpc[7]) << 24) |
(fromAscii(lpc[8]) << 28));
machine_id->as_uint32s[1] = u;
lpc += 10;
u = ((fromAscii(lpc[0]) << 0) |
(fromAscii(lpc[1]) << 4) |
(fromAscii(lpc[2]) << 8) |
(fromAscii(lpc[3]) << 12) |
(fromAscii(lpc[5]) << 16) |
(fromAscii(lpc[6]) << 20) |
(fromAscii(lpc[7]) << 24) |
(fromAscii(lpc[8]) << 28));
machine_id->as_uint32s[2] = u;
lpc += 9;
u = ((fromAscii(lpc[0]) << 0) |
(fromAscii(lpc[1]) << 4) |
(fromAscii(lpc[2]) << 8) |
(fromAscii(lpc[3]) << 12) |
(fromAscii(lpc[4]) << 16) |
(fromAscii(lpc[5]) << 20) |
(fromAscii(lpc[6]) << 24) |
(fromAscii(lpc[7]) << 28));
machine_id->as_uint32s[3] = u;
#endif
return TRUE;
}
|
CWE-20
| 3,813 | 13,729 |
243705420423764789057268605557023005105
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_read_socket (int fd,
DBusString *buffer,
int count)
{
int bytes_read;
int start;
char *data;
_dbus_assert (count >= 0);
start = _dbus_string_get_length (buffer);
if (!_dbus_string_lengthen (buffer, count))
{
_dbus_win_set_errno (ENOMEM);
return -1;
}
data = _dbus_string_get_data_len (buffer, start, count);
again:
_dbus_verbose ("recv: count=%d fd=%d\n", count, fd);
bytes_read = recv (fd, data, count, 0);
if (bytes_read == SOCKET_ERROR)
{
DBUS_SOCKET_SET_ERRNO();
_dbus_verbose ("recv: failed: %s (%d)\n", _dbus_strerror (errno), errno);
bytes_read = -1;
}
else
_dbus_verbose ("recv: = %d\n", bytes_read);
if (bytes_read < 0)
{
if (errno == EINTR)
goto again;
else
{
/* put length back (note that this doesn't actually realloc anything) */
_dbus_string_set_length (buffer, start);
return -1;
}
}
else
{
/* put length back (doesn't actually realloc) */
_dbus_string_set_length (buffer, start + bytes_read);
#if 0
if (bytes_read > 0)
_dbus_verbose_bytes_of_string (buffer, start, bytes_read);
#endif
return bytes_read;
}
}
|
CWE-20
| 3,814 | 13,730 |
59025773701817685534643307482841203401
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_send_credentials_socket (int handle,
DBusError *error)
{
/* FIXME: for the session bus credentials shouldn't matter (?), but
* for the system bus they are presumably essential. A rough outline
* of a way to implement the credential transfer would be this:
*
* client waits to *read* a byte.
*
* server creates a named pipe with a random name, sends a byte
* contining its length, and its name.
*
* client reads the name, connects to it (using Win32 API).
*
* server waits for connection to the named pipe, then calls
* ImpersonateNamedPipeClient(), notes its now-current credentials,
* calls RevertToSelf(), closes its handles to the named pipe, and
* is done. (Maybe there is some other way to get the SID of a named
* pipe client without having to use impersonation?)
*
* client closes its handles and is done.
*
* Ralf: Why not sending credentials over the given this connection ?
* Using named pipes makes it impossible to be connected from a unix client.
*
*/
int bytes_written;
DBusString buf;
_dbus_string_init_const_len (&buf, "\0", 1);
again:
bytes_written = _dbus_write_socket (handle, &buf, 0, 1 );
if (bytes_written < 0 && errno == EINTR)
goto again;
if (bytes_written < 0)
{
dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to write credentials byte: %s",
_dbus_strerror_from_errno ());
return FALSE;
}
else if (bytes_written == 0)
{
dbus_set_error (error, DBUS_ERROR_IO_ERROR,
"wrote zero bytes writing credentials byte");
return FALSE;
}
else
{
_dbus_assert (bytes_written == 1);
_dbus_verbose ("wrote 1 zero byte, credential sending isn't implemented yet\n");
return TRUE;
}
return TRUE;
}
|
CWE-20
| 3,815 | 13,731 |
172656048158929808628825958871465036413
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_set_fd_nonblocking (int handle,
DBusError *error)
{
u_long one = 1;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
if (ioctlsocket (handle, FIONBIO, &one) == SOCKET_ERROR)
{
DBUS_SOCKET_SET_ERRNO ();
dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to set socket %d:%d to nonblocking: %s", handle,
_dbus_strerror_from_errno ());
return FALSE;
}
return TRUE;
}
|
CWE-20
| 3,816 | 13,732 |
140855128189331227468097022634255449902
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_socket_is_invalid (int fd)
{
return fd == INVALID_SOCKET ? TRUE : FALSE;
}
|
CWE-20
| 3,818 | 13,733 |
217536467718711238618153631746170050365
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_strerror (int error_number)
{
#ifdef DBUS_WINCE
return "unknown";
#else
const char *msg;
switch (error_number)
{
case WSAEINTR:
return "Interrupted function call";
case WSAEACCES:
return "Permission denied";
case WSAEFAULT:
return "Bad address";
case WSAEINVAL:
return "Invalid argument";
case WSAEMFILE:
return "Too many open files";
case WSAEWOULDBLOCK:
return "Resource temporarily unavailable";
case WSAEINPROGRESS:
return "Operation now in progress";
case WSAEALREADY:
return "Operation already in progress";
case WSAENOTSOCK:
return "Socket operation on nonsocket";
case WSAEDESTADDRREQ:
return "Destination address required";
case WSAEMSGSIZE:
return "Message too long";
case WSAEPROTOTYPE:
return "Protocol wrong type for socket";
case WSAENOPROTOOPT:
return "Bad protocol option";
case WSAEPROTONOSUPPORT:
return "Protocol not supported";
case WSAESOCKTNOSUPPORT:
return "Socket type not supported";
case WSAEOPNOTSUPP:
return "Operation not supported";
case WSAEPFNOSUPPORT:
return "Protocol family not supported";
case WSAEAFNOSUPPORT:
return "Address family not supported by protocol family";
case WSAEADDRINUSE:
return "Address already in use";
case WSAEADDRNOTAVAIL:
return "Cannot assign requested address";
case WSAENETDOWN:
return "Network is down";
case WSAENETUNREACH:
return "Network is unreachable";
case WSAENETRESET:
return "Network dropped connection on reset";
case WSAECONNABORTED:
return "Software caused connection abort";
case WSAECONNRESET:
return "Connection reset by peer";
case WSAENOBUFS:
return "No buffer space available";
case WSAEISCONN:
return "Socket is already connected";
case WSAENOTCONN:
return "Socket is not connected";
case WSAESHUTDOWN:
return "Cannot send after socket shutdown";
case WSAETIMEDOUT:
return "Connection timed out";
case WSAECONNREFUSED:
return "Connection refused";
case WSAEHOSTDOWN:
return "Host is down";
case WSAEHOSTUNREACH:
return "No route to host";
case WSAEPROCLIM:
return "Too many processes";
case WSAEDISCON:
return "Graceful shutdown in progress";
case WSATYPE_NOT_FOUND:
return "Class type not found";
case WSAHOST_NOT_FOUND:
return "Host not found";
case WSATRY_AGAIN:
return "Nonauthoritative host not found";
case WSANO_RECOVERY:
return "This is a nonrecoverable error";
case WSANO_DATA:
return "Valid name, no data record of requested type";
case WSA_INVALID_HANDLE:
return "Specified event object handle is invalid";
case WSA_INVALID_PARAMETER:
return "One or more parameters are invalid";
case WSA_IO_INCOMPLETE:
return "Overlapped I/O event object not in signaled state";
case WSA_IO_PENDING:
return "Overlapped operations will complete later";
case WSA_NOT_ENOUGH_MEMORY:
return "Insufficient memory available";
case WSA_OPERATION_ABORTED:
return "Overlapped operation aborted";
#ifdef WSAINVALIDPROCTABLE
case WSAINVALIDPROCTABLE:
return "Invalid procedure table from service provider";
#endif
#ifdef WSAINVALIDPROVIDER
case WSAINVALIDPROVIDER:
return "Invalid service provider version number";
#endif
#ifdef WSAPROVIDERFAILEDINIT
case WSAPROVIDERFAILEDINIT:
return "Unable to initialize a service provider";
#endif
case WSASYSCALLFAILURE:
return "System call failure";
}
msg = strerror (error_number);
if (msg == NULL)
msg = "unknown";
return msg;
#endif //DBUS_WINCE
}
|
CWE-20
| 3,819 | 13,734 |
249157199621662960170091903643238314094
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_win_error_from_last_error (void)
{
switch (GetLastError())
{
case 0:
return DBUS_ERROR_FAILED;
case ERROR_NO_MORE_FILES:
case ERROR_TOO_MANY_OPEN_FILES:
return DBUS_ERROR_LIMITS_EXCEEDED; /* kernel out of memory */
case ERROR_ACCESS_DENIED:
case ERROR_CANNOT_MAKE:
return DBUS_ERROR_ACCESS_DENIED;
case ERROR_NOT_ENOUGH_MEMORY:
return DBUS_ERROR_NO_MEMORY;
case ERROR_FILE_EXISTS:
return DBUS_ERROR_FILE_EXISTS;
case ERROR_FILE_NOT_FOUND:
case ERROR_PATH_NOT_FOUND:
return DBUS_ERROR_FILE_NOT_FOUND;
}
return DBUS_ERROR_FAILED;
}
|
CWE-20
| 3,820 | 13,735 |
191792745891619343873547547739267464097
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_win_error_string (int error_number)
{
char *msg;
FormatMessageA (FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL, error_number, 0,
(LPSTR) &msg, 0, NULL);
if (msg[strlen (msg) - 1] == '\n')
msg[strlen (msg) - 1] = '\0';
if (msg[strlen (msg) - 1] == '\r')
msg[strlen (msg) - 1] = '\0';
return msg;
}
|
CWE-20
| 3,821 | 13,736 |
206497818414779324377062012410723778765
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_win_free_error_string (char *string)
{
LocalFree (string);
}
|
CWE-20
| 3,822 | 13,737 |
88030456670261968425039267554141372596
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_win_set_errno (int err)
{
#ifdef DBUS_WINCE
SetLastError (err);
#else
errno = err;
#endif
}
|
CWE-20
| 3,823 | 13,738 |
122076013050624782472513706678600326893
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_win_set_error_from_win_error (DBusError *error,
int code)
{
char *msg;
/* As we want the English message, use the A API */
FormatMessageA (FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL, code, MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US),
(LPSTR) &msg, 0, NULL);
if (msg)
{
char *msg_copy;
msg_copy = dbus_malloc (strlen (msg));
strcpy (msg_copy, msg);
LocalFree (msg);
dbus_set_error (error, "win32.error", "%s", msg_copy);
}
else
dbus_set_error (error, "win32.error", "Unknown error code %d or FormatMessage failed", code);
}
|
CWE-20
| 3,824 | 13,739 |
165711374023610605463742641972699992236
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_win_startup_winsock (void)
{
/* Straight from MSDN, deuglified */
static dbus_bool_t beenhere = FALSE;
WORD wVersionRequested;
WSADATA wsaData;
int err;
if (beenhere)
return;
wVersionRequested = MAKEWORD (2, 0);
err = WSAStartup (wVersionRequested, &wsaData);
if (err != 0)
{
_dbus_assert_not_reached ("Could not initialize WinSock");
_dbus_abort ();
}
/* Confirm that the WinSock DLL supports 2.0. Note that if the DLL
* supports versions greater than 2.0 in addition to 2.0, it will
* still return 2.0 in wVersion since that is the version we
* requested.
*/
if (LOBYTE (wsaData.wVersion) != 2 ||
HIBYTE (wsaData.wVersion) != 0)
{
_dbus_assert_not_reached ("No usable WinSock found");
_dbus_abort ();
}
beenhere = TRUE;
}
|
CWE-20
| 3,825 | 13,740 |
283919271875069485361898303836187051426
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
_dbus_windows_get_datadir (void)
{
return _dbus_replace_install_prefix(DBUS_DATADIR);
}
|
CWE-20
| 3,826 | 13,741 |
70142060189259711746744505684286127227
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
static void dump_backtrace()
{
HANDLE hCurrentThread;
HANDLE hThread;
DWORD dwThreadId;
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(),
GetCurrentProcess(), &hCurrentThread, 0, FALSE, DUPLICATE_SAME_ACCESS);
hThread = CreateThread(NULL, 0, dump_thread_proc, (LPVOID)hCurrentThread,
0, &dwThreadId);
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
CloseHandle(hCurrentThread);
}
|
CWE-20
| 3,828 | 13,742 |
17150850958527094763749262534703363403
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
static DWORD WINAPI dump_thread_proc(LPVOID lpParameter)
{
dump_backtrace_for_thread((HANDLE)lpParameter);
return 0;
}
|
CWE-20
| 3,830 | 13,743 |
338140865888754903513763369380934681672
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
static dbus_uint32_t fromAscii(char ascii)
{
if(ascii >= '0' && ascii <= '9')
return ascii - '0';
if(ascii >= 'A' && ascii <= 'F')
return ascii - 'A' + 10;
if(ascii >= 'a' && ascii <= 'f')
return ascii - 'a' + 10;
return 0;
}
|
CWE-20
| 3,831 | 13,744 |
265679648125738953128832454907596779869
| null | null | null |
dbus
|
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
| 0 |
static BOOL init_backtrace()
{
HMODULE hmodDbgHelp = LoadLibraryA("dbghelp");
/*
#define GETFUNC(x) \
p##x = (typeof(x)*)GetProcAddress(hmodDbgHelp, #x); \
if (!p##x) \
{ \
return FALSE; \
}
*/
#define FUNC(x) #x
pStackWalk = (BOOL (WINAPI *)(
DWORD MachineType,
HANDLE hProcess,
HANDLE hThread,
LPSTACKFRAME StackFrame,
PVOID ContextRecord,
PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine,
PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,
PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine,
PTRANSLATE_ADDRESS_ROUTINE TranslateAddress
))GetProcAddress (hmodDbgHelp, FUNC(StackWalk));
#ifdef _WIN64
pSymGetModuleBase=(DWORD64 (WINAPI *)(
HANDLE hProcess,
DWORD64 dwAddr
))GetProcAddress (hmodDbgHelp, FUNC(SymGetModuleBase));
pSymFunctionTableAccess=(PVOID (WINAPI *)(
HANDLE hProcess,
DWORD64 AddrBase
))GetProcAddress (hmodDbgHelp, FUNC(SymFunctionTableAccess));
#else
pSymGetModuleBase=(DWORD (WINAPI *)(
HANDLE hProcess,
DWORD dwAddr
))GetProcAddress (hmodDbgHelp, FUNC(SymGetModuleBase));
pSymFunctionTableAccess=(PVOID (WINAPI *)(
HANDLE hProcess,
DWORD AddrBase
))GetProcAddress (hmodDbgHelp, FUNC(SymFunctionTableAccess));
#endif
pSymInitialize = (BOOL (WINAPI *)(
HANDLE hProcess,
PSTR UserSearchPath,
BOOL fInvadeProcess
))GetProcAddress (hmodDbgHelp, FUNC(SymInitialize));
pSymGetSymFromAddr = (BOOL (WINAPI *)(
HANDLE hProcess,
DWORD Address,
PDWORD Displacement,
PIMAGEHLP_SYMBOL Symbol
))GetProcAddress (hmodDbgHelp, FUNC(SymGetSymFromAddr));
pSymGetModuleInfo = (BOOL (WINAPI *)(
HANDLE hProcess,
DWORD dwAddr,
PIMAGEHLP_MODULE ModuleInfo
))GetProcAddress (hmodDbgHelp, FUNC(SymGetModuleInfo));
pSymSetOptions = (DWORD (WINAPI *)(
DWORD SymOptions
))GetProcAddress (hmodDbgHelp, FUNC(SymSetOptions));
pSymSetOptions(SYMOPT_UNDNAME);
pSymInitialize(GetCurrentProcess(), NULL, TRUE);
return TRUE;
}
|
CWE-20
| 3,832 | 13,745 |
132560078775292034148127786165053560243
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
ASCII85Stream::ASCII85Stream(Stream *strA):
FilterStream(strA) {
index = n = 0;
eof = gFalse;
}
|
CWE-119
| 3,890 | 13,764 |
267722926878059526078259567597789403899
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
ASCIIHexEncoder::ASCIIHexEncoder(Stream *strA):
FilterStream(strA) {
bufPtr = bufEnd = buf;
lineLen = 0;
eof = gFalse;
}
|
CWE-119
| 3,891 | 13,765 |
249663285257725362502677202103033006652
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
BaseStream::BaseStream(Object *dictA, Guint lengthA) {
dict = *dictA;
length = lengthA;
}
|
CWE-119
| 3,893 | 13,766 |
216918512750318704206651348744690127941
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
BufStream::BufStream(Stream *strA, int bufSizeA): FilterStream(strA) {
bufSize = bufSizeA;
buf = (int *)gmallocn(bufSize, sizeof(int));
}
|
CWE-119
| 3,894 | 13,767 |
324777239675896232951092623073375286633
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
CCITTFaxStream::CCITTFaxStream(Stream *strA, int encodingA, GBool endOfLineA,
GBool byteAlignA, int columnsA, int rowsA,
GBool endOfBlockA, GBool blackA):
FilterStream(strA) {
encoding = encodingA;
endOfLine = endOfLineA;
byteAlign = byteAlignA;
columns = columnsA;
if (columns < 1) {
columns = 1;
} else if (columns > INT_MAX - 2) {
columns = INT_MAX - 2;
}
rows = rowsA;
endOfBlock = endOfBlockA;
black = blackA;
codingLine = (int *)gmallocn_checkoverflow(columns + 1, sizeof(int));
refLine = (int *)gmallocn_checkoverflow(columns + 2, sizeof(int));
if (codingLine != NULL && refLine != NULL) {
eof = gFalse;
codingLine[0] = columns;
} else {
eof = gTrue;
}
row = 0;
nextLine2D = encoding < 0;
inputBits = 0;
a0i = 0;
outputBits = 0;
buf = EOF;
}
|
CWE-119
| 3,895 | 13,768 |
276378427286580990572554630437910491580
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
CMYKGrayEncoder::CMYKGrayEncoder(Stream *strA):
FilterStream(strA) {
bufPtr = bufEnd = buf;
eof = gFalse;
}
|
CWE-119
| 3,896 | 13,769 |
144168739613919132138088094745055337666
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
CachedFileStream::CachedFileStream(CachedFile *ccA, Guint startA,
GBool limitedA, Guint lengthA, Object *dictA)
: BaseStream(dictA, lengthA)
{
cc = ccA;
start = startA;
limited = limitedA;
length = lengthA;
bufPtr = bufEnd = buf;
bufPos = start;
savePos = 0;
saved = gFalse;
}
|
CWE-119
| 3,897 | 13,770 |
192675784002671177906103160421536854422
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
DCTStream::DCTStream(Stream *strA, int colorXformA):
FilterStream(strA) {
int i, j;
colorXform = colorXformA;
progressive = interleaved = gFalse;
width = height = 0;
mcuWidth = mcuHeight = 0;
numComps = 0;
comp = 0;
x = y = dy = 0;
for (i = 0; i < 4; ++i) {
for (j = 0; j < 32; ++j) {
rowBuf[i][j] = NULL;
}
frameBuf[i] = NULL;
}
if (!dctClipInit) {
for (i = -256; i < 0; ++i)
dctClip[dctClipOffset + i] = 0;
for (i = 0; i < 256; ++i)
dctClip[dctClipOffset + i] = i;
for (i = 256; i < 512; ++i)
dctClip[dctClipOffset + i] = 255;
dctClipInit = 1;
}
}
|
CWE-119
| 3,898 | 13,771 |
206284323434322671276924392452759104117
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
EOFStream::EOFStream(Stream *strA):
FilterStream(strA) {
}
|
CWE-119
| 3,899 | 13,772 |
35595315924766564888899974835368129908
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
EmbedStream::EmbedStream(Stream *strA, Object *dictA,
GBool limitedA, Guint lengthA):
BaseStream(dictA, lengthA) {
str = strA;
limited = limitedA;
length = lengthA;
}
|
CWE-119
| 3,900 | 13,773 |
97547054927676388402730433359773922959
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
FileOutStream::FileOutStream (FILE* fa, Guint startA)
{
f = fa;
start = startA;
}
|
CWE-119
| 3,901 | 13,774 |
213457227683296634431746372161490860962
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
FileStream::FileStream(FILE *fA, Guint startA, GBool limitedA,
Guint lengthA, Object *dictA):
BaseStream(dictA, lengthA) {
f = fA;
start = startA;
limited = limitedA;
length = lengthA;
bufPtr = bufEnd = buf;
bufPos = start;
savePos = 0;
saved = gFalse;
}
|
CWE-119
| 3,902 | 13,775 |
214204066763743693758819733706938035800
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
FixedLengthEncoder::FixedLengthEncoder(Stream *strA, int lengthA):
FilterStream(strA) {
length = lengthA;
count = 0;
}
|
CWE-119
| 3,904 | 13,776 |
56892968255624466502454413221580980354
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
FlateStream::FlateStream(Stream *strA, int predictor, int columns,
int colors, int bits):
FilterStream(strA) {
if (predictor != 1) {
pred = new StreamPredictor(this, predictor, columns, colors, bits);
if (!pred->isOk()) {
delete pred;
pred = NULL;
}
} else {
pred = NULL;
}
litCodeTab.codes = NULL;
distCodeTab.codes = NULL;
memset(buf, 0, flateWindow);
}
|
CWE-119
| 3,905 | 13,777 |
333200888244410890022479258714201102812
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
ImageStream::ImageStream(Stream *strA, int widthA, int nCompsA, int nBitsA) {
int imgLineSize;
str = strA;
width = widthA;
nComps = nCompsA;
nBits = nBitsA;
nVals = width * nComps;
inputLineSize = (nVals * nBits + 7) >> 3;
if (nBits <= 0 || nVals > INT_MAX / nBits - 7) {
inputLineSize = -1;
}
inputLine = (Guchar *)gmallocn_checkoverflow(inputLineSize, sizeof(char));
if (nBits == 8) {
imgLine = (Guchar *)inputLine;
} else {
if (nBits == 1) {
imgLineSize = (nVals + 7) & ~7;
} else {
imgLineSize = nVals;
}
if (width > INT_MAX / nComps) {
imgLineSize = -1;
}
imgLine = (Guchar *)gmallocn(imgLineSize, sizeof(Guchar));
}
imgIdx = nVals;
}
|
CWE-119
| 3,906 | 13,778 |
197305679558574720851215392998765977712
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
LZWStream::LZWStream(Stream *strA, int predictor, int columns, int colors,
int bits, int earlyA):
FilterStream(strA) {
if (predictor != 1) {
pred = new StreamPredictor(this, predictor, columns, colors, bits);
if (!pred->isOk()) {
delete pred;
pred = NULL;
}
} else {
pred = NULL;
}
early = earlyA;
eof = gFalse;
inputBits = 0;
clearTable();
}
|
CWE-119
| 3,907 | 13,779 |
99228149051288805572361325187981155526
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
MemStream::MemStream(char *bufA, Guint startA, Guint lengthA, Object *dictA):
BaseStream(dictA, lengthA) {
buf = bufA;
start = startA;
length = lengthA;
bufEnd = buf + start + length;
bufPtr = buf + start;
needFree = gFalse;
}
|
CWE-119
| 3,908 | 13,780 |
281741957700966021430497108971980332934
| null | null | null |
poppler
|
b1026b5978c385328f2a15a2185c599a563edf91
| 0 |
RGBGrayEncoder::RGBGrayEncoder(Stream *strA):
FilterStream(strA) {
bufPtr = bufEnd = buf;
eof = gFalse;
}
|
CWE-119
| 3,910 | 13,781 |
288101751538068432642170389211302007927
| null | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.