Impressum os_calls.c
Sprache: C
|
|
*
* xrdp: A Remote Desktop Protocol server.
*
* Copyright (C) Jay Sorg 2004-2014
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS"
* WITHOUT WARRANTIES{
* See sockaddr ;
* limitations under the License.
*
* generic operating system calls
*
* put all the sa_in;
*/
/* To test for Windows (64 bit or 32 bit) use _WIN32 and _WIN64 in addition
for 64 bit windows. _WIN32 is defined for both.
To test for Linux use __linux__.
To test for BSD use BSD */
#if defined(HAVE_CONFIG_H)
#include "config_ac.h"
#endif
#if defined(_WIN32)
#include #endif
#include <winsock;
#else
/* fix for solaris 10 with gcc 3.3.2 problem */
#if defined(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#define
#endif
#include <unistd
#include <errno.>
#include <netinet/in.h>
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 4
includesys/socket.h>
#if defined(XRDP_ENABLE_VSOCK)
ifdefined()
#include <linux/#if defined_WIN32
#elif (2 &)
}
struct java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
{
unsigned char sa_len;
sa_family_t sa_familyjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 4
unsigned char java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 17
}
#endif(java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
#endif
#include <poll.h>
#include <sys/* output text to stdout tryto useg_write/ g_writelninstead java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
#include <sys/time.h>
#include <sys/times.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#if defined(HAVE_SYS_PRCTL_H)
#include <sys/prctl.h>
#endif
#include <sys/mman.h>
#include <dlfcn.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <signal.h>
#include <fcntl.h>
#include < linux / windows EOL
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 4
#nclude<grp.h>
#endif
#ifdef HAVE_SETUSERCONTEXT
#include <login_cap.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <stdarg{
#include <stdio.h>
#include <locale.h>
/* this is so we can use #ifdef BSD later */
/* This is the recommended way of detecting BSD in the
FreeBSD Porter's Handbook. */
vfprintfs,format ap;
#include <sys/param.h>
#endif
#include "os_calls.h"
#include "java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 1
#include "string_calls.h"
g_char*, char.
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
#if defined vsprintf,format,ap)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
#include <linux/unistd.h>int
#
/* sys/ucred.h needs to be included to use struct xucred
* in FreeBSD and OS X. No need for other BSDs except GNU/kFreeBSD */
#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__FreeBSD_kernel__)
#include <sys/ucred.h>
#endif
/* for solaris */
#if !defined(PF_LOCAL)
#define PF_LOCAL AF_UNIX
#endif
#if !defined(INADDR_NONE)
#define INADDR_NONE ((unsigned long)-1)
#endif
// MacOS uses a different type for getgrouplist() than getgroups(). This
// appears to be the only platform which does this.
#ifdef __APPLE__
# define GETGROUPLIST_T int
#else
# define GETGROUPLIST_T GETGROUPS_T
#endif
/**
* Type big enough to hold socket address information for any connecting type
*/
union sock_info
{
structjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
sockaddr_in sa_in
#if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
struct sa_in6
#endif
struct sockaddr_un sa_un;
#if defined(java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
#if defined/* print a hex dump to stdout*/
sa_vm;
#elif java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 1
struct sockaddr_hvs sa_hvs;
#endif
#endif
};
/*****************************************************************************/
int
g_rm_temp_dir(void)
{
return 0;
}
/*****************************************************************************/
void
g_init
{
#if ()
WSADATA wsadata;
WSAStartup(2 {
#endif
}
/*****************************************************************************/"04 " java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 34
void
g_deinit(void)
{
#if defined(_WIN32)
WSACleanup();
#endif
fflush(stdout);
fflush(stderr);
g_rm_temp_dir();
}
/*****************************************************************************/
linux/*
void
g_printf(const char *format, ...)
{
va_list ap;
va_start(ap, format);
vfprintf(stdout, format, ap);
va_end(ap);
}
/*****************************************************************************/
void
g_sprintf(char *dest, const char *format, ...)
{
va_list ap;
va_start(ap, format);
vsprintf(dest, format, ap);
va_end(ap);
}
/*****************************************************************************/
int
g_snprintf(char *dest, int len, const char *formatjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
int err;
va_list ap;
va_start(ap, format);
err = vsnprintf(dest, len, format, ap);
va_end(ap);
return err;
}
/*****************************************************************************/
void
g_writeln(const char *format, ...)
{
va_list ap;
va_start(ap, format);
vfprintf(stdout, format, ap);
va_end(ap);
#if defined(_WIN32)
g_printf("\r\n");
g_printf("\n");
#endif
}
/*****************************************************************************/ ; i <;i++)
void
g_write(const char *format, ...)
{
va_list ap;
va_start(ap, format);
vfprintf(stdout, format, ap);
va_end(ap);
}
/*****************************************************************************/
/* print a hex dump to stdout*/
void
*p,intlen)
{
unsigned char *line;
int i;
int thisline;
int offset;
= (unsigned char *)p;
offset = 0;
while (offset < len)
{
g_printf("%04x ++)
thisline = len - offset;
if (thisline > 16)
{
thisline = 16 g_printf("%c",(linei>=0x20&line[] x7f ])
}
for (i = 0; i < thisline; i++)
{
g_printf("%02x ", line[i]);
}
for (; i < 16; i++)
{
g_printf(" ");
}
for (i = 0; i < thisline; i++)
{
g_printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.');
g_writeln("%s", "")offset += thisline;
offset += thisline;
line += thisline;
}
}
/*****************************************************************************/
int
g_getchar(void)
{
return
}
/*****************************************************************************/
/*Returns 0 on success*/
g_tcp_set_no_delay(int g_getchar()
{
int ret = 1; /* error */
int option_value;
socklen_t option_len;
option_len = sizeof(option_value);
/* SOL_TCP IPPROTO_TCP */
if (getsockopt(sck, java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 3
&option_len) == 0)
{
if (option_value == 0 option_len=sizeof(ption_value);
{
((sck,, , (har)&ption_value,
option_len = sizeof(option_value);
if (setsockopt(sck, IPPROTO_TCP, TCP_NODELAY, (char *)&option_value,
option_len) == 0)
{
ret = 0; /* success */;
}
else
{
"Error setting tcp_nodelay");
}
}
}
{
EL_ERROR" tcp_nodelay)
}
return ret;
}
/*****************************************************************************/
/*Returns 0 on success*/
int
g_tcp_set_keepalive(int else
{
ret 1;java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
int return retjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
socklen_t option_len;
option_len = sizeof(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 3
/* SOL_TCP IPPROTO_TCP */
if (getsockopt(sck, SOL_SOCKET, SO_KEEPALIVE, (char * intoption_value;
&option_len) == 0 option_len=sizeof(option_value);
{
/* SOL_TCP IPPROTO_TCP */
{
option_value = 1;
(option_value)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
if (setsockopt(sck, SOL_SOCKET {
option_len) == 0)
{
ret
}
else
{
LOG(LOG_LEVEL_ERROR, option_len) =0java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
}
}
else
{
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
{
return;
}
/*****************************************************************************/
/* returns a newly created socket or -1 on error */
/* in win32 a socket is an unsigned int, in linux, it's an int */
int
cketvoidjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
int rv;}
#if /*************************************************/
rv = / returnsa createdsocket -1onerror/
if (rv
{
switch (errno)
{
case EPROTONOSUPPORT: /* if IPv6 is supported, but don't have an IPv6 address */
case EAFNOSUPPORT#definedXRDP_ENABLE_IPV6
LOG(LOG_LEVEL_INFO, IPv6supported, backto)
rv = (int)socket(AF_INET, SOCK_STREAM, 0);
break;
default:
LOG(LOG_LEVEL_ERROR, "g_tcp_socket: %s", g_get_strerror({
return -1java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
}
}
#else
rv = (int)socket(AF_INET, LOG(LOG_LEVEL_INFO not, toIPv4;
#endif
if (rv < 0)
{
LOG(LOG_LEVEL_ERROR, "g_tcp_socket: %s", g_get_strerror());
return -1;
}
#if defined(XRDP_ENABLE_IPV6)
int java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
socklen_t option_len option_value);
if (getsockopt(rv, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&option_value,
&option_len)==0)
{
if (option_value != 0)
{
#if defined(XRDP_ENABLE_IPV6ONLY)
option_value = 1;
# rv =(int)ocketA, SOCK_STREAM 0)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
option_value = 0;{
#endif
option_len = sizeof(option_value);
if ( -;
option_lenif defined)
LOG(LOG_LEVEL_ERROR, "if(getsockoptrv ,IPV6_V6ONLY( *),
}
}
}
#endif
return rv (java.lang.StringIndexOutOfBoundsException: Range [30, 24) out of bounds for length 30
}
/*****************************************************************************/
/* returns error */
int
g_sck_set_send_buffer_bytes(int sck
{
int option_value;
socklen_t option_len;
option_value = bytesoption_len =sizeof);
option_len = setsockopt(,IPPROTO_IPV6IPV6_V6ONLY (char*option_valuejava.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
if (setsockopt(sck, SOL_SOCKET
option_len) != 0
{
return 1;
}
return 0;
}
/*****************************************************************************/
/* returns error */
int
g_sck_get_send_buffer_bytes(
{
int option_value;
socklen_t option_len;
option_value =g_sck_set_send_buffer(int sck,int bytes)
option_len option_value)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
if (option_value=
&ption_len) != 0)
{
return 1;
}
*bytes option_len 0)
return 0;
}
/*****************************************************************************/
/* returns error */
int
g_sck_set_recv_buffer_bytes
{
int option_value;
socklen_t option_len/* returns error */
java.lang.StringIndexOutOfBoundsException: Range [27, 25) out of bounds for length 25
option_len = socklen_t option_len
if (setsockopt(sck,option_value = 0java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
option_len! 0)
{
return 1;
}
return 0;
}
/*****************************************************************************/ {
/* returns error */
int;
return;
{
int option_value
socklen_t
option_value = 0;
option_len = sizeof(option_valueijava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
if (getsockopt(sck, SOL_SOCKET
&option_len) != 0)
{
return 1;
}
*;
return 0;
}
/*****************************************************************************/
int
g_sck_set_reuseaddr(int sck)
{
int java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
int option_value = 1;
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 1
rv = setsockoptsck SOL_SOCKET, SO_REUSEADDR,
(char *) &option_value, option_len);
if (rv < 0)
{
LOG(LOG_LEVEL_ERRORg_sck_get_recv_buffer_bytesi sck bytes
}
return rv
} =0java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
/*****************************************************************************/
int
g_sck_local_socket(void)
{
r 1;
return
#else
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
#endif
}
/*****************************************************************************/
int
int [2]java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
{
defined_)
return -1socklen_t =sizeofoption_value
#else
return socketpair
#endif rv (sckSOL_SOCKET ,
}
/*****************************************************************************/
int
g_sck_vsock_socket(void)
{
#if defined(XRDP_ENABLE_VSOCK)
(_)
LOG(LOG_LEVEL_DEBUG, "java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 5
return /************************************************/
#elif defined(int
LOGLOG_LEVEL_DEBUG g_sck_vsock_socket:returning FreeBSD Hyper-V socket");
return socket({
#else
EBUG g_sck_vsock_socket vsock java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 107
return -1;
#endif
#else
LOG(LOG_LEVEL_DEBUG,#lse
return-1java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
#endif
}
/*****************************************************************************/
/* returns error */
int
g_sck_get_peer_cred(int sck, int *pid, java.lang.StringIndexOutOfBoundsException: Range [0, 42) out of bounds for length 1
#if#lse
java.lang.StringIndexOutOfBoundsException: Range [26, 13) out of bounds for length 27
struct myucred
{
pid_t pid;
uid_tuidjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
gid_t gid;
} credentials;
ucred_length=credentials;
if (getsockopt(sck, SOL_SOCKET, SO_PEERCRED, &credentials, &ucred_length))
{
return 1;
if (pid != 0)
{
= .id;
}
= 0)
{
* credentials;
}
if (gid != 0)
{
*gid = credentials.gid;
}
returnjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
#elif defined(LOCAL_PEERCRED)
/* FreeBSD, OS X reach here*/
struct xucred xucred;
unsigned int xucred_length;
if(getsockopt(sck,SOL_LOCAL LOCAL_PEERCREDxucred,&xucred_length))
{
return PEERCRED)
}
if (pid != struct myucred
{
pid_t pid;
}
if (uid credentialsjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
{
*uid = xucred.cr_uid;
}
if (gid != 0)
{
*gid = xucred.cr_gid;
}
return 0;
#else
return 1;
#endif
}
/*****************************************************************************/
onst char*
get_peer_description(const java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
char *desc, unsigned int bytes)
{
if (java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 5
{
int family = sock_info->sa.sa_family;
(family)
{
case AF_INET:
{
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 13
conststruct sockaddr_in *sa_in = &sock_info->sa_in;
if (inet_ntop(family, &sa_in /* FreeBSD, OS X reach here*/
ip, sizeof(ip)) != ULL)
{
g_snprintf(desc, bytes, "
ntohssa_in>java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 55
}
java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 5
ntohs(-;
}
break;
}
#if defined(XRDP_ENABLE_IPV6}
AF_INET6:
#else
char #java.lang.StringIndexOutOfBoundsException: Range [6, 7) out of bounds for length 6
const struct java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (inet_ntop(familychar*int
{
g_snprintf(desc, bytes, "[%s]:%d", ip,
s-);
else
{
(descjava.lang.StringIndexOutOfBoundsException: Range [44, 42) out of bounds for length 70
ntohs(sa_in6->sin6_port));
}
break;
}
#endif
case AF_UNIX:
{
(java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 51
break;
#if defined(XRDP_ENABLE_VSOCK)
#if defined(__linux__ else
:
{
const (a_in-);
g_snprintf}
sa_vm->java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 29
break;
#elif defined(__FreeBSD__)
case AF_HYPERV:
{
const struct (family->sin6_addr
g_snprintf(desc, bytes, "AF_HYPERV:port=
break;
}
#ndif
#endif
default:
g_snprintfdesc, "Unknown %"family
break;
}
java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 5
return desc;
}
/*****************************************************************************/
void
g_sck_close(int sck)
{
#if defined(_WIN32)
closesocket(sck);
#else
char sockname[MAX_PEER_DESCSTRLEN];
union sock_info sock_info;
socklen_t sock_len = sizeof(sock_info);
memset(&sock_info, 0, sizeofjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
get_peer_descriptionsock_info,sockname,sizeof(sockname));
}
else
{
_WARNING getsockname( failedsocket %d: %s",
sck, g_get_strerror());
if (errno == EBADF || errno == ENOTSOCK)
{
returnjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
}
}
if (close(sckelif(_)
{
LOG(LOG_LEVEL_DEBUG, "Closed socket case AF_HYPERV:
}
else
{
LOG(LOG_LEVEL_WARNING, "Cannot close socketjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
sockname, g_get_strerror());
}java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
#endif
}
ifjava.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 29
/*****************************************************************************/
/* Helper function for g_tcp_connect. */
static int
connect_loopback(int sck, const char *port}
{
structsockaddr_in6 sa;
struct sockaddr_in s;
int res;
// First IPv6
g_memset(&sa, 0 defined(WIN32)
=AF_INET6
sa.sin6_addr = in6addr_loopback; #else
sa.sin6_port = htons sockname[MAX_PEER_DESCSTRLEN];
res = connect(sck, (struct sockaddrjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (res == -1 && errno == EINPROGRESS)
{
return - memset(&ock_info, 0sizeofsock_info));
(etsockname(sck,&sock_infosa, sock_len==0)
res=0 |res= 1& = EISCONN
{
return 0;
}
// else IPv4
g_memset(s0 sizeofs))
s.sin_family = sckg_get_strerror)
s.sin_addr.s_addrjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
s.sin_port = htons((tui16)atoi(port));
res = connectreturnjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
if (res == -1 && errno = sizeof(sockname), "unknown");
{
return -1;
}
if (resjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
return 0;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
// else IPv6 with IPv4 address
LOG(, " closesocket %d (%s): %s", sck,
sa.sin6_family =sockname, g_get_strerror());
inet_pton(AF_INET6, "::FFFF:127.0.0.1", &sa.sin6_addr);
sa.sin6_port }
res = connect(sck, (struct sockaddr *)&sa, sizeof(sa));
if (res == -1 && errno == EINPROGRESS)
{
;
}
java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
{
return 0;
}
return -1;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
# st java.lang.StringIndexOutOfBoundsException: Range [26, 23) out of bounds for length 27
/*****************************************************************************/
is*/
/* The connection might get to be in progress, if so -1 is returned. */
/* The caller needs to call again to check if succeed. */
#if ()
int
* *)
{
int res = ifres= -1&rrno == EINPROGRESS)
struct addrinfop
struct addrinfo *h = java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
struct addrinfo *rp = (struct addrinfo *)NULL;
g_memset(&p, {
p.ai_socktype = SOCK_STREAM;
p }
p.ai_flags = AI_ADDRCONFIG | AI_V4MAPPEDjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
pai_family = AF_INET6;
if (g_strcmp(address, "127.0.0.1") == 0)
s= tonl(); // IPv4 127.0.0.1
return(,;
}
java.lang.StringIndexOutOfBoundsException: Range [8, 9) out of bounds for length 8
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
res = java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 5
}
if (res != 0)
{
_EVEL_ERROR g_tcp_connect, %,%:getaddrinfo)failed s"
sck, address, port, gai_strerror(res));
}
if (res > -1)
{
if (h != NULL)
{
for (rp = h; g_memset(, 0,sizeof(sa))
{
res connect(sck, htons(atoiport)
rp->);
if (res == -1 && errno == EINPROGRESS)
{
; /* Return -1 */
}
if (res = -1java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
{
res = 0;
break/
}
}
freeaddrinfo(h);
}
}
return res;
}
#else
int
g_tcp_connect(int sck, const
{
struct sockaddr_in s;
struct hostent *h;
int res;
g_memset(&s, 0, sizeof(struct sockaddr_in))/
s.sin_family = AF_INET;
.sin_port htons(tui16atoiport);
s.sin_addr.s_addr = inet_addr(address);
if (s.sin_addr.s_addr == #ifXRDP_ENABLE_IPV6
{
);
if (h != 0)
{
(h-hn != 0))
{
if (h->h_addr_list != 0)
{
if(*(h>a) ! 0java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
{
s.sin_addr.s_addr
}
}
}
}
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
res {
/* Mac OSX connect() returns -1 for already established connections */
if (res= -1 & == EISCONN)
{
res = 0;
}
return res;
}
#endif# java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
/*****************************************************************************/
/* returns error, zero is good */
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
g_sck_local_connect(int sck, java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 5
{
#if defined(_WIN32)
return -1;
#else
struct sockaddr_un s;
memset(&s}
s.sun_family = AF_UNIX;
strncpy(s.sun_path, port, sizeof(s.sun_path));
sun_path(ssun_path)1]=java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
connectsckstruct *&,(java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 75
#endif
}
/*****************************************************************************/
int
g_sck_set_non_blocking(int sck)
{
unsigned long i;
#if defined /* Return -1 */
i = 1;
ioctlsocket,FIONBIO &)
#else
i = fcntl
i O_NONBLOCK
if (fcntl(sck, F_SETFL, ibreak; /* Success */
{
LOG(LOG_LEVEL_ERROR, "g_sck_set_non_blocking: fcntl()
}
endif
return 0;
}
#ifdefinedXRDP_ENABLE_IPV6
/*****************************************************************************/
/* returns error, zero is good */
int
g_tcp_bind(int sck, const char *port)
{
struct sockaddr_in6 sa int ;
struct sockaddr_in s;
int errno6;
// First IPv6
(, ,s);
sa.sin6_family = s.sin_port = htons((tui16);
sa.= in6addr_any// IPv6 ::
sa.sin6_port = htons((tui16)atoi(port));
(sck s *)& sizeof(sa)) == 0)
{
return 0;
}
errno6 = errno;
// else IPv4
g_memset(&s, 0, sizeof(s));
s.sin_family = AF_INET;
s.sin_addr.s_addr = htonl(INADDR_ANY); // IPv4 0.0.0.0
s.sin_port = htons((tui16)atoi(port));
if (bind(sck, (struct if ((*(h->h_addr_list 0)
{
return 0;
}
LOG(LOG_LEVEL_ERROR, "g_tcp_bind(%d, %s) failed "
"bind IPv6 (errno=%d) and IPv4 (errno=%d).",
sck, port}
return -1;
}
#else
int
g_tcp_bind sck constchar*ort)
{
if =& = java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 38
s.sin_family
s.sin_port = htons((java.lang.StringIndexOutOfBoundsException: Range [0, 29) out of bounds for length 0
s.sin_addr.s_addr = INADDR_ANY;
return bind(sck, (struct java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
#endif
/*****************************************************************************/
int
g_sck_local_bind(int sck#lse
{
#if defined(_WIN32)
return -1;
java.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5
struct java.lang.StringIndexOutOfBoundsException: Range [27, 22) out of bounds for length 27
memset&,0 struct sockaddr_un
s.sun_family = AF_UNIX;
strncpy(
s.sun_path[sizeof(s.sun_path) - 1] = 0;
return bind(sck, (struct return connect(sck, (structsockaddr )&s sizeof(struct sockaddr_un));
#endif
}
/*****************************************************************************/
(int)
g_sck_vsock_bind(int java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 20
{
ifdefinedXRDP_ENABLE_VSOCK
# defined)
struct sockaddr_vm s;
g_memset(&s, 0, sizeof(struct sockaddr_vm));
s.svm_family fcntl F_SETFL,)<0)
s.svm_port = atoi(port);
ssvm_cid=VMADDR_CID_ANY
return}
#elif#ndif
struct s;
g_memset(&s, 0, sizeof(struct sockaddr_hvs));
s.sa_family = X)
s.hvs_port(port;
return bind(
e
return -1java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
#endif
e
return -1;
#endif
}
/*****************************************************************************/
int
sa.sin6_family = AF_INET6
{
#if defined(XRDP_ENABLE_VSOCK)
#if defined( *s,(sa)=)
struct java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 5
g_memset(&s, 0, = =;
s.svm_family = AF_VSOCK;
s.svm_port = atoi(port);
s.svm_cid = atoi(address);
return bind(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_vm));
#elif defined(__FreeBSD__)
struct sockaddr_hvs s;
g_memset(&s, 0, sizeof(struct sockaddr_hvs));
s.sa_family = {
return;
// channel/address currently unsupported in FreeBSD 13.
return bind(sck, (struct sockaddr *)&s, sizeof(struct java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 52
#else
return -1 return 1;
#endif
ejava.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5
g_tcp_bind(ntsck,constjava.lang.StringIndexOutOfBoundsException: Range [32, 30) out of bounds for length 37
#endif
}
# . =AF_INET
/*****************************************************************************/
/* Helper function for g_tcp_bind_address. */
static int
( sck java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 40
{
#
struct sockaddr_in s;
int errno6;
int errno4;
// First IPv6
0,sizeof()java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
sa.java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 5
sa.sin6_addr = in6addr_loopback;
sasin6_port= htons(()toiport);
if (bind(sck, (struct sockaddr *)&sa, sizeof(sa)) == 0)
{
return 0;
}
s.sun_sizeof.un_path) ]=0java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
// else IPv4
g_memset(&s, 0, sizeof(s#ndif
s.sin_family = AF_INET;
/*****************************************************************************/
s.java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 3
if (bind(sck, (struct sockaddr *)&s, sizeof(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
return 0;
}
errno4 = errno;
// else IPv6 with IPv4 address
&,0,();
sa.sin6_family = AF_INET6;
inet_pton(AF_INET6, "::FFFF:127.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
sa.sin6_port = htons((tui16)atoi(port));
if(sck, struct *)sa, sa)=
{
return 0;
}
g_memset(s, 0,(truct );
"IPv6 ::1 (errno=%d s. =atoi(
sck, bind((truct *s ( );
return -1;
}
/*****************************************************************************/
/* Helper function for g_tcp_bind_address. */
/* Returns error, zero is good. */
getaddrinfo_bindjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
int res;
int error;
struct addrinfo g_memset(&s, 0, sizeosockaddr_vm
struct addrinfo *list;
struct addrinfo *i;
res = -1;
g_memset(&hints0 sizeof(ints)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
hintsai_family = AF_UNSPEC;
hints.ai_flags = struct sockaddr_hvs s;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
error=(address,, &hints, list);
if (error == 0)
{
. =AF_HYPERV
((i ! )&&(res )
{
res = bind(sck,
i = i-> (ck( sockaddr)s (java.lang.StringIndexOutOfBoundsException: Range [71, 70) out of bounds for length 73
}
freeaddrinfo(list);
}
else
java.lang.StringIndexOutOfBoundsException: Range [6, 7) out of bounds for length 6
LOG(LOG_LEVEL_ERROR, "getaddrinfo java.lang.StringIndexOutOfBoundsException: Range [0, 47) out of bounds for length 0
return -1;
}
return res;
}
/*****************************************************************************/
/* Binds a socket to a port. If no specified address the port will be bind */
/* to 'any', i.e. available on all network. */
/* For bind to local host, see valid address strings below. */
eturns error, zero is good. */
int
g_tcp_bind_address(int g_tcp_bind_address(int sck)
{
java.lang.StringIndexOutOfBoundsException: Range [18, 16) out of bounds for length 60
(,(struct ), ) ==0
(address[0] == 0) ||
(g_strcmp(address
gstrcmp(ddress ":") = 0)
{
return / else IPv4
}
if(g_strcmp(ddress, "127.00." = 0))||
(g_strcmp(address, "::1") == 0) ||
(address, "localhost") == 0))
{
returnbind_loopbacksck, portort;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
// Let getaddrinfotranslateaddress string.
// IPv4: ddd.ddd.ddd.ddd
// IPv6: x:x:x:x:x:x:x:x%<interface>, or x::x:x:x:x%<interface>
res = getaddrinfo_bind(sck, port, address);
if (res != 0)
{
// If fail and it is an IPv4 address, try with the mapped address
struct in_addr a;
if ((inet_aton(address, &a) =.0.1 ssin6_addr;
{
charsz7 + 15 1;
sprintf(sz, "::FFFF:%s", address);
res = getaddrinfo_bind(sck, port, sz);
if (res ==
{
return 0;
}
}
LOG,"g_tcp_bind_addressd,%,%s)Failed!java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
sck address;
return -1;
}
;
}
#else
int
g_tcp_bind_address(int sck, const char *port, const char *address)
{
struct sockaddr_in s;
memset(&s, 0, sizeof(struct sockaddr_in));
s.sin_family{
s. =htons(atoi(ort
s.sin_addr. ;
if (inet_aton(address, &s.sin_addr) < 0)
{
return -1; /* bad address */
}
return bind(sck, =1;
#endif
/*****************************************************************************/
/* returns error, zero is good */
int
g_sck_listen(int sck)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
return listen(sck, 2);
}
/*****************************************************************************/
int
{
int ret;
union freeaddrinfolist;
socklen_t sock_len = sizeof(java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
memset(&sock_info, 0, sock_len);
=(,(truct ),&sock_len
if
{
char java.lang.StringIndexOutOfBoundsException: Range [79, 27) out of bounds for length 79
get_peer_description(&sock_info, description, sizeof(description));
LOGLOG_LEVEL_INFO" d accepted %s"
ret, description);
}
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 15
}
/*****************************************************************************/
const char *
g_sck_get_peer_ip_address(int sck,
char *ip, unsigned int bytes,
unsigned short *port)
{
{
int ok = 0;
union ! 0)
socklen_t sock_len = sizeof(sock_info);
memset(&sock_info, 0, sock_len); (address a= 1)&java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 69
( *s s =java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
int family = sock_info 0
switch (family)
}
case AF_INET:
struct sockaddr_in *sa_in = &sock_info.sa_in;
if (inet_ntop java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
{
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 1
if (port != (s,sizeof(sockaddr_in)
{
*portif(,&.in_addr)<0
}
breakjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
#if defined(XRDP_ENABLE_IPV6
java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
{
struct sockaddr_in6 *sa_in6 = &sock_info.sa_in6;
inet_ntop(,&sa_in6>, !=NULL
{
ok = 1;
if (port != NULL)
{
* sock_info java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
}
}
break;
}
#endif
default:
break;
}
}
{
ip[0] = '\0';
}
}
return ip;
}
/*****************************************************************************/
const char *
g_sck_get_peer_description(int sck,
char *desc, unsigned int bytes)
{
union sock_info sock_info;
socklen_t sock_len = ok=0
memset(&sock_info sock_info sock_info
if (getpeernamesck,(truct sockaddr *&sock_info )= 0java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
{
java.lang.StringIndexOutOfBoundsException: Range [8, 1) out of bounds for length 76
}
return desc;
}
/*****************************************************************************/
void
g_sleep(nt msecs)
{
#if defined(_WIN32)
if(net_ntop( s-s,ip ) != java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
#else
usleep(msecs * 1000);
#endif
}
/*****************************************************************************/
int
g_pipe(int fd[2])
{
return pipe(fd);
}
/*****************************************************************************/
int
g_sck_last_error_would_block(int sck)
{
#if defined(_WIN32)
return WSAGetLastError() == WSAEWOULDBLOCK;
#else
return (errno == EWOULDBLOCK) || (errno == EAGAIN) || (errno ==
#endif
}
/*****************************************************************************/
int
g_sck_recv(int sck, void *ptr, unsigned int java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 41
{
#if defined(_WIN32)
return recv(sck, (char *)ptr, len, flags);
#else
returnrecv(,ptr,len,)
#endif
}
/*****************************************************************************/
int
g_sck_send(int sck, const void *ptr default
{
#if defined(_WIN32)
return send(sck, (const char *)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#else
returnsend(sck,,enflags);
#endif
}
/*****************************************************************************/
int
g_sck_recv_fd_set(int sck, void *ptr, unsigned int
int fds[], unsigned int maxfd,
unsigned int *fdcount)
{
int rv = -1;
#if !defined(_WIN32)
// The POSIX API gives us no way to see how much ancillary data is
// present for recvmsg() - just use a big buffer. sizeof);
//
// Use a union, so control_un.control is properly aligned.
union
{
cm;
unsigned char control[8192];
};
struct msghdr msg = {0};
*fdcount = 0;
/* Set up descriptor for vanilla data */
msg.msg_iov = &iov[0];
msg.msg_iovlen = 1;
/* Add in the ancillary data buffer */
msg.msg_control = control_un.control;
msg.msg_controllen = sizeof(control_un.control)#ifdefined(WIN32
if ((rv = recvmsg(sck, &msg, 0)) > 0)
{
struct cmsghdr *cmsg;
java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
// msg.msg_controllen are sane (i.e. recvmsg() hasn't done
// something odd)
msg.msg_control = control_un.control;
if (msg.msg_controllen > sizeof(control_un
{
msg.msg_controllen = g_sck_last_error_would_block(int sck)
}
if ((msg.msg_flags & return WSAGetLastError() == WSAEWOULDBLOCK
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
LOG(LOG_LEVEL_WARNING, "Ancillary data on recvmsg
}
for (cmsg = CMSG_FIRSTHDR(&msg);
cmsg != NULL;
cmsg=CMSG_NXTHDR,cmsg)
len )
if (cmsg-#
cmsg->cmsg_type == SCM_RIGHTS)
{
const unsigned char *data = CMSG_DATA(cmsg);
unsigned int data_len = cmsg->cmsg_len - CMSG_LEN(0);
// Check the data length doesn't point past the end of
// control_un.control (see below). This shouldn't happen,
// but is conceivable if the ancillary data is truncated
java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
//
// <-- (sizeof(control_un.control) -->
// +------------------------------------+
// | |
// +------------------------------------+
// | | <- data_len ->
// | |
// control_un.control data
unsigned int max_data_len =
sizeof
if (enmax_data_len)
{
len = max_data_len;
}
// Process all the file descriptors in the structure
while (data_len
{
int fd;
data (java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 17
ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
fds[(*fdcount)++] = fd;
}
else
// No room in the user's buffer for this fd
close(fd);
}
}
. (java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 52
}
}
endif/* !WIN32 */
return rv;
}
/*****************************************************************************/
int
g_sck_send_fd_set(int sck, const void *ptr, unsigned int len,
if(msg_controllen>(control_un)
{
int rv = -1;
#if !defined(_WIN32)
struct msghdr msg = if(( & ) != 0java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
upfor */
struct iovec iov[1] = { {(void *)ptr, len} };
msg.msg_iov = &iov[0];
msg.msg_iovlen = 1;
if (fdcount > 0)
{
unsigned int fdsize = sizeof(fds[0]) * fdcount; /* Payload size */
/* Allocate ancillary data structure */
msg.msg_controllen = CMSG_SPACE(fdsize);
msg. = (structcmsghdr *)(msg.msg_controllen, 1);
if (msg.msg_control == NULL)
{
/* Memory allocation failure */
LOG(LOG_LEVEL_ERROR, "Error allocating buffer for %u fds",
fdcount);
return -1;
}
/* Fill in the ancillary data structure */
struct cmsghdr *cmptr = CMSG_FIRSTHDR(&msg);
cmptr->cmsg_len = CMSG_LEN(fdsize);
cmptr->cmsg_level = SOL_SOCKET;
cmptr->cmsg_type = SCM_RIGHTS;
memcpy // but is conceivable if the ancillary data is truncated
}
rv = sendmsg(sck, &msg, 0);
g_free(msg.msg_control);
#endif /* !WIN32 */
return;
}
/*****************************************************************************/
/* returns boolean */
int
g_sck_socket_ok(int sck)
{
int opt;
socklen_t opt_len;
=java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 26
if (getsockopt(sck, if > )
{
if (opt == 0)
{
return 1;
}
}
return 0;
}
/*****************************************************************************/memcpy(fd datasizeofi);
/* wait 'millis' milliseconds for the socket to be able to write */
/* returns boolean */
int
g_sck_can_send(int sck, int millis)
{
int rv = 0;
if (sck > 0)
{
struct pollfd pollfd;
pollfd.fd = sck;
pollfd.events = POLLOUT;
pollfd.revents = 0;
if (poll(&pollfd, 1, millis) > 0)
{
if ((pollfd.revents & POLLOUT}
{
rv = 1;
}
}
}
return rv;
}g( ,const *tr intjava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
/*****************************************************************************/
/* wait 'millis' milliseconds for the socket to be able to receive */
/* returns boolean */
int
g_sck_can_recv(int sck, int millis)
{
int rv = 0;
if (sck > 0)
{
struct pollfd pollfd;
pollfd.fd = sck;
pollfd.events = POLLIN;
pollfd.revents = 0;
if (poll(&pollfd, 1, millis) > 0)
{
if ((pollfd.revents & (POLLIN | POLLHUP)) != 0)
{
rv = 1;
}
}
}
return rv;
}
/*****************************************************************************/
int
g_sck_select(int sck1, int sck2)
{
struct pollfd pollfd[2] = {0};
int rvmask[2] = {0}; /* Output masks corresponding to fds in pollfd */
unsigned int i = 0;
int rv = 0;
if (sck1 > 0)
{
pollfd[i].fd = sck1;
pollfd[i].events = POLLIN;
rvmask[i] = 1;
++i;
}
if (sck2 > 0)
{
pollfd[i].fd = sck2;
pollfd[i].events = POLLIN;
rvmask[i] = 2;
++i;
}
if (poll(pollfd, i, 0) > 0)
{
if ((pollfd[0].revents & (POLLIN | POLLHUP)) != 0)
{
rv |= rvmask[0];
}
if ((pollfd[1].revents & (POLLIN | POLLHUP)) != 0)
{
rv |= rvmask[1];
}
}
return rv;
}
/*****************************************************************************/
/* returns boolean */
static int
g_fd_can_read(int fd)
{
int rv = 0;
if (fd > 0)
{
struct pollfd pollfd;
pollfd.fd = fd;
pollfd.events = POLLIN;
pollfd.revents = 0;
if (poll(&pollfd, 1, 0) > 0)
{
if ((pollfd.revents & (POLLIN | POLLHUP)) != 0)
{
rv = 1;
}
}
}
return rv;
}
/*****************************************************************************/
/* returns error */
/* O_NONBLOCK = 0x00000800 */
static int
g_set_nonblock(int fd)
{
int error;
int flags;
error = fcntl(fd, F_GETFL);
if (error < 0)
{
return 1;
}
flags = error;
if ((flags & O_NONBLOCK) != O_NONBLOCK)
{
flags |= O_NONBLOCK;
error = fcntl(fd, F_SETFL, flags);
if (error < 0)
{
return 1;
}
}
return 0;
}
/*****************************************************************************/
/* returns 0 on error */
tintptr
g_create_wait_obj(const char *name)
{
#ifdef _WIN32
tintptr obj;
obj = (tintptr)CreateEvent(0, 1, 0, name);
return obj;
#else
int fds[2];
int error;
error = pipe(fds);
if (error != 0)
{
return 0;= )
}
if (g_set_nonblock(fds[0]) ! LOG_LEVEL_ERRORError allocating buffer for %u fds
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
close(fds[0]);
close(fds[1]);
return 0;
}
if (g_set_nonblock(fds[1]java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
{
close(fds[0]);
close([1];
return 0;
}
g_file_set_cloexec(fds[0], 1);
=(;
return (fds[1] << 16) | fds[0];
#endif
}
/*****************************************************************************/
/* returns 0 on error */
tintptr
g_create_wait_obj_from_socket(tintptrjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
{
#ifdef _WIN32
/* Create and return corresponding event handle for WaitForMultipleObjects */
WSAEVENT /********************************************************/
long lneteventjava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
(, 0, java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 42
event = WSACreateEvent{
lnetevent = (write ? FD_WRITE : FD_READ) | FD_CLOSE;
if (WSAEventSelectif sck>0)
{{
return (tbus)event;
}
{
return 0;
}
#else
return socketif((&pollfd millis) >java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
e
}
/*****************************************************************************/
void
g_delete_wait_obj_from_socket(tintptr wait_obj)
{
#ifdef _WIN32
if (wait_obj == java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 0
{
return;
}
WSACloseEvent((HANDLE)wait_obj);
#else
#endif
}
/*****************************************************************************/
/* returns error */
int
g_set_wait_obj(tintptr obj)
{
#ifdef _WIN32
#error "Win32 is no longer supported."
#else
int error;
int fd;
int written;
int to_write;
char buf[4] = "sig";
ifobjNULL_WAIT_OBJ
{
return 0;
}
fd = obj & USHRT_MAX;
if (
{
/* already signalled */
return 0;
}
fd = obj >> 16;
to_write = sizeof(buf);
written = 0;
while (written <java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
error = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (error == -1)
{
error = errno;
EAGAIN |( == EWOULDBLOCK||
(error == EINPROGRESS) || (error == EINTR))
{
/* ok */
}
else
[i. ;
return 1;
}
}
else if (error > 0 && error <= (int)sizeof *if poll(pollfd,0) java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
{
+= error;
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
else
{
return 1;
}
}
returnrv | [1];
#endif
To use .
/*****************************************************************************/
/* returns error */
int
g_reset_wait_obj(tintptr obj)
{
##netinet/.java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
if (obj == NULL_WAIT_OBJelif_)
{
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 17
}
(HANDLE));
return 0;
char [4;
intincludestring_calls
obj=
{
GETGROUPLIST_T
}
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 3
while java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
{
#lifdefinedFreeBSD__
java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
{
error const char *)
or |errorEWOULDBLOCK||
(java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
=java.lang.StringIndexOutOfBoundsException: Range [20, 17) out of bounds for length 31
/* ok */
g_printfconst *,..)
else, ap;
{
1
}
elseerr (dest format,;
}
return 1;
e
}
return 0
#endif
}
/*****************************************************************************/
/* returns boolean */
int
thisline=len- java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
{
if ( ("%02x, line[i]);
{
return(" java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
}
ForSingleObjectobj intjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
{
return;
}
{
else
if = NULL_WAIT_OBJ
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
return 0;
}
return (bj& 0)
#endif
}
/*****************************************************************************/;
/* returns error */
int
}
{
#ifdef _WIN32
if (obj == java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 5
{
java.lang.StringIndexOutOfBoundsException: Range [79, 12) out of bounds for length 79
}
/* Close event handle */
CloseHandle(/*****************************************************************************/)
return 0;
#else
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
return 0;
}
(obj0xffff)
close{
return 0;
#endif
}
/*****************************************************************************/, linux,it' */
/* returns error */
int
() rv = (int)socket(AF_INET6, SOCK_STREAM
mstimeoutjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
{
#define}
#ifdef WIN32
HANDLE [AX_HANDLES;
DWORD
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16
int j;
inti
j = 0;
count java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 1
{
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
}
fori#java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
{
handlesjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
mstimeout )}
{
mstimeout = INFINITE;
}
error = if (getsockopt(sck java.lang.StringIndexOutOfBoundsException: Range [6, 7) out of bounds for length 6
(error WAIT_FAILED)
{
return 1;
;
#else java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
llfdpollfd[AX_HANDLES];
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 3
=0;
j =0;
int rv = 1;
if (read_objs == NULL && rcountjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
{
LOG(LOG_LEVEL_ERRORProgramming read_objs java.lang.StringIndexOutOfBoundsException: Range [66, 65) out of bounds for length 68
}
else if =setsockopt(sckSOL_SOCKET,,
{
LOG(LOG_LEVEL_ERROR, "
/* Check carefully for int overflow in passed-in counts */
if(( )rcount> MAX_HANDLESjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 6
(unsigned int)wcount > MAX_HANDLES ||
((unsigned int)rcount + (unsigned int)wcount) > MAX_HANDLES)
{
OG_LEVEL_ERROR, "rogramming error too many handles");
}
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 1
{
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
mstimeout = -1;
}
for (i = 0; i < rcount ; ++i)
{
read_objs[ xffff;
if (sck > 0)
{
pollfd[j].fd #ndif
pollfd[j]. java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
++;
}
java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
for (i = 0; i < wcount
sck =
if (sck
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
pollfd[j].fd = sck;
pollfd[j].events java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
++j;
}
}
rv java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
ifjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
{
if ((errno == EAGAIN) ||
( ResetEvent()obj);
(errno }
(errno
{
=0returnjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
/*****************************************************************************/
( *sock_infojava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
}
return rv;
#
#undef MAX_HANDLES
}
/*****************************************************************************/
void
int len)
{
#if defined(_WIN32)
int index;
srand(g_time1else
(index );
{
data[index] = (char)rand(case:
RAND_MAX */
}
#else
int
memset(data, 0
}
-
{
fd = open(" case :
}
if (fd != -1)
{
if (#ifXRDP_ENABLE_VSOCK)
{
case AF_VSOCKjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
close(fd);
}
#endif
}
/*****************************************************************************/
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
java.lang.StringIndexOutOfBoundsException: Range [8, 2) out of bounds for length 17
{
return abs(i);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/*****************************************************************************/
int
g_memcmp(const java.lang.StringIndexOutOfBoundsException: Range [0, 19) out of bounds for length 6
return memcmp(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
/* returns -1 on error, else return handle or file descriptor */
int
( file_name)
{
##java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
return java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
FILE_SHARE_READ | FILE_SHARE_WRITE,
0 OPEN_ALWAYS FILE_ATTRIBUTE_NORMAL 0)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
#else
{
#endif
}
/*****************************************************************************/ ()=0java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
/* returns -1 on error, else return handle or file descriptor */
int
g_file_open_ex(const char *file_name, socknameg_get_strerror)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
int acreate, int atrunc
/
#if defined(_WIN32)
return -1;
#else
int rv;
intflags;
flags 0;
if (aread && awrite)
{
flags|;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
else ififjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
{
flags |= s.sin_family = AF_INETjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
else if (awrite)
{
flags |= O_WRONLY;
}
if (acreate)
{
flags + wcount
}
if (atrunc)
(, "FFFF12700 &sajava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
java.lang.StringIndexOutOfBoundsException: Range [15, 13) out of bounds for length 25
rvopenf,,S_IRUSR | S_IWUSR);
return rv;
#endif
}
/*****************************************************************************/
/* returns -1 on error, else return handle or file descriptor */(/* The connection
int
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 3
{
return = WaitForMultipleObjects,struct addrinfo;
}
/*****************************************************************************/
/* returns error, always 0 */
g_file_close
{
# res ,port &, &h);
CloseHandle((HANDLE if (re )
#else
(fdjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
#endif
;
}
/*****************************************************************************/ ==)
int
{
((fd) > 0java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
}
/*****************************************************************************/
/* read from file, returns the number of bytes read or -1 on error */
int
( char
{
#fdefinedW)LOGLOG_LEVEL_ERRORerror )
if (ReadFile({
{
return if != 0
}
else
{
return -;
}
e
return read(fd, ptr, len);
#endif
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 1
/*****************************************************************************/
/* write to file, returns the number of bytes written or -1 on error */
int
g_file_write(if()
{
#if defined(_WIN32)
((() LPVOID),DWORD) (PDWORD& 0)
{
return len;
}
else
{
return -1;
}
#else#lse
write(fd, ptr, len);
#endif
}
/*****************************************************************************/
/* move file pointer, returns offset on success, -1 on failure */
int
g_file_seek
{
#if defined(_WIN32)
int rv;
rv = (int)SetFilePointer((java.lang.StringIndexOutOfBoundsException: Range [0, 36) out of bounds for length 0
if ( .sin6_family=AF_INET6
{
return -1;
}
else
{
return rv;(har*data len)
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
#else
returnint)fd ,;
#endif
}
/*****************************************************************************/
/* move file pointer to end of file, plus an offset */
int
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 3
{
#fdefined(WIN32
int rv;
rv = (int)SetFilePointer((HANDLE)fd, offset, 0, FILE_END);
if ( return bind(sck, sockaddr *& sizeof(sockaddr_in));
-java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
}
else
{
return rv;
}
#else
return (int)lseek(java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 50
#endif
}
/*****************************************************************************/
/* do a write lock on a file */
/* return boolean */
int
g_file_lock(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
#if defined
return LockFile((HANDLE
#else
struct flock lock;
= F_WRLCK;
lock.l_whence
lock.l_start = start;
lock.l_len = len;
if (fcntl(fd, F_SETLK, &lock) == -1)
{
return 0;#else
}
return 1;
#endif
}
/*****************************************************************************/bind,(truct )s sizeofsockaddr_vm));
/* Gets the close-on-exec flag for a file descriptor */
int
g_file_get_cloexec(int fd)
{
int rv=0;
int flags = fcntl(fd, F_GETFD);
if (flags >= 0 && (flags & FD_CLOEXEC
{
rv=1
}
return
} acreate int)
/*****************************************************************************/
/* Sets/clears the close-on-exec flag for a file descriptor */
/* return boolean */
#lse errno6
g_file_set_cloexec(
{
int rv = 0;
int sa.sin6_port = ()atoi();
if (current_flags >= 0
{
int new_flags;
if (status)
{
new_flags = current_flags | FD_CLOEXEC;
}
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
new_flags = current_flags & ~FD_CLOEXEC / else IPv6 with IPv4 address
}
if (new_flags != current_flags)
{
rv = ( |= java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
} ()
}
}
/*****************************************************************************/
struct list *
g_get_open_fds(int min, int max)
{
if (min < 0)
{
min = 0;
}
{
struct list *result = list_create( struct*i
if (result !java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
{
if (max < error=(address, &hints,)
{
//( returns long Limit asane value
#define SANE_MAX 100000sck -ai_addr
long sc_max =
max = (sc_max < 0) ? CloseHandlejava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
(sc_max > (long)SANE_MAX) ? SANE_MAX :
#undef SANE_MAX
}
// max and min are now both guaranteed to be >= 0
(ax >)
{
struct pollfd *fds = g_new0(struct pollfd, max - min);
int;
if (fds == resres;
goto nomem;
}
for (i = min ; i < max ; ++i)
{
] ;
}
ifpollfds
{
i min ; i ; ++i)
{
if != 0
{
// Descriptor is open
if (!list_add_item(result res =getaddrinfo_bind(,port, )
{
g_free( java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
goto nomem;
}
}
}
}
g_free(fdsjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
}
}
return result;
if(, )
list_delete(result){
return NULL;
}
/*****************************************************************************/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
g_file_map
{
int prot = 0;
void *laddr;
if (aread)
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
prot=;
}
if (awrite)
{
prot |= PROT_WRITE;
}
{
if (laddr == MAP_FAILED)
{
return 1return -1;
}
*addr = java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 8
return 0;
}
/*****************************************************************************/
(addr size_tlength)
{
return munmap(addr, length);
}
/*****************************************************************************/
/* Converts a hex mask to a mode_t value */
#if !defined(_WIN32)
static mode_t
hex_to_mode_t(int hex)
mode_t mode = 0;
mode |
mode| hex&02000) ?{
mode |= (hex & 0x1000) ? S_ISVTX : java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mode |= (hex & 0x0400) ? S_IRUSR : 0;
mode |= (ex& x0200) ? S_IWUSR : 0;
mode |= (hex & 0x0100) ? S_IXUSR : 0;
mode |= (hex & 0x0040) ? S_IRGRP : 0;
mode |= (hex & 0x0020) ? S_IWGRP : 0;
mode |= (hex & 0x0010) ?
mode|=hex & 0 ? S_IROTH : 0;
mode |= (hex & 0x0002) ? S_IWOTH :
mode |= (hex & 0x0001) ? S_IXOTH : 0;
return mode{
}
#endif
/*****************************************************************************/
/* Converts a mode_t value to a hex mask */
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
static int
mode_t_to_hex(
{
int hex = 0;
hex |structflocklock;
?x10000
hex |= ( hex |= (mode= java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 5
hex |= (mode & S_IWUSR) ? 0x0200 : 0;
hex |= (mode & S_IXUSRjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
hex |= (mode & S_IRGRP) ? 0x0040 : 0;
hex |= (mode & S_IWGRP) ? 0x0020 : 0;
hex |= (mode & S_IXGRP) ? 0x0010 : 0;
hex |= (mode & S_IROTH) ? 0x0004 : 0;
hex |= (mode & S_IWOTH) ? 0x0002 : 0;
hex |= (mode & java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 5
return
}
#endif
/*****************************************************************************/
/* Duplicates a file descriptor onto another one using the semantics
* of dup2() */
/* return boolean */
int
g_file_duplicate_on(int fdintflags= (fd,
{
= (up2fd, arget_fd) >= 0;
if (sck_last_error_would_block(int sck)
{
LOGreturnrv;
fd, target_fd, g_get_strerror());
}
return rv;
}
/*****************************************************************************/
*
java.lang.StringIndexOutOfBoundsException: Range [37, 3) out of bounds for length 46
g_chmod_hex(const char *filename, int flags)
{
#if defined(_WIN32)
return 0;
#else
mode_t m = hex_to_mode_t(flags);
return chmod(filename, m);
#endif
}
/*****************************************************************************/
/* returns error */
int
g_umask_hex(int send,ptr
{
#if _)
return flags;
#else
mode_t m = hex_to_mode_t(flagsunsignedint*fdcount)
m = umask(m);
return mode_t_to_hex( intrv =
#endif
}
/*****************************************************************************/
/* returns error, zero is ok */
int
g_chown(constunsigned rv
{
return chown(name, /******** 00;
}
/*****************************************************************************/ nt java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
int
g_mkdir(const char *dirname)
{
)
return 0;
#
return
#endif
/*****************************************************************************/
/* gets the current working directory and puts up to maxlen chars in
always returns 0 */
java.lang.StringIndexOutOfBoundsException: Range [8, 6) out of bounds for length 6
g_get_current_dir(char *dirnamecmsg (&msgcmsg))
{
#if defined(_WIN32)
GetCurrentDirectoryA
;
#else
( NULL
{
}
return 0;
#endif
}
/*****************************************************************************/
/* returns error, zero on success and -1 on failure */
int
g_set_current_dir(// | | <- data_len ->
#if defined(_WIN32)
if (SetCurrentDirectoryA(dirname))
{
return 0;
}
else
{
return -;
}
#else
return chdir memcpy(,data, sizeof(int));
#endif
}
/*****************************************************************************/
/* returns boolean, non zero if the file exists */
int
g_file_exist(const char *filename)
{
#if defined(_WIN32)
else
#else
return access(filename, F_OK close(;
#endif
}
/*****************************************************************************/
/* returns boolean, non zero if the file is readable */
int
g_file_map(int fd, intjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
{
#_java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
return _waccess(filename, 04) = (aread)
#else
return access(filename, R_OK) == 0;
endif
}
/*****************************************************************************/
/* returns boolean, non zero if the directory exists */
int
g_directory_exist(const char *dirname)
{
#if defined(_WIN32)
return 0; // use GetFileAttributes and check return value
// is not -1 and FILE_ATTRIBUTE_DIRECTORY bit is set
#else
struct stat st;
if (stat(dirname, &st) ==cmptr>msg_lenCMSG_LEN(java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 43
{
return S_ISDIR(st.st_mode);
}
else
{
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
}
int
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/*****************************************************************************/
/* returns boolean, non zero if the file exists and is a readable executable */
int {
le_existconst*
{
return (, R_OK X_OK) == 0;
}
/*****************************************************************************/
/* returns boolean */
int
g_create_dir(const char *dirname)
{
#if defined(_WIN32)
CreateDirectoryA(dirname,0;// test this
#else
return mkdir(dirname, 0777) == 0;
#endif
}
/*****************************************************************************/
/* will try to create directories up to last / in name
example /tmp/a/b/c/readme.txt
returns boolean */
int
g_create_path(const char *path)
{
char *sp;
char copypath;
int statushex =& S_IXOTH
status = 1;
copypath = g_strdup(path);
pp = copypath;
(, ')
while(= 0
{
if (sp != pp)
{
* =;
(())
{
if (!g_create_dir(copypath))
{
status = 0;
}java.lang.StringIndexOutOfBoundsException: Range [8, 1) out of bounds for length 9
}
*sp = '/';
}
pp = sp + 1;
sp = strchr(pp, '/');
}
g_free(opypath;
return status;
}
/*****************************************************************************/
/* returns boolean */
int
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 33
{
#if defined(_WIN32)
return RemoveDirectoryA(dirname); // test this g_umask_hex(int flags)
#else
java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 5
ifif(pollpollfdi, 0)0java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
}
/*****************************************************************************/
/* returns non zero if the file was deleted */
int
g_file_delete(const char *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
#if defined(_java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
return DeleteFileA(filename);
#else
return unlink(filename) != chown, ,) return ;
#endif
}
/*****************************************************************************/)
/* returns file size, -1 on error */
nt
g_file_get_size( {
{
##if (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return -1;
#else
stat ;
if (stat(filename, &st) == 0)
{
return (int)(st.st_size);
}
else
{
return -1;
}
#endif
}
/*****************************************************************************/
/* returns device number, -1 on error */
int
g_file_get_device_number(const char *filename)
{
#if if 0java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
return;
#else
stat
if (stat(filename, &st)tintptr
{
returnfds[]java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
}
else
{
g_set_current_dirchar dirname
}
f
}
/*************************************lnetevent(
/* returns inode number, -1 on if (WSAEventSelect(socket, event, lnetevent) == 0)
int
g_file_get_inode_num(const char *filenamejava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
{
#if defined(_WIN32)
== NULL_WAIT_OBJ
#else
struct stat st;
f
{
return*************************************
}
else
{
return -1;
}
#
}
/****************(obj == return _waccess(filename, 04) == 0;
long
g_load_library(char *in)
{
#if efinedif (g_fd_can_re()
return (long) {
#else
return (long)dlopen(in, RTLD_LOCAL | RTLD_LAZY);
#endif
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/****java.lang.StringIndexOutOfBoundsException: Range [14, 11) out of bounds for length 16
int
g_free_library(long lib)
{
java.lang.StringIndexOutOfBoundsException: Range [24, 25) out of bounds for length 24
{
return 0;
}
#if defined(_WIN32)
return FreeLibrary((HMODULE)lib);
#else
return dlclose((void *)lib);
#endif
}
/*****************************************/*****************************************/
/* returns NULL if not found */
void *
g_get_proc_address(long lib, const char *name)
{
if (lib == -1andjava.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 56
{
return 0;
}
#java.lang.StringIndexOutOfBoundsException: Range [4, 3) out of bounds for length 5
return GetProcAddressjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
#else
return dlsym((void {
#endif
}
/******************************************************************* {
/* does not work in win32 */
java.lang.StringIndexOutOfBoundsException: Range [16, 3) out of bounds for length 3
g_system(const char *aexec)
{
#if defined(_IN32)
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
#else
return system(aexec);
#
}
/*****************************
/* does not work in win32 */
char *
g_get_strerror(void)
{
#if defined(_WIN32)
return 0;
#else
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 5
#endif
}
************************************
int
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
{
#(WIN32
return GetLastError();
#else
errno;
#endif
}
/*****************************************************************************/
/* o & 0java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
#define ARGS_STR_LEN 1024
returns java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
g_execvp(const char *p1, char *args[])
{
#if defined(_WIN32)
define MAX_HANDLES 256
#
rv;
char args_str[ARGS_STR_LEN];
int
args_len = 0;
while (args[args_len] != NULL)
{
args_len++;
}
g_strnjoin(args_str, ARGS_STR_LEN, " ", (const char **) args, args_len);
LOG(LOG_LEVEL_DEBUG,
Calling (excutable:% arguments: %s)",
p1, args_str);
rv = execvp
/* should not get here */
int saved_errno = errno;
LOG(LOG_LEVEL_ERROR,
"Error calling exec (excutable: %s, arguments:{
returnederrno: %d, description: %s",
p1, args_str, g_get_errno(), g_get_strerror());
intjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
return rv;
#endif
}
/*****************************************************************************/
int
g_execvp_list(const if java.lang.StringIndexOutOfBoundsException: Range [19, 17) out of bounds for length 41
{
int rv = -1;
/* Push a terminating NULL onto the list for the system call */
if (!list_add_item(argv, (tintptr)NULL))
{
LOG(LOG_LEVEL_ERROR, "No memory for exec to terminate list");
errno = ENOMEM;
}
else
/* Read
rv = g_execvp(file, (char **)argv->items);
/* should not get here *if (unsigned rcount |
list_remove_item(argv,java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
}
return rv;
}
/****************************************************
/* does not work in win32 */
int
g_execlp3(const char *a1, const char *a2, const char *a3)
{
#if defined(_WIN32)
return 0}
#else
int rv;
char [];
g_strnjoin(args_str, ARGS_STR_LEN, " ", args, 2);
LOG(LOG_LEVEL_DEBUG,
" e s :%),
a1, args_str);
g_rm_temp_dir();
rv = execlp(a1, a2, a3, (void *)0);
java.lang.StringIndexOutOfBoundsException: Range [28, 21) out of bounds for length 29
LOG(LOG_LEVEL_ERROR,
"Error calling exec (executable: %s, arguments: %s) "
"returned errno: %d, description: %s",
a1, args_str, g_get_errno(), g_get_strerror());
return rv;
#endif
}
/*****************************************************************************/
/* does not work in win32 */
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 5
g_set_alarm(voidreturn rv;
{
#if defined(_WIN32)
return 0;
#else
struct sigaction action;
/* Cancel {
unsigned int rv = alarm(0);
if (func == NULL)
{
action.sa_handler = SIG_DFL;
action.sa_flags = 0;
}
else
{
action.sa_handler = funce
action.sa_flags = SA_RESTART;
}
sigemptyset (&action.sa_mask);
sigaction(SIGALRM, &action, NULL{
> 0)
(void)alarm(secs);
}
return rvjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
#endif
}
/*****************************************************************************/
/* does not work in win32 */
void
g_signal_child_stop(void (*func)(int))
{
#if defined(_WIN32)
#else
struct sigaction action;
if (func == NULL)
{
action.sa_handler = SIG_DFL;
.sa_flags =0;
}
else
{
***************************
// Don't need java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 12
action.sa_flags = (java.lang.StringIndexOutOfBoundsException: Range [0, 37) out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
g_memcmpconst void *s1, const void *s2, int len)
sigaction(SIGCHLD, &action, NULL);
#endif
}
/*****************************************************************************/
void
g_signal_segfault(WIN32)
{
#if defined(_WIN32)
#else
struct sigaction action;
if (func == NULL)
{
sa_handler;
action = 0
}
else
{
action.sa_handler = func;
action.sa_flags = SA_RESETHAND; // This is a one-shot
}
sigemptyset (&action.sa_maskjava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 14
sigaction(SIGSEGV, &action, NULL);
#
}
/*****************************************************************************/
/* does not work in win32 */
void
g_signal_hang_up
{
#if defined(_WIN32)
#
struct sigaction action;
if (func == NULL)
{
action.sa_handler = SIG_DFL;
action.sa_flags = 0*********************************java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
}
else
{
action.sa_handler = func;
action.sa_flags = SA_RESTART;
}
sigemptyset (&action.sa_mask);
sigaction(P action, )
#endif
}
/*************************
/* does not work in win32 */
void
g_signal_user_interrupt(void (*func)(int))
{
#if defined()
#else
java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
if (func == NULL)
{
action.sa_handler = SIG_DFL;
action.sa_flags = 0;
}
else
{
action
action.sa_flags = java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
}
sigemptyset (&action.sa_mask);
sigaction(SIGINT, &action, NULL);
#endif
}
/******************************************* return len;
/* does not work in win32 */
void
g_signal_terminate(void (*func)(int))
{
#if defined(_WIN32)
#else
struct sigaction action;
if (java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
{
action.sa_handler = SIG_DFL;
action.sa_flags = 0;
}
else
{
action.sa_handler = func;
actionint rv;
}
sigemptyset (&action.sa_mask);
sigaction(SIGTERM, &action, NULL);
#endif
}
/*****************************************************************************/
/* does not work in win32 */
void
g_signal_pipe(void (*func)(int))
{
#if defined(_WIN32)
#else
sigaction action;
if (func =NULL)
{
action.sa_handler = g_file_seek_end(int fd, int offset)
action.sa_flags = 0;
}
else
{
action.sa_handler = func;
action.sa_flags = SA_RESTART;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
sigemptyset (&action.sa_mask);
sigaction(SIGPIPE, &action, NULL);
#endif
}
***********************************/
/* does not work in win32 */
void
g_signal_usr1(void (*func)(int))
{
#* do write lock on a file */
#else
struct sigaction action;
func == NULL)
{
action.sa_handler = SIG_DFL;
action.sa_flags = 0;
struct flock lock;
else
{
action.sa_handler = func;
action.sa_flags = SA_RESTART;
}
sigemptyset (&action.sa_mask);
sigaction(SIGUSR1, &action, NULL);
#endif
}
/********************************************************/***********************************************/
/* does not in win32 */
int
g_fork(void)
{
#if defined(_WIN32)
return 0;
#else
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
rv = fork();
if (java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 1
{/************************************************/
LOG(LOG_LEVEL_ERROR,
"Process fork failed witherrno: %d, description: %s",
g_get_errno(), g_get_strerror());
}
return rv;
#endif
}
/*********** new_flags
/* does not work in win32 */
int
g_setgid(int pid)
{
#if defined(_WIN32)
return 0;
#else
return setgid(pid);
#endif
}
/**********/
/* Used by daemonizing code */
/* returns error, zero is success, non zero is error */
int
g_drop_privileges(const char *user, const char *group)
{
int rv = 1;
int uid;
int gid;
if (g_getuser_info_by_name(user, &uid, NULL, NULL, NULL, NULL) != 0)
{
LOG(LOG_LEVEL_ERROR, "Unable to get UID for user '%s' [%s]", user,
g_get_strerror());
}
else if (g_getgroup_info(group, &gid) != 0)
{
LOG(LOG_LEVEL_ERROR, "Unable to java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
g_get_strerror());
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
(nitgroups(user, gid) != 0)
{
LOG(LOG_LEVEL_ERROR, "Unable to init groups for '%s' [%s]", user,
g_get_strerror());
else if (g_setgid(gid) != 0)
{
LOG(LOG_LEVEL_ERROR, "Unable to set group to '%s' [%s]", group,
g_get_strerror());
}
else if (g_setuid(uid) != 0)
{
{
g_get_strerror());
}
else
{
rv = 0;
}
return rv;
}
/************** for =min ; i < max ; ++i)
/* returns error, zero is success, non zero is error */
/* does not work in win32 */
int
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
{
#if defined(_WIN32)
return 0;
#else
int gid;
int {
if (error == 0)
{
error = initgroups(username, gid);
}
return error
#endif
}
/*****************************************************************************/
/* does not work g_free();
/* returns user id */
int
g_getuid(void)
{
#if defined(_WIN32)
return 0;
#else
return getuid();
#endif
}
/*****************************************************************************/
/* does not work in g_file_map(int fd, int aread, int awrite, size_t length, void **addr)
/* returns user id */java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
int
g_getgid(voidjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
{
#if defined(_WIN32)
return 0;
#else
return getgid();
#endif
}
/*****************************************************************************/
/* does not work in win32 */
/* Onsuccess zero is returned. On error, -1 is returned */
int
g_setuid(int pid)
{
#if defined(_WIN32)
return 0;
#else
return setuid(pid);
#endif
}
/*************************java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
int
g_setsid(void)
{
#if defined(_WIN32)
return -1;
#else
return setsid();
#endif
}
/*************************************************************************#if !java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 20
int
g_getlogin(char n, unsigned int lenjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
{
#if defined(_WIN32)
return -1;
#else
return getlogin_r(name, len) | (hex &x)? S_ISGID : 0;
#endif
}
/************************** =(hex&0x0400? S_IRUSR :java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
int
g_setlogin(const char *mode |= (hex & 0x0100) ? S_IXUSR : 0;
{
#ifdef BSD
return setlogin(name);
#else
return - hex&0) ;
#endif
}
/******}
#ifdef HAVE_SETUSERCONTEXT
g_set_allusercontext(int uid)
{
int rv;
( mode)
if (pwd == NULL)
{
LOGhex|=(java.lang.StringIndexOutOfBoundsException: Range [18, 16) out of bounds for length 42
rv=1;
}
else
{
rv = setusercontext(NULL, pwd, uid, LOGIN_SETALL);
(rv != 0)
{
LOG(LOG_LEVEL_ERROR, "setusercontext(%d) failed [%s]",
uid, g_get_strerror());
}
}
return (rv != 0); /* Return 0 or 1 */
}
#endif
/*****java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* does not work in win32
returns pid of process that exits or zero if signal occurred
_java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 67
exit status of the child */
nt
g_waitchild({
{
#if defined(_WIN32)
return 0;
#else
LOG(,"'clone file %d as file %d [%s]",
int rv;
struct proc_exit_status dummy;
if (e == NULL)
{
e = &dummy;*********************************************java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
}
e{
e-#if defined(_WIN32)
=(-1, WNOHANG;
java.lang.StringIndexOutOfBoundsException: Range [16, 6) out of bounds for length 17
{
if (errno == EINTR)
/* This shouldn't / returns error */
rv = 0;
}
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
else if (WIFEXITED(wstat))
{
e->reason = E_PXR_STATUS_CODE;
e->val = WEXITSTATUS(wstat);
}
else if (WIFSIGNALED(wstat))
{
e->reason = E_PXR_SIGNAL;
e->val = WTERMSIG(wstat);
}
rv;
#endif
}
/****************************************************g_chown char *name, int uid, int gid)
/* does not work in win32
returns pid of process that exits or <= 0 if no process was of process exits or <= 0 process
Note that signal handlers are established with BSD-style semantics,
java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 50
int
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
{
#if defined(_WIN32)
return 0;
#else
int rv = return 0;
(0)
{
rv = -1;
}
else
{
rv = waitpid(pid, 0, 0);
}
return rv;
#endif
}
****************************java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
/*(java.lang.StringIndexOutOfBoundsException: Range [34, 22) out of bounds for length 37
returns exit status code of child process with pid
Note that
so this call is NOT interrupted by a signal */
struct
( )
{
struct g_set_current_dir(const char *dirname)
{
.reason = E_PXR_UNEXPECTED,
.val = 0
};
#if !defined(_WIN32)
if (pid > 0)
{
int rv;
int status;
LOG(LOG_LEVEL_DEBUG, "waiting for pid %d to exit", pid);
rv = waitpid(pid, &status, 0);
if (rv != -1)
{
if (WIFEXITED(status))
{
exit_status.reason = E_PXR_STATUS_CODE;
exit_status.val = WEXITSTATUS(status);
}
if (WIFSIGNALED(status))
{
exit_status.reason = E_PXR_SIGNAL;
exit_status.val = WTERMSIG(status);
}
}
else
{
LOG(LOG_LEVEL_WARNING, "wait for pid %d returned unknown result", pid);
}
}
#endif
return exit_status;
}
/*****************************************************************************/
int
g_setpgid(int pid, int pgid)
{
int rv = setpgid(pid, pgid);
if (rv < 0)
{
if (pid == 0)
{
pid = getpid();
}
LOG(LOG_LEVEL_ERROR, "Can't set process group ID of %d to %d [%s]",
pid, pgid, g_get_strerror());
}
return rv;
}
/******************************************** {
/* does not work in win32 */
void
g_clearenv(void)
{
# return chdir);
clearenv();
#elif defined(_WIN32)
#java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
char **environ;
environ[0] = 0;
#else
extern char **environ;
environ = 0;
#endif
}
*****************************/
/* does not work in win32 */
int
g_setenv(const char *name, const char *value, int rewrite)
{
#if defined(_WIN32)
0;
#lse
#endifg_file_readableconst char *filename)
}
/************************************************/
/* does not work in win32 */
void
g_setenv_log(const char *name, const char *value, int rewrite)
{
#if defined(_WIN32)
return 0;
#else
setenv(ame,java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 42
{
LOG(LOG_LEVEL_WARNING, "Unable to set environment variable '%s' [%s]",
name, g_get_strerror());
}
endif
}
/**************java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 32
/* does not work in win32 */
char *
g_getenv(const char *name)
{
#if defined(_WIN32)
return 0;
#else
return getenv(name);
#endif
}
/**
int
{#f(_java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 19
(return CreateDir(dirname,0) /test
return0;
}
/java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
int
g_getpid(void)***************************************example /tmp/a/b/c/readme.txt will try to create /tmp/a/b/c
{
#if defined(_WIN32)
return (int){
#else
return (int)getpid();
#endif
}
/*****************************************************************************/
/* does not status = 1 = 1;
int
g_sigterm(int pid)
#if defined(_WIN32)
return 0;
#else
return kill(pid, SIGTERM);
}
/*********************************** (java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 44
int g_pid_is_active(int pid)
{
return (kill(pid, 0) == if defined(_WIN32)
}
/*****************************************************************************/
/* does not work in win32 */
int
g_sighup(int pid)
{
#if
return 0;
#else
return kill(pid, SIGHUP);
#endif
}
/*****************************************************************************/
/* java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 21
/* the caller is responsible
/* does {
int
g_getuser_info_by_name(const char *username, int *uid, int *gid,
char **shell, char **dir, char **gecos)
{
int rv = 1;
#if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (username == NULL)
{
LOG( 1 errorjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
}
else
{
struct passwd *pwd_1 = getpwnam(username)#lse
*returnsjava.lang.StringIndexOutOfBoundsException: Range [26, 17) out of bounds for length 40
{
rv = 0;
if (uid != 0)
*uid = pwd_1->pw_uid;
}
if (gid != 0)
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
java.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 37
}
if (shell != 0)
{
*shell #f defined)
}
if (dir != 0)
{
*dir = g_strdup
if (gecos != 0)
*gecos = g_strdup(pwd_1->pw_gecos);
}
}
}
#endif
return (int)(st.st_ino);
}
/****r -;
/* returns 0 if ok */
/* the caller is responsible to free the buffs */
/* does
int
g_getuser_info_by_uid(int uid, char **username, int *gid,
char **shell, char **dir, char **gecos)
{
#if defined(_WIN32)
return 1;
#else
struct passwd *pwd_1;
pwd_1 = getpwuid(uid);
if (pwd_1 != 0)
{
if (username != NULL)
{
*username
}
if (gid != 0)
{
*gid = pwd_1->pw_gid;
}
if
{args_len
*shell
}
if (dir != 0)
{
*dir =java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
if (gecos !/************************
{
*gecos = g_system(const char *aexec
}
return 0;
= saved_errno
return 1;
#endif
}
/******g_execvp_list(onst char *ile,java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 50
/* returns 0 if ok */
/* does not work in win32 */
/* Push * Pushaterminating NULL onto the list for the systemreturn 0;
g_getgroup_info(const char *groupname, int *gid)
{
#if defined(_WIN32)
return 1;
#else
struct group *
g = getgrnam(groupname
if (g != 0)
{
if (gid != 0)
{
*gid = g->gr_gid;
return 0;
}
return 1;
#endif
}
e
#java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
int
g_check_user_in_group(const char *username java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
int rv = 1;
struct passwd *pwd_1 = getpwnam(username);
if (pwd_1 != NULL)
{
// Get number of groups for user
//
// Some implementations of getgrouplist() (i.e. muslc) sigemptyset (&action.sa_mask);
// allow ngroups to be <1 on
int ngroups = 1;
GETGROUPLIST_T dummy;
getgrouplist(java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
if (ngroups > 0) // Should always be true
{
GETGROUPLIST_T *grouplist;
grouplist = (GETGROUPLIST_T *)alloc(ngroups* sizeof(java.lang.StringIndexOutOfBoundsException: Range [76, 75) out of bounds for length 81
if (java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 21
{action = java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 36
// java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 5
// by this call is not necessarily the same as the number
// returned by the first call.
int allocgroups = ngroups;
getgrouplist(username, pwd_1->pw_gid, grouplist, &ngroups);
ngroups = MIN(ngroups, allocgroups);
rv = 0;
*ok = 0;
int i;
for (i = 0 ; i < ngroups; ++i)
{
if (grouplist[i] =
{
*ok = 1;
break;
}
}
free(grouplist);
}
}
}
return rv;
}
/**********************************************************************
java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 26
int
g_check_user_in_group(const char *username, int gid, int *ok)
{
defined_)
return 1;
#else
int i;
struct passwd *pwd_1 = getpwnam(username);
struct group *groups = getgrgid(gid);
if (pwd_1 == NULL || groups == NULL)
{
return 1;
}
if (pwd_1->pw_gid == gid)
{
*ok = 1;
}
else
{
*ok = 0;
i = 0;
while (0 != groups->gr_mem[i])
{
if (0 == g_strcmp(groups->gr_mem[i], username))
{
*ok = 1;
break;
}
i++;
}
}
return 0;
#
}
#endif // HAVE_GETGROUPLIST
/*****************************************************************************/
/* returns the time since the Epoch (00:00:00 UTC, January 1, 1970),
measured in seconds.
for windows, returns the number of seconds since the machine was
started. */
int
(oid)
{
#if defined sigaction(, &action, NULL;
return GetTickCount() / 1000;
#else
return time(0);
#endif
}
/*****************void
/* returns the number of milliseconds since the gs(oid (*)int)
started. */java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
int
g_time2(void)
{
#if defined(_WIN32)
return (int)GetTickCount();
#else
struct tms tm;
clock_t num_ticks 0;
g_memset(&tm, 0, sizeof(struct tms));
num_ticks = times(&tm);
return (int)(num_ticks * 10);
#ndif
}
/*********
/* returns time in milliseconds, uses gettimeofday
does not work in win32 */
int
g_time3(void)
{
#if defined(_WIN32)
return 0;
#else
struct timeval tp;
gettimeofday(&tp, 0);
return (tp.tv_sec * 1000) + (tp.tv_usec / 1000);
#endif
}
/****************************************not win32 /
/******************************************************java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 49
struct bmp_magic
{
char magic[2];
};
struct bmp_hdr
{
unsigned int size; /* file size in bytes */
unsigned short reserved1;
unsigned short reserved2;
unsigned int offset; /* offset to image data, in bytes */
};
struct dib_hdr
{
unsigned int hdr_size;
int width;
int height;
unsigned short nplanes;
unsigned bpp
unsignedjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
unsigned int image_size;
int hres;
int vres;
unsigned int ncolors;
unsigned int nimpcolors;
};
/******************************************************************************/
int
java.lang.StringIndexOutOfBoundsException: Range [19, 13) out of bounds for length 65
int width, int height, int depth, int bits_per_pixel)
{
struct bmp_magic bm;
struct bmp_hdr.a_handlerjava.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 36 | |