idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
8,800 | push_compress_filter2(IOBUF out,compress_filter_context_t *zfx,
int algo,int rel)
{
if(algo>=0)
zfx->algo=algo;
else
zfx->algo=DEFAULT_COMPRESS_ALGO;
switch(zfx->algo)
{
case COMPRESS_ALGO_NONE:
break;
case COMPRESS_ALGO_ZIP:
case COMPRESS_ALGO_ZLIB:
iobuf_push_filter... | DoS | 0 | push_compress_filter2(IOBUF out,compress_filter_context_t *zfx,
int algo,int rel)
{
if(algo>=0)
zfx->algo=algo;
else
zfx->algo=DEFAULT_COMPRESS_ALGO;
switch(zfx->algo)
{
case COMPRESS_ALGO_NONE:
break;
case COMPRESS_ALGO_ZIP:
case COMPRESS_ALGO_ZLIB:
iobuf_push_filter... | @@ -161,7 +161,8 @@ do_uncompress( compress_filter_context_t *zfx, z_stream *zs,
IOBUF a, size_t *ret_len )
{
int zrc;
- int rc=0;
+ int rc = 0;
+ int leave = 0;
size_t n;
int nread, count;
int refill = !zs->avail_in;
@@ -179,13 +180,14 @@ do_uncompress( compress_filter_cont... | CWE-20 | null | null |
8,801 | release_context (compress_filter_context_t *ctx)
{
xfree (ctx);
}
| DoS | 0 | release_context (compress_filter_context_t *ctx)
{
xfree (ctx);
}
| @@ -161,7 +161,8 @@ do_uncompress( compress_filter_context_t *zfx, z_stream *zs,
IOBUF a, size_t *ret_len )
{
int zrc;
- int rc=0;
+ int rc = 0;
+ int leave = 0;
size_t n;
int nread, count;
int refill = !zs->avail_in;
@@ -179,13 +180,14 @@ do_uncompress( compress_filter_cont... | CWE-20 | null | null |
8,802 | static NTSTATUS check_guest_password(auth_serversupplied_info **server_info)
{
struct auth_context *auth_context;
auth_usersupplied_info *user_info = NULL;
NTSTATUS nt_status;
unsigned char chal[8];
ZERO_STRUCT(chal);
DEBUG(3,("Got anonymous request\n"));
if (!NT_STATUS_IS_OK(nt_status = make_auth_context_fi... | DoS Overflow | 0 | static NTSTATUS check_guest_password(auth_serversupplied_info **server_info)
{
struct auth_context *auth_context;
auth_usersupplied_info *user_info = NULL;
NTSTATUS nt_status;
unsigned char chal[8];
ZERO_STRUCT(chal);
DEBUG(3,("Got anonymous request\n"));
if (!NT_STATUS_IS_OK(nt_status = make_auth_context_fi... | @@ -1213,7 +1213,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", blob1.data, blob1.length);
#endif
- p2 = (char *)req->buf + data_blob_len;
+ p2 = (char *)req->buf + blob1.length;
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,... | CWE-119 | null | null |
8,803 | static NTSTATUS check_spnego_blob_complete(struct smbd_server_connection *sconn,
uint16 smbpid, uint16 vuid,
DATA_BLOB *pblob)
{
struct pending_auth_data *pad = NULL;
ASN1_DATA *data;
size_t needed_len = 0;
pad = get_pending_auth_data(sconn, smbpid);
/* Ensure we have some data. */
if (pblob->le... | DoS Overflow | 0 | static NTSTATUS check_spnego_blob_complete(struct smbd_server_connection *sconn,
uint16 smbpid, uint16 vuid,
DATA_BLOB *pblob)
{
struct pending_auth_data *pad = NULL;
ASN1_DATA *data;
size_t needed_len = 0;
pad = get_pending_auth_data(sconn, smbpid);
/* Ensure we have some data. */
if (pblob->le... | @@ -1213,7 +1213,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", blob1.data, blob1.length);
#endif
- p2 = (char *)req->buf + data_blob_len;
+ p2 = (char *)req->buf + blob1.length;
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,... | CWE-119 | null | null |
8,804 | static void delete_partial_auth(struct smbd_server_connection *sconn,
struct pending_auth_data *pad)
{
if (!pad) {
return;
}
DLIST_REMOVE(sconn->smb1.pd_list, pad);
data_blob_free(&pad->partial_data);
SAFE_FREE(pad);
}
| DoS Overflow | 0 | static void delete_partial_auth(struct smbd_server_connection *sconn,
struct pending_auth_data *pad)
{
if (!pad) {
return;
}
DLIST_REMOVE(sconn->smb1.pd_list, pad);
data_blob_free(&pad->partial_data);
SAFE_FREE(pad);
}
| @@ -1213,7 +1213,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", blob1.data, blob1.length);
#endif
- p2 = (char *)req->buf + data_blob_len;
+ p2 = (char *)req->buf + blob1.length;
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,... | CWE-119 | null | null |
8,805 | static struct pending_auth_data *get_pending_auth_data(
struct smbd_server_connection *sconn,
uint16_t smbpid)
{
struct pending_auth_data *pad;
/*
* NOTE: using the smbpid here is completely wrong...
* see [MS-SMB]
* 3.3.5.3 Receiving an SMB_COM_SESSION_SETUP_ANDX Request
*/
for (pad = sconn->smb1... | DoS Overflow | 0 | static struct pending_auth_data *get_pending_auth_data(
struct smbd_server_connection *sconn,
uint16_t smbpid)
{
struct pending_auth_data *pad;
/*
* NOTE: using the smbpid here is completely wrong...
* see [MS-SMB]
* 3.3.5.3 Receiving an SMB_COM_SESSION_SETUP_ANDX Request
*/
for (pad = sconn->smb1... | @@ -1213,7 +1213,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", blob1.data, blob1.length);
#endif
- p2 = (char *)req->buf + data_blob_len;
+ p2 = (char *)req->buf + blob1.length;
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,... | CWE-119 | null | null |
8,806 | NTSTATUS parse_spnego_mechanisms(DATA_BLOB blob_in,
DATA_BLOB *pblob_out,
char **kerb_mechOID)
{
char *OIDs[ASN1_MAX_OIDS];
int i;
NTSTATUS ret = NT_STATUS_OK;
*kerb_mechOID = NULL;
/* parse out the OIDs and the first sec blob */
if (!parse_negTokenTarg(blob_in, OIDs, pblob_out)) {
return NT_STATUS_LOGON_... | DoS Overflow | 0 | NTSTATUS parse_spnego_mechanisms(DATA_BLOB blob_in,
DATA_BLOB *pblob_out,
char **kerb_mechOID)
{
char *OIDs[ASN1_MAX_OIDS];
int i;
NTSTATUS ret = NT_STATUS_OK;
*kerb_mechOID = NULL;
/* parse out the OIDs and the first sec blob */
if (!parse_negTokenTarg(blob_in, OIDs, pblob_out)) {
return NT_STATUS_LOGON_... | @@ -1213,7 +1213,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", blob1.data, blob1.length);
#endif
- p2 = (char *)req->buf + data_blob_len;
+ p2 = (char *)req->buf + blob1.length;
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,... | CWE-119 | null | null |
8,807 | static int push_signature(uint8 **outbuf)
{
char *lanman;
int result, tmp;
result = 0;
tmp = message_push_string(outbuf, "Unix", STR_TERMINATE);
if (tmp == -1) return -1;
result += tmp;
if (asprintf(&lanman, "Samba %s", samba_version_string()) != -1) {
tmp = message_push_string(outbuf, lanman, STR_TERMINAT... | DoS Overflow | 0 | static int push_signature(uint8 **outbuf)
{
char *lanman;
int result, tmp;
result = 0;
tmp = message_push_string(outbuf, "Unix", STR_TERMINATE);
if (tmp == -1) return -1;
result += tmp;
if (asprintf(&lanman, "Samba %s", samba_version_string()) != -1) {
tmp = message_push_string(outbuf, lanman, STR_TERMINAT... | @@ -1213,7 +1213,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", blob1.data, blob1.length);
#endif
- p2 = (char *)req->buf + data_blob_len;
+ p2 = (char *)req->buf + blob1.length;
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,... | CWE-119 | null | null |
8,808 | void reply_sesssetup_and_X(struct smb_request *req)
{
int sess_vuid;
int smb_bufsize;
DATA_BLOB lm_resp;
DATA_BLOB nt_resp;
DATA_BLOB plaintext_password;
char *tmp;
const char *user;
fstring sub_user; /* Sainitised username for substituion */
const char *domain;
const char *native_os;
const char *native_lanm... | DoS Overflow | 0 | void reply_sesssetup_and_X(struct smb_request *req)
{
int sess_vuid;
int smb_bufsize;
DATA_BLOB lm_resp;
DATA_BLOB nt_resp;
DATA_BLOB plaintext_password;
char *tmp;
const char *user;
fstring sub_user; /* Sainitised username for substituion */
const char *domain;
const char *native_os;
const char *native_lanm... | @@ -1213,7 +1213,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", blob1.data, blob1.length);
#endif
- p2 = (char *)req->buf + data_blob_len;
+ p2 = (char *)req->buf + blob1.length;
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,... | CWE-119 | null | null |
8,809 | static void reply_sesssetup_blob(struct smb_request *req,
DATA_BLOB blob,
NTSTATUS nt_status)
{
if (!NT_STATUS_IS_OK(nt_status) &&
!NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
reply_nterror(req, nt_status_squash(nt_status));
return;
}
nt_status = nt_status_squash(nt_status);... | DoS Overflow | 0 | static void reply_sesssetup_blob(struct smb_request *req,
DATA_BLOB blob,
NTSTATUS nt_status)
{
if (!NT_STATUS_IS_OK(nt_status) &&
!NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
reply_nterror(req, nt_status_squash(nt_status));
return;
}
nt_status = nt_status_squash(nt_status);... | @@ -1213,7 +1213,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", blob1.data, blob1.length);
#endif
- p2 = (char *)req->buf + data_blob_len;
+ p2 = (char *)req->buf + blob1.length;
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,... | CWE-119 | null | null |
8,810 | static void reply_spnego_auth(struct smb_request *req,
uint16 vuid,
DATA_BLOB blob1,
AUTH_NTLMSSP_STATE **auth_ntlmssp_state)
{
DATA_BLOB auth = data_blob_null;
DATA_BLOB auth_reply = data_blob_null;
DATA_BLOB secblob = data_blob_null;
NTSTATUS status = NT_STATUS_LOGON_FAILURE;
struct sm... | DoS Overflow | 0 | static void reply_spnego_auth(struct smb_request *req,
uint16 vuid,
DATA_BLOB blob1,
AUTH_NTLMSSP_STATE **auth_ntlmssp_state)
{
DATA_BLOB auth = data_blob_null;
DATA_BLOB auth_reply = data_blob_null;
DATA_BLOB secblob = data_blob_null;
NTSTATUS status = NT_STATUS_LOGON_FAILURE;
struct sm... | @@ -1213,7 +1213,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", blob1.data, blob1.length);
#endif
- p2 = (char *)req->buf + data_blob_len;
+ p2 = (char *)req->buf + blob1.length;
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,... | CWE-119 | null | null |
8,811 | static void reply_spnego_downgrade_to_ntlmssp(struct smb_request *req,
uint16 vuid)
{
DATA_BLOB response;
reply_outbuf(req, 4, 0);
SSVAL(req->outbuf,smb_uid,vuid);
DEBUG(3,("reply_spnego_downgrade_to_ntlmssp: Got krb5 ticket in SPNEGO "
"but set to downgrade to NTLMSSP\n"));
response = spnego_gen... | DoS Overflow | 0 | static void reply_spnego_downgrade_to_ntlmssp(struct smb_request *req,
uint16 vuid)
{
DATA_BLOB response;
reply_outbuf(req, 4, 0);
SSVAL(req->outbuf,smb_uid,vuid);
DEBUG(3,("reply_spnego_downgrade_to_ntlmssp: Got krb5 ticket in SPNEGO "
"but set to downgrade to NTLMSSP\n"));
response = spnego_gen... | @@ -1213,7 +1213,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", blob1.data, blob1.length);
#endif
- p2 = (char *)req->buf + data_blob_len;
+ p2 = (char *)req->buf + blob1.length;
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,... | CWE-119 | null | null |
8,812 | static void reply_spnego_kerberos(struct smb_request *req,
DATA_BLOB *secblob,
const char *mechOID,
uint16 vuid,
bool *p_invalidate_vuid)
{
TALLOC_CTX *mem_ctx;
DATA_BLOB ticket;
char *client, *p, *domain;
fstring netbios_domain_name;
struct passwd *pw;
fstring user;
int sess_vuid = req->... | DoS Overflow | 0 | static void reply_spnego_kerberos(struct smb_request *req,
DATA_BLOB *secblob,
const char *mechOID,
uint16 vuid,
bool *p_invalidate_vuid)
{
TALLOC_CTX *mem_ctx;
DATA_BLOB ticket;
char *client, *p, *domain;
fstring netbios_domain_name;
struct passwd *pw;
fstring user;
int sess_vuid = req->... | @@ -1213,7 +1213,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", blob1.data, blob1.length);
#endif
- p2 = (char *)req->buf + data_blob_len;
+ p2 = (char *)req->buf + blob1.length;
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,... | CWE-119 | null | null |
8,813 | static void reply_spnego_negotiate(struct smb_request *req,
uint16 vuid,
DATA_BLOB blob1,
AUTH_NTLMSSP_STATE **auth_ntlmssp_state)
{
DATA_BLOB secblob;
DATA_BLOB chal;
char *kerb_mech = NULL;
NTSTATUS status;
struct smbd_server_connection *sconn = smbd_server_conn;
status = parse_spnego_mech... | DoS Overflow | 0 | static void reply_spnego_negotiate(struct smb_request *req,
uint16 vuid,
DATA_BLOB blob1,
AUTH_NTLMSSP_STATE **auth_ntlmssp_state)
{
DATA_BLOB secblob;
DATA_BLOB chal;
char *kerb_mech = NULL;
NTSTATUS status;
struct smbd_server_connection *sconn = smbd_server_conn;
status = parse_spnego_mech... | @@ -1213,7 +1213,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", blob1.data, blob1.length);
#endif
- p2 = (char *)req->buf + data_blob_len;
+ p2 = (char *)req->buf + blob1.length;
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,... | CWE-119 | null | null |
8,814 | static void reply_spnego_ntlmssp(struct smb_request *req,
uint16 vuid,
AUTH_NTLMSSP_STATE **auth_ntlmssp_state,
DATA_BLOB *ntlmssp_blob, NTSTATUS nt_status,
const char *OID,
bool wrap)
{
DATA_BLOB response;
struct auth_serversupplied_info *server_info = NULL;
struct smbd_server_connection *s... | DoS Overflow | 0 | static void reply_spnego_ntlmssp(struct smb_request *req,
uint16 vuid,
AUTH_NTLMSSP_STATE **auth_ntlmssp_state,
DATA_BLOB *ntlmssp_blob, NTSTATUS nt_status,
const char *OID,
bool wrap)
{
DATA_BLOB response;
struct auth_serversupplied_info *server_info = NULL;
struct smbd_server_connection *s... | @@ -1213,7 +1213,7 @@ static void reply_sesssetup_and_X_spnego(struct smb_request *req)
file_save("negotiate.dat", blob1.data, blob1.length);
#endif
- p2 = (char *)req->buf + data_blob_len;
+ p2 = (char *)req->buf + blob1.length;
p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,... | CWE-119 | null | null |
8,815 | void add_to_common_flags2(uint32 v)
{
common_flags2 |= v;
}
| DoS | 0 | void add_to_common_flags2(uint32 v)
{
common_flags2 |= v;
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,816 | static void construct_reply(char *inbuf, int size, size_t unread_bytes,
uint32_t seqnum, bool encrypted,
struct smb_perfcount_data *deferred_pcd)
{
connection_struct *conn;
struct smb_request *req;
if (!(req = talloc(talloc_tos(), struct smb_request))) {
smb_panic("could not allocate smb_request");
... | DoS | 0 | static void construct_reply(char *inbuf, int size, size_t unread_bytes,
uint32_t seqnum, bool encrypted,
struct smb_perfcount_data *deferred_pcd)
{
connection_struct *conn;
struct smb_request *req;
if (!(req = talloc(talloc_tos(), struct smb_request))) {
smb_panic("could not allocate smb_request");
... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,817 | void construct_reply_common_req(struct smb_request *req, char *outbuf)
{
construct_reply_common(req, (char *)req->inbuf, outbuf);
}
| DoS | 0 | void construct_reply_common_req(struct smb_request *req, char *outbuf)
{
construct_reply_common(req, (char *)req->inbuf, outbuf);
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,818 | static bool create_outbuf(TALLOC_CTX *mem_ctx, struct smb_request *req,
const char *inbuf, char **outbuf, uint8_t num_words,
uint32_t num_bytes)
{
/*
* Protect against integer wrap
*/
if ((num_bytes > 0xffffff)
|| ((num_bytes + smb_size + num_words*2) > 0xffffff)) {
char *msg;
if ... | DoS | 0 | static bool create_outbuf(TALLOC_CTX *mem_ctx, struct smb_request *req,
const char *inbuf, char **outbuf, uint8_t num_words,
uint32_t num_bytes)
{
/*
* Protect against integer wrap
*/
if ((num_bytes > 0xffffff)
|| ((num_bytes + smb_size + num_words*2) > 0xffffff)) {
char *msg;
if ... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,819 | static bool deadtime_fn(const struct timeval *now, void *private_data)
{
struct smbd_server_connection *sconn = smbd_server_conn;
if ((conn_num_open(sconn) == 0)
|| (conn_idle_all(sconn, now->tv_sec))) {
DEBUG( 2, ( "Closing idle connection\n" ) );
messaging_send(smbd_messaging_context(), procid_self(),
... | DoS | 0 | static bool deadtime_fn(const struct timeval *now, void *private_data)
{
struct smbd_server_connection *sconn = smbd_server_conn;
if ((conn_num_open(sconn) == 0)
|| (conn_idle_all(sconn, now->tv_sec))) {
DEBUG( 2, ( "Closing idle connection\n" ) );
messaging_send(smbd_messaging_context(), procid_self(),
... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,820 | struct idle_event *event_add_idle(struct event_context *event_ctx,
TALLOC_CTX *mem_ctx,
struct timeval interval,
const char *name,
bool (*handler)(const struct timeval *now,
void *private_data),
void *private_data)
{
struct idle_event *result;
struct timeval now = timeval_current... | DoS | 0 | struct idle_event *event_add_idle(struct event_context *event_ctx,
TALLOC_CTX *mem_ctx,
struct timeval interval,
const char *name,
bool (*handler)(const struct timeval *now,
void *private_data),
void *private_data)
{
struct idle_event *result;
struct timeval now = timeval_current... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,821 | static void fixup_chain_error_packet(struct smb_request *req)
{
uint8_t *outbuf = req->outbuf;
req->outbuf = NULL;
reply_outbuf(req, 2, 0);
memcpy(req->outbuf, outbuf, smb_wct);
TALLOC_FREE(outbuf);
SCVAL(req->outbuf, smb_vwv0, 0xff);
}
| DoS | 0 | static void fixup_chain_error_packet(struct smb_request *req)
{
uint8_t *outbuf = req->outbuf;
req->outbuf = NULL;
reply_outbuf(req, 2, 0);
memcpy(req->outbuf, outbuf, smb_wct);
TALLOC_FREE(outbuf);
SCVAL(req->outbuf, smb_vwv0, 0xff);
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,822 | struct pending_message_list *get_open_deferred_message(uint16 mid)
{
struct pending_message_list *pml;
for (pml = deferred_open_queue; pml; pml = pml->next) {
if (SVAL(pml->buf.data,smb_mid) == mid) {
return pml;
}
}
return NULL;
}
| DoS | 0 | struct pending_message_list *get_open_deferred_message(uint16 mid)
{
struct pending_message_list *pml;
for (pml = deferred_open_queue; pml; pml = pml->next) {
if (SVAL(pml->buf.data,smb_mid) == mid) {
return pml;
}
}
return NULL;
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,823 | static bool housekeeping_fn(const struct timeval *now, void *private_data)
{
change_to_root_user();
/* update printer queue caches if necessary */
update_monitored_printq_cache();
/* check if we need to reload services */
check_reload(time(NULL));
/* Change machine password if neccessary. */
attempt_machine_p... | DoS | 0 | static bool housekeeping_fn(const struct timeval *now, void *private_data)
{
change_to_root_user();
/* update printer queue caches if necessary */
update_monitored_printq_cache();
/* check if we need to reload services */
check_reload(time(NULL));
/* Change machine password if neccessary. */
attempt_machine_p... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,824 | static void init_smb_request(struct smb_request *req, const uint8 *inbuf,
size_t unread_bytes, bool encrypted,
uint32_t seqnum)
{
struct smbd_server_connection *sconn = smbd_server_conn;
size_t req_size = smb_len(inbuf) + 4;
/* Ensure we have at least smb_size bytes. */
if (req_size < smb_size) {
... | DoS | 0 | static void init_smb_request(struct smb_request *req, const uint8 *inbuf,
size_t unread_bytes, bool encrypted,
uint32_t seqnum)
{
struct smbd_server_connection *sconn = smbd_server_conn;
size_t req_size = smb_len(inbuf) + 4;
/* Ensure we have at least smb_size bytes. */
if (req_size < smb_size) {
... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,825 | static bool keepalive_fn(const struct timeval *now, void *private_data)
{
if (!send_keepalive(smbd_server_fd())) {
DEBUG( 2, ( "Keepalive failed - exiting.\n" ) );
return False;
}
return True;
}
| DoS | 0 | static bool keepalive_fn(const struct timeval *now, void *private_data)
{
if (!send_keepalive(smbd_server_fd())) {
DEBUG( 2, ( "Keepalive failed - exiting.\n" ) );
return False;
}
return True;
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,826 | bool open_was_deferred(uint16 mid)
{
struct pending_message_list *pml;
for (pml = deferred_open_queue; pml; pml = pml->next) {
if (SVAL(pml->buf.data,smb_mid) == mid && !pml->processed) {
return True;
}
}
return False;
}
| DoS | 0 | bool open_was_deferred(uint16 mid)
{
struct pending_message_list *pml;
for (pml = deferred_open_queue; pml; pml = pml->next) {
if (SVAL(pml->buf.data,smb_mid) == mid && !pml->processed) {
return True;
}
}
return False;
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,827 | static void process_smb(struct smbd_server_connection *conn,
uint8_t *inbuf, size_t nread, size_t unread_bytes,
uint32_t seqnum, bool encrypted,
struct smb_perfcount_data *deferred_pcd)
{
int msg_type = CVAL(inbuf,0);
DO_PROFILE_INC(smb_count);
DEBUG( 6, ( "got message type 0x%x of len 0x%x\n", msg_type,
... | DoS | 0 | static void process_smb(struct smbd_server_connection *conn,
uint8_t *inbuf, size_t nread, size_t unread_bytes,
uint32_t seqnum, bool encrypted,
struct smb_perfcount_data *deferred_pcd)
{
int msg_type = CVAL(inbuf,0);
DO_PROFILE_INC(smb_count);
DEBUG( 6, ( "got message type 0x%x of len 0x%x\n", msg_type,
... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,828 | bool push_deferred_smb_message(struct smb_request *req,
struct timeval request_time,
struct timeval timeout,
char *private_data, size_t priv_len)
{
struct timeval end_time;
if (req->unread_bytes) {
DEBUG(0,("push_deferred_smb_message: logic error ! "
"unread_bytes = %u\n",
(unsi... | DoS | 0 | bool push_deferred_smb_message(struct smb_request *req,
struct timeval request_time,
struct timeval timeout,
char *private_data, size_t priv_len)
{
struct timeval end_time;
if (req->unread_bytes) {
DEBUG(0,("push_deferred_smb_message: logic error ! "
"unread_bytes = %u\n",
(unsi... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,829 | static NTSTATUS read_packet_remainder(int fd, char *buffer,
unsigned int timeout, ssize_t len)
{
if (len <= 0) {
return NT_STATUS_OK;
}
return read_fd_with_timeout(fd, buffer, len, len, timeout, NULL);
}
| DoS | 0 | static NTSTATUS read_packet_remainder(int fd, char *buffer,
unsigned int timeout, ssize_t len)
{
if (len <= 0) {
return NT_STATUS_OK;
}
return read_fd_with_timeout(fd, buffer, len, len, timeout, NULL);
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,830 | static NTSTATUS receive_smb_raw_talloc(TALLOC_CTX *mem_ctx, int fd,
char **buffer, unsigned int timeout,
size_t *p_unread, size_t *plen)
{
char lenbuf[4];
size_t len;
int min_recv_size = lp_min_receive_file_size();
NTSTATUS status;
*p_unread = 0;
status = read_smb_length_return_keepalive(f... | DoS | 0 | static NTSTATUS receive_smb_raw_talloc(TALLOC_CTX *mem_ctx, int fd,
char **buffer, unsigned int timeout,
size_t *p_unread, size_t *plen)
{
char lenbuf[4];
size_t len;
int min_recv_size = lp_min_receive_file_size();
NTSTATUS status;
*p_unread = 0;
status = read_smb_length_return_keepalive(f... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,831 | static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
const char lenbuf[4],
int fd, char **buffer,
unsigned int timeout,
size_t *p_unread,
size_t *len_ret)
{
/* Size of a WRITEX call (+4 byte len). */
char writeX_header[4 + STANDARD_WRITE_AND_X_HEAD... | DoS | 0 | static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
const char lenbuf[4],
int fd, char **buffer,
unsigned int timeout,
size_t *p_unread,
size_t *len_ret)
{
/* Size of a WRITEX call (+4 byte len). */
char writeX_header[4 + STANDARD_WRITE_AND_X_HEAD... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,832 | static NTSTATUS receive_smb_talloc(TALLOC_CTX *mem_ctx, int fd,
char **buffer, unsigned int timeout,
size_t *p_unread, bool *p_encrypted,
size_t *p_len,
uint32_t *seqnum)
{
size_t len = 0;
NTSTATUS status;
*p_encrypted = false;
status = receive_smb_raw_talloc(mem_ctx, fd, buffer, timeo... | DoS | 0 | static NTSTATUS receive_smb_talloc(TALLOC_CTX *mem_ctx, int fd,
char **buffer, unsigned int timeout,
size_t *p_unread, bool *p_encrypted,
size_t *p_len,
uint32_t *seqnum)
{
size_t len = 0;
NTSTATUS status;
*p_encrypted = false;
status = receive_smb_raw_talloc(mem_ctx, fd, buffer, timeo... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,833 | void remove_deferred_open_smb_message(uint16 mid)
{
struct pending_message_list *pml;
for (pml = deferred_open_queue; pml; pml = pml->next) {
if (mid == SVAL(pml->buf.data,smb_mid)) {
DEBUG(10,("remove_deferred_open_smb_message: "
"deleting mid %u len %u\n",
(unsigned int)mid,
(unsigned int)pm... | DoS | 0 | void remove_deferred_open_smb_message(uint16 mid)
{
struct pending_message_list *pml;
for (pml = deferred_open_queue; pml; pml = pml->next) {
if (mid == SVAL(pml->buf.data,smb_mid)) {
DEBUG(10,("remove_deferred_open_smb_message: "
"deleting mid %u len %u\n",
(unsigned int)mid,
(unsigned int)pm... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,834 | void remove_from_common_flags2(uint32 v)
{
common_flags2 &= ~v;
}
| DoS | 0 | void remove_from_common_flags2(uint32 v)
{
common_flags2 &= ~v;
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,835 | void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes)
{
char *outbuf;
if (!create_outbuf(req, req, (char *)req->inbuf, &outbuf, num_words,
num_bytes)) {
smb_panic("could not allocate output buffer\n");
}
req->outbuf = (uint8_t *)outbuf;
}
| DoS | 0 | void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes)
{
char *outbuf;
if (!create_outbuf(req, req, (char *)req->inbuf, &outbuf, num_words,
num_bytes)) {
smb_panic("could not allocate output buffer\n");
}
req->outbuf = (uint8_t *)outbuf;
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,836 | bool req_is_in_chain(struct smb_request *req)
{
if (req->vwv != (uint16_t *)(req->inbuf+smb_vwv)) {
/*
* We're right now handling a subsequent request, so we must
* be in a chain
*/
return true;
}
if (!is_andx_req(req->cmd)) {
return false;
}
if (req->wct < 2) {
/*
* Okay, an illegal request,... | DoS | 0 | bool req_is_in_chain(struct smb_request *req)
{
if (req->vwv != (uint16_t *)(req->inbuf+smb_vwv)) {
/*
* We're right now handling a subsequent request, so we must
* be in a chain
*/
return true;
}
if (!is_andx_req(req->cmd)) {
return false;
}
if (req->wct < 2) {
/*
* Okay, an illegal request,... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,837 | size_t req_wct_ofs(struct smb_request *req)
{
size_t buf_size;
if (req->chain_outbuf == NULL) {
return smb_wct - 4;
}
buf_size = talloc_get_size(req->chain_outbuf);
if ((buf_size % 4) != 0) {
buf_size += (4 - (buf_size % 4));
}
return buf_size - 4;
}
| DoS | 0 | size_t req_wct_ofs(struct smb_request *req)
{
size_t buf_size;
if (req->chain_outbuf == NULL) {
return smb_wct - 4;
}
buf_size = talloc_get_size(req->chain_outbuf);
if ((buf_size % 4) != 0) {
buf_size += (4 - (buf_size % 4));
}
return buf_size - 4;
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,838 | void schedule_deferred_open_smb_message(uint16 mid)
{
struct pending_message_list *pml;
int i = 0;
for (pml = deferred_open_queue; pml; pml = pml->next) {
uint16 msg_mid = SVAL(pml->buf.data,smb_mid);
DEBUG(10,("schedule_deferred_open_smb_message: [%d] msg_mid = %u\n", i++,
(unsigned int)msg_mid ));
if (... | DoS | 0 | void schedule_deferred_open_smb_message(uint16 mid)
{
struct pending_message_list *pml;
int i = 0;
for (pml = deferred_open_queue; pml; pml = pml->next) {
uint16 msg_mid = SVAL(pml->buf.data,smb_mid);
DEBUG(10,("schedule_deferred_open_smb_message: [%d] msg_mid = %u\n", i++,
(unsigned int)msg_mid ));
if (... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,839 | const char *smb_fn_name(int type)
{
const char *unknown_name = "SMBunknown";
if (smb_messages[type].name == NULL)
return(unknown_name);
return(smb_messages[type].name);
}
| DoS | 0 | const char *smb_fn_name(int type)
{
const char *unknown_name = "SMBunknown";
if (smb_messages[type].name == NULL)
return(unknown_name);
return(smb_messages[type].name);
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,840 | static bool smb_splice_chain(uint8_t **poutbuf, uint8_t smb_command,
uint8_t wct, const uint16_t *vwv,
size_t bytes_alignment,
uint32_t num_bytes, const uint8_t *bytes)
{
uint8_t *outbuf;
size_t old_size, new_size;
size_t ofs;
size_t chain_padding = 0;
size_t bytes_padding = 0;
bool first_... | DoS | 0 | static bool smb_splice_chain(uint8_t **poutbuf, uint8_t smb_command,
uint8_t wct, const uint16_t *vwv,
size_t bytes_alignment,
uint32_t num_bytes, const uint8_t *bytes)
{
uint8_t *outbuf;
size_t old_size, new_size;
size_t ofs;
size_t chain_padding = 0;
size_t bytes_padding = 0;
bool first_... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,841 | static void smbd_deferred_open_timer(struct event_context *ev,
struct timed_event *te,
struct timeval _tval,
void *private_data)
{
struct pending_message_list *msg = talloc_get_type(private_data,
struct pending_message_list);
TALLOC_CTX *mem_ctx = talloc_tos();
uint16_t mid = SVAL(... | DoS | 0 | static void smbd_deferred_open_timer(struct event_context *ev,
struct timed_event *te,
struct timeval _tval,
void *private_data)
{
struct pending_message_list *msg = talloc_get_type(private_data,
struct pending_message_list);
TALLOC_CTX *mem_ctx = talloc_tos();
uint16_t mid = SVAL(... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,842 | static void smbd_idle_event_handler(struct event_context *ctx,
struct timed_event *te,
struct timeval now,
void *private_data)
{
struct idle_event *event =
talloc_get_type_abort(private_data, struct idle_event);
TALLOC_FREE(event->te);
DEBUG(10,("smbd_idle_event_handler: %s %p called\n",
... | DoS | 0 | static void smbd_idle_event_handler(struct event_context *ctx,
struct timed_event *te,
struct timeval now,
void *private_data)
{
struct idle_event *event =
talloc_get_type_abort(private_data, struct idle_event);
TALLOC_FREE(event->te);
DEBUG(10,("smbd_idle_event_handler: %s %p called\n",
... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,843 | void smbd_process(void)
{
TALLOC_CTX *frame = talloc_stackframe();
char remaddr[INET6_ADDRSTRLEN];
if (lp_maxprotocol() == PROTOCOL_SMB2 &&
lp_security() != SEC_SHARE) {
smbd_server_conn->allow_smb2 = true;
}
/* Ensure child is set to blocking mode */
set_blocking(smbd_server_fd(),True);
set_socket_opt... | DoS | 0 | void smbd_process(void)
{
TALLOC_CTX *frame = talloc_stackframe();
char remaddr[INET6_ADDRSTRLEN];
if (lp_maxprotocol() == PROTOCOL_SMB2 &&
lp_security() != SEC_SHARE) {
smbd_server_conn->allow_smb2 = true;
}
/* Ensure child is set to blocking mode */
set_blocking(smbd_server_fd(),True);
set_socket_opt... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,844 | static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection *conn)
{
fd_set r_fds, w_fds;
int selrtn;
struct timeval to;
int maxfd = 0;
to.tv_sec = SMBD_SELECT_TIMEOUT;
to.tv_usec = 0;
/*
* Setup the select fd sets.
*/
FD_ZERO(&r_fds);
FD_ZERO(&w_fds);
/*
* Are there any timed eve... | DoS | 0 | static NTSTATUS smbd_server_connection_loop_once(struct smbd_server_connection *conn)
{
fd_set r_fds, w_fds;
int selrtn;
struct timeval to;
int maxfd = 0;
to.tv_sec = SMBD_SELECT_TIMEOUT;
to.tv_usec = 0;
/*
* Setup the select fd sets.
*/
FD_ZERO(&r_fds);
FD_ZERO(&w_fds);
/*
* Are there any timed eve... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,845 | void smbd_setup_sig_hup_handler(void)
{
struct tevent_signal *se;
se = tevent_add_signal(smbd_event_context(),
smbd_event_context(),
SIGHUP, 0,
smbd_sig_hup_handler,
NULL);
if (!se) {
exit_server("failed to setup SIGHUP handler");
}
}
| DoS | 0 | void smbd_setup_sig_hup_handler(void)
{
struct tevent_signal *se;
se = tevent_add_signal(smbd_event_context(),
smbd_event_context(),
SIGHUP, 0,
smbd_sig_hup_handler,
NULL);
if (!se) {
exit_server("failed to setup SIGHUP handler");
}
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,846 | void smbd_setup_sig_term_handler(void)
{
struct tevent_signal *se;
se = tevent_add_signal(smbd_event_context(),
smbd_event_context(),
SIGTERM, 0,
smbd_sig_term_handler,
NULL);
if (!se) {
exit_server("failed to setup SIGTERM handler");
}
}
| DoS | 0 | void smbd_setup_sig_term_handler(void)
{
struct tevent_signal *se;
se = tevent_add_signal(smbd_event_context(),
smbd_event_context(),
SIGTERM, 0,
smbd_sig_term_handler,
NULL);
if (!se) {
exit_server("failed to setup SIGTERM handler");
}
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,847 | static void smbd_sig_hup_handler(struct tevent_context *ev,
struct tevent_signal *se,
int signum,
int count,
void *siginfo,
void *private_data)
{
change_to_root_user();
DEBUG(1,("Reloading services after SIGHUP\n"));
reload_services(False);
}
| DoS | 0 | static void smbd_sig_hup_handler(struct tevent_context *ev,
struct tevent_signal *se,
int signum,
int count,
void *siginfo,
void *private_data)
{
change_to_root_user();
DEBUG(1,("Reloading services after SIGHUP\n"));
reload_services(False);
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,848 | static void smbd_sig_term_handler(struct tevent_context *ev,
struct tevent_signal *se,
int signum,
int count,
void *siginfo,
void *private_data)
{
exit_server_cleanly("termination signal");
}
| DoS | 0 | static void smbd_sig_term_handler(struct tevent_context *ev,
struct tevent_signal *se,
int signum,
int count,
void *siginfo,
void *private_data)
{
exit_server_cleanly("termination signal");
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,849 | bool srv_send_smb(int fd, char *buffer,
bool do_signing, uint32_t seqnum,
bool do_encrypt,
struct smb_perfcount_data *pcd)
{
size_t len = 0;
size_t nwritten=0;
ssize_t ret;
char *buf_out = buffer;
if (do_signing) {
/* Sign the outgoing packet if required. */
srv_calculate_sign_mac(smbd_server_conn... | DoS | 0 | bool srv_send_smb(int fd, char *buffer,
bool do_signing, uint32_t seqnum,
bool do_encrypt,
struct smb_perfcount_data *pcd)
{
size_t len = 0;
size_t nwritten=0;
ssize_t ret;
char *buf_out = buffer;
if (do_signing) {
/* Sign the outgoing packet if required. */
srv_calculate_sign_mac(smbd_server_conn... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,850 | int srv_set_message(char *buf,
int num_words,
int num_bytes,
bool zero)
{
if (zero && (num_words || num_bytes)) {
memset(buf + smb_size,'\0',num_words*2 + num_bytes);
}
SCVAL(buf,smb_wct,num_words);
SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,nu... | DoS | 0 | int srv_set_message(char *buf,
int num_words,
int num_bytes,
bool zero)
{
if (zero && (num_words || num_bytes)) {
memset(buf + smb_size,'\0',num_words*2 + num_bytes);
}
SCVAL(buf,smb_wct,num_words);
SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,nu... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,851 | static connection_struct *switch_message(uint8 type, struct smb_request *req, int size)
{
int flags;
uint16 session_tag;
connection_struct *conn = NULL;
struct smbd_server_connection *sconn = smbd_server_conn;
errno = 0;
/* Make sure this is an SMB packet. smb_size contains NetBIOS header
* so subtract 4 from... | DoS | 0 | static connection_struct *switch_message(uint8 type, struct smb_request *req, int size)
{
int flags;
uint16 session_tag;
connection_struct *conn = NULL;
struct smbd_server_connection *sconn = smbd_server_conn;
errno = 0;
/* Make sure this is an SMB packet. smb_size contains NetBIOS header
* so subtract 4 from... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,852 | static bool valid_packet_size(size_t len)
{
/*
* A WRITEX with CAP_LARGE_WRITEX can be 64k worth of data plus 65 bytes
* of header. Don't print the error if this fits.... JRA.
*/
if (len > (BUFFER_SIZE + LARGE_WRITEX_HDR_SIZE)) {
DEBUG(0,("Invalid packet length! (%lu bytes).\n",
(unsigned long)len));
... | DoS | 0 | static bool valid_packet_size(size_t len)
{
/*
* A WRITEX with CAP_LARGE_WRITEX can be 64k worth of data plus 65 bytes
* of header. Don't print the error if this fits.... JRA.
*/
if (len > (BUFFER_SIZE + LARGE_WRITEX_HDR_SIZE)) {
DEBUG(0,("Invalid packet length! (%lu bytes).\n",
(unsigned long)len));
... | @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,853 | static bool valid_smb_header(const uint8_t *inbuf)
{
if (is_encrypted_packet(inbuf)) {
return true;
}
/*
* This used to be (strncmp(smb_base(inbuf),"\377SMB",4) == 0)
* but it just looks weird to call strncmp for this one.
*/
return (IVAL(smb_base(inbuf), 0) == 0x424D53FF);
}
| DoS | 0 | static bool valid_smb_header(const uint8_t *inbuf)
{
if (is_encrypted_packet(inbuf)) {
return true;
}
/*
* This used to be (strncmp(smb_base(inbuf),"\377SMB",4) == 0)
* but it just looks weird to call strncmp for this one.
*/
return (IVAL(smb_base(inbuf), 0) == 0x424D53FF);
}
| @@ -1810,6 +1810,15 @@ void chain_reply(struct smb_request *req)
*/
if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
+ if (req->chain_outbuf == NULL) {
+ req->chain_outbuf = TALLOC_REALLOC_ARRAY(
+ req, req->outbuf, uint8_t,
+... | null | null | null |
8,854 | static diy_fp_t cached_power(int k)
{
diy_fp_t res;
int index = 343 + k;
res.f = powers_ten[index];
res.e = powers_ten_e[index];
return res;
}
| Overflow | 0 | static diy_fp_t cached_power(int k)
{
diy_fp_t res;
int index = 343 + k;
res.f = powers_ten[index];
res.e = powers_ten_e[index];
return res;
}
| @@ -709,16 +709,20 @@ js_strtod(const char *string, char **endPtr)
* fraction.
*/
- if (exp < 0) {
+ if (exp < -maxExponent) {
+ exp = maxExponent;
+ expSign = TRUE;
+ errno = ERANGE;
+ } else if (exp > maxExponent) {
+ exp = ... | CWE-190 | null | null |
8,855 | static void digit_gen(diy_fp_t Mp, diy_fp_t delta, char* buffer, int* len, int* K)
{
uint32_t div, p1;
uint64_t p2;
int d,kappa;
diy_fp_t one;
one.f = ((uint64_t) 1) << -Mp.e; one.e = Mp.e;
p1 = Mp.f >> -one.e;
p2 = Mp.f & (one.f - 1);
*len = 0; kappa = 3; div = TEN2;
while (kappa > 0) {
d = p1 / div;
if (... | Overflow | 0 | static void digit_gen(diy_fp_t Mp, diy_fp_t delta, char* buffer, int* len, int* K)
{
uint32_t div, p1;
uint64_t p2;
int d,kappa;
diy_fp_t one;
one.f = ((uint64_t) 1) << -Mp.e; one.e = Mp.e;
p1 = Mp.f >> -one.e;
p2 = Mp.f & (one.f - 1);
*len = 0; kappa = 3; div = TEN2;
while (kappa > 0) {
d = p1 / div;
if (... | @@ -709,16 +709,20 @@ js_strtod(const char *string, char **endPtr)
* fraction.
*/
- if (exp < 0) {
+ if (exp < -maxExponent) {
+ exp = maxExponent;
+ expSign = TRUE;
+ errno = ERANGE;
+ } else if (exp > maxExponent) {
+ exp = ... | CWE-190 | null | null |
8,856 | js_fmtexp(char *p, int e)
{
char se[9];
int i;
*p++ = 'e';
if(e < 0) {
*p++ = '-';
e = -e;
} else
*p++ = '+';
i = 0;
while(e) {
se[i++] = e % 10 + '0';
e /= 10;
}
while(i < 1)
se[i++] = '0';
while(i > 0)
*p++ = se[--i];
*p++ = '\0';
}
| Overflow | 0 | js_fmtexp(char *p, int e)
{
char se[9];
int i;
*p++ = 'e';
if(e < 0) {
*p++ = '-';
e = -e;
} else
*p++ = '+';
i = 0;
while(e) {
se[i++] = e % 10 + '0';
e /= 10;
}
while(i < 1)
se[i++] = '0';
while(i > 0)
*p++ = se[--i];
*p++ = '\0';
}
| @@ -709,16 +709,20 @@ js_strtod(const char *string, char **endPtr)
* fraction.
*/
- if (exp < 0) {
+ if (exp < -maxExponent) {
+ exp = maxExponent;
+ expSign = TRUE;
+ errno = ERANGE;
+ } else if (exp > maxExponent) {
+ exp = ... | CWE-190 | null | null |
8,857 | js_grisu2(double v, char *buffer, int *K)
{
int length, mk;
diy_fp_t w_m, w_p, c_mk, Wp, Wm, delta;
int q = 64, alpha = -59, gamma = -56;
normalized_boundaries(v, &w_m, &w_p);
mk = k_comp(w_p.e + q, alpha, gamma);
c_mk = cached_power(mk);
Wp = multiply(w_p, c_mk);
Wm = multiply(w_m, c_mk);
Wm.f++; Wp.f--;
del... | Overflow | 0 | js_grisu2(double v, char *buffer, int *K)
{
int length, mk;
diy_fp_t w_m, w_p, c_mk, Wp, Wm, delta;
int q = 64, alpha = -59, gamma = -56;
normalized_boundaries(v, &w_m, &w_p);
mk = k_comp(w_p.e + q, alpha, gamma);
c_mk = cached_power(mk);
Wp = multiply(w_p, c_mk);
Wm = multiply(w_m, c_mk);
Wm.f++; Wp.f--;
del... | @@ -709,16 +709,20 @@ js_strtod(const char *string, char **endPtr)
* fraction.
*/
- if (exp < 0) {
+ if (exp < -maxExponent) {
+ exp = maxExponent;
+ expSign = TRUE;
+ errno = ERANGE;
+ } else if (exp > maxExponent) {
+ exp = ... | CWE-190 | null | null |
8,858 | PHP_GINIT_FUNCTION(phar) /* {{{ */
{
#if defined(COMPILE_DL_PHAR) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
phar_mime_type mime;
memset(phar_globals, 0, sizeof(zend_phar_globals));
phar_globals->readonly = 1;
zend_hash_init(&phar_globals->mime_types, 0, NULL, mime_type_dtor, 1);
#define PHAR_SET_MIME(m... | Exec Code | 0 | PHP_GINIT_FUNCTION(phar) /* {{{ */
{
#if defined(COMPILE_DL_PHAR) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
phar_mime_type mime;
memset(phar_globals, 0, sizeof(zend_phar_globals));
phar_globals->readonly = 1;
zend_hash_init(&phar_globals->mime_types, 0, NULL, mime_type_dtor, 1);
#define PHAR_SET_MIME(m... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,859 | PHP_MINFO_FUNCTION(phar) /* {{{ */
{
phar_request_initialize();
php_info_print_table_start();
php_info_print_table_header(2, "Phar: PHP Archive support", "enabled");
php_info_print_table_row(2, "Phar EXT version", PHP_PHAR_VERSION);
php_info_print_table_row(2, "Phar API version", PHP_PHAR_API_VERSION);
php_info_p... | Exec Code | 0 | PHP_MINFO_FUNCTION(phar) /* {{{ */
{
phar_request_initialize();
php_info_print_table_start();
php_info_print_table_header(2, "Phar: PHP Archive support", "enabled");
php_info_print_table_row(2, "Phar EXT version", PHP_PHAR_VERSION);
php_info_print_table_row(2, "Phar API version", PHP_PHAR_API_VERSION);
php_info_p... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,860 | PHP_MINIT_FUNCTION(phar) /* {{{ */
{
REGISTER_INI_ENTRIES();
phar_orig_compile_file = zend_compile_file;
zend_compile_file = phar_compile_file;
phar_save_resolve_path = zend_resolve_path;
zend_resolve_path = phar_resolve_path;
phar_object_init();
phar_intercept_functions_init();
phar_save_orig_functions();
... | Exec Code | 0 | PHP_MINIT_FUNCTION(phar) /* {{{ */
{
REGISTER_INI_ENTRIES();
phar_orig_compile_file = zend_compile_file;
zend_compile_file = phar_compile_file;
phar_save_resolve_path = zend_resolve_path;
zend_resolve_path = phar_resolve_path;
phar_object_init();
phar_intercept_functions_init();
phar_save_orig_functions();
... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,861 | PHP_MSHUTDOWN_FUNCTION(phar) /* {{{ */
{
php_unregister_url_stream_wrapper("phar");
phar_intercept_functions_shutdown();
if (zend_compile_file == phar_compile_file) {
zend_compile_file = phar_orig_compile_file;
}
if (PHAR_G(manifest_cached)) {
zend_hash_destroy(&(cached_phars));
zend_hash_destroy(&(cached... | Exec Code | 0 | PHP_MSHUTDOWN_FUNCTION(phar) /* {{{ */
{
php_unregister_url_stream_wrapper("phar");
phar_intercept_functions_shutdown();
if (zend_compile_file == phar_compile_file) {
zend_compile_file = phar_orig_compile_file;
}
if (PHAR_G(manifest_cached)) {
zend_hash_destroy(&(cached_phars));
zend_hash_destroy(&(cached... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,862 | PHP_RSHUTDOWN_FUNCTION(phar) /* {{{ */
{
int i;
PHAR_G(request_ends) = 1;
if (PHAR_G(request_init))
{
phar_release_functions();
zend_hash_destroy(&(PHAR_G(phar_alias_map)));
PHAR_G(phar_alias_map.u.flags) = 0;
zend_hash_destroy(&(PHAR_G(phar_fname_map)));
PHAR_G(phar_fname_map.u.flags) = 0;
zend_hash_... | Exec Code | 0 | PHP_RSHUTDOWN_FUNCTION(phar) /* {{{ */
{
int i;
PHAR_G(request_ends) = 1;
if (PHAR_G(request_init))
{
phar_release_functions();
zend_hash_destroy(&(PHAR_G(phar_alias_map)));
PHAR_G(phar_alias_map.u.flags) = 0;
zend_hash_destroy(&(PHAR_G(phar_fname_map)));
PHAR_G(phar_fname_map.u.flags) = 0;
zend_hash_... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,863 | ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */
{
zend_bool old, ini;
if (ZSTR_LEN(entry->name) == sizeof("phar.readonly")-1) {
old = PHAR_G(readonly_orig);
} else {
old = PHAR_G(require_hash_orig);
}
if (ZSTR_LEN(new_value) == 2 && !strcasecmp("on", ZSTR_VAL(new_value))) {
ini = (zend_bool) 1;
}
else if ... | Exec Code | 0 | ZEND_INI_MH(phar_ini_modify_handler) /* {{{ */
{
zend_bool old, ini;
if (ZSTR_LEN(entry->name) == sizeof("phar.readonly")-1) {
old = PHAR_G(readonly_orig);
} else {
old = PHAR_G(require_hash_orig);
}
if (ZSTR_LEN(new_value) == 2 && !strcasecmp("on", ZSTR_VAL(new_value))) {
ini = (zend_bool) 1;
}
else if ... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,864 | ZEND_INI_MH(phar_ini_cache_list) /* {{{ */
{
PHAR_G(cache_list) = ZSTR_VAL(new_value);
if (stage == ZEND_INI_STAGE_STARTUP) {
phar_split_cache_list();
}
return SUCCESS;
}
/* }}} */
| Exec Code | 0 | ZEND_INI_MH(phar_ini_cache_list) /* {{{ */
{
PHAR_G(cache_list) = ZSTR_VAL(new_value);
if (stage == ZEND_INI_STAGE_STARTUP) {
phar_split_cache_list();
}
return SUCCESS;
}
/* }}} */
| @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,865 | static void destroy_phar_data(zval *zv) /* {{{ */
{
phar_archive_data *phar_data = (phar_archive_data *)Z_PTR_P(zv);
if (PHAR_G(request_ends)) {
/* first, iterate over the manifest and close all PHAR_TMP entry fp handles,
this prevents unnecessary unfreed stream resources */
zend_hash_apply(&(phar_data->manife... | Exec Code | 0 | static void destroy_phar_data(zval *zv) /* {{{ */
{
phar_archive_data *phar_data = (phar_archive_data *)Z_PTR_P(zv);
if (PHAR_G(request_ends)) {
/* first, iterate over the manifest and close all PHAR_TMP entry fp handles,
this prevents unnecessary unfreed stream resources */
zend_hash_apply(&(phar_data->manife... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,866 | static void destroy_phar_data_only(zval *zv) /* {{{ */
{
phar_archive_data *phar_data = (phar_archive_data *) Z_PTR_P(zv);
if (EG(exception) || --phar_data->refcount < 0) {
phar_destroy_phar_data(phar_data);
}
}
/* }}}*/
| Exec Code | 0 | static void destroy_phar_data_only(zval *zv) /* {{{ */
{
phar_archive_data *phar_data = (phar_archive_data *) Z_PTR_P(zv);
if (EG(exception) || --phar_data->refcount < 0) {
phar_destroy_phar_data(phar_data);
}
}
/* }}}*/
| @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,867 | void destroy_phar_manifest_entry_int(phar_entry_info *entry) /* {{{ */
{
if (entry->cfp) {
php_stream_close(entry->cfp);
entry->cfp = 0;
}
if (entry->fp) {
php_stream_close(entry->fp);
entry->fp = 0;
}
if (Z_TYPE(entry->metadata) != IS_UNDEF) {
if (entry->is_persistent) {
if (entry->metadata_len) {... | Exec Code | 0 | void destroy_phar_manifest_entry_int(phar_entry_info *entry) /* {{{ */
{
if (entry->cfp) {
php_stream_close(entry->cfp);
entry->cfp = 0;
}
if (entry->fp) {
php_stream_close(entry->fp);
entry->fp = 0;
}
if (Z_TYPE(entry->metadata) != IS_UNDEF) {
if (entry->is_persistent) {
if (entry->metadata_len) {... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,868 | static void mime_type_dtor(zval *zv)
{
free(Z_PTR_P(zv));
}
| Exec Code | 0 | static void mime_type_dtor(zval *zv)
{
free(Z_PTR_P(zv));
}
| @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,869 | static int phar_analyze_path(const char *fname, const char *ext, int ext_len, int for_create) /* {{{ */
{
php_stream_statbuf ssb;
char *realpath;
char *filename = estrndup(fname, (ext - fname) + ext_len);
if ((realpath = expand_filepath(filename, NULL))) {
#ifdef PHP_WIN32
phar_unixify_path_separators(realpath, ... | Exec Code | 0 | static int phar_analyze_path(const char *fname, const char *ext, int ext_len, int for_create) /* {{{ */
{
php_stream_statbuf ssb;
char *realpath;
char *filename = estrndup(fname, (ext - fname) + ext_len);
if ((realpath = expand_filepath(filename, NULL))) {
#ifdef PHP_WIN32
phar_unixify_path_separators(realpath, ... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,870 | int phar_archive_delref(phar_archive_data *phar) /* {{{ */
{
if (phar->is_persistent) {
return 0;
}
if (--phar->refcount < 0) {
if (PHAR_G(request_done)
|| zend_hash_str_del(&(PHAR_G(phar_fname_map)), phar->fname, phar->fname_len) != SUCCESS) {
phar_destroy_phar_data(phar);
}
return 1;
} else if (!pha... | Exec Code | 0 | int phar_archive_delref(phar_archive_data *phar) /* {{{ */
{
if (phar->is_persistent) {
return 0;
}
if (--phar->refcount < 0) {
if (PHAR_G(request_done)
|| zend_hash_str_del(&(PHAR_G(phar_fname_map)), phar->fname, phar->fname_len) != SUCCESS) {
phar_destroy_phar_data(phar);
}
return 1;
} else if (!pha... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,871 | static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type) /* {{{ */
{
zend_op_array *res;
char *name = NULL;
int failed;
phar_archive_data *phar;
if (!file_handle || !file_handle->filename) {
return phar_orig_compile_file(file_handle, type);
}
if (strstr(file_handle->filename, ".phar") ... | Exec Code | 0 | static zend_op_array *phar_compile_file(zend_file_handle *file_handle, int type) /* {{{ */
{
zend_op_array *res;
char *name = NULL;
int failed;
phar_archive_data *phar;
if (!file_handle || !file_handle->filename) {
return phar_orig_compile_file(file_handle, type);
}
if (strstr(file_handle->filename, ".phar") ... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,872 | int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error) /* {{{ */
{
phar_archive_data *mydata;
php_stream *fp;
zend_string *actual = NULL;
char *p;
if (!pphar) {
pphar = &mydata;
}
#if PHP_API_VERSION < 2010041... | Exec Code | 0 | int phar_create_or_parse_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error) /* {{{ */
{
phar_archive_data *mydata;
php_stream *fp;
zend_string *actual = NULL;
char *p;
if (!pphar) {
pphar = &mydata;
}
#if PHP_API_VERSION < 2010041... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,873 | void phar_destroy_phar_data(phar_archive_data *phar) /* {{{ */
{
if (phar->alias && phar->alias != phar->fname) {
pefree(phar->alias, phar->is_persistent);
phar->alias = NULL;
}
if (phar->fname) {
pefree(phar->fname, phar->is_persistent);
phar->fname = NULL;
}
if (phar->signature) {
pefree(phar->signat... | Exec Code | 0 | void phar_destroy_phar_data(phar_archive_data *phar) /* {{{ */
{
if (phar->alias && phar->alias != phar->fname) {
pefree(phar->alias, phar->is_persistent);
phar->alias = NULL;
}
if (phar->fname) {
pefree(phar->fname, phar->is_persistent);
phar->fname = NULL;
}
if (phar->signature) {
pefree(phar->signat... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,874 | int phar_entry_delref(phar_entry_data *idata) /* {{{ */
{
int ret = 0;
if (idata->internal_file && !idata->internal_file->is_persistent) {
if (--idata->internal_file->fp_refcount < 0) {
idata->internal_file->fp_refcount = 0;
}
if (idata->fp && idata->fp != idata->phar->fp && idata->fp != idata->phar->ufp &... | Exec Code | 0 | int phar_entry_delref(phar_entry_data *idata) /* {{{ */
{
int ret = 0;
if (idata->internal_file && !idata->internal_file->is_persistent) {
if (--idata->internal_file->fp_refcount < 0) {
idata->internal_file->fp_refcount = 0;
}
if (idata->fp && idata->fp != idata->phar->fp && idata->fp != idata->phar->ufp &... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,875 | void phar_entry_remove(phar_entry_data *idata, char **error) /* {{{ */
{
phar_archive_data *phar;
phar = idata->phar;
if (idata->internal_file->fp_refcount < 2) {
if (idata->fp && idata->fp != idata->phar->fp && idata->fp != idata->phar->ufp && idata->fp != idata->internal_file->fp) {
php_stream_close(idata->... | Exec Code | 0 | void phar_entry_remove(phar_entry_data *idata, char **error) /* {{{ */
{
phar_archive_data *phar;
phar = idata->phar;
if (idata->internal_file->fp_refcount < 2) {
if (idata->fp && idata->fp != idata->phar->fp && idata->fp != idata->phar->ufp && idata->fp != idata->internal_file->fp) {
php_stream_close(idata->... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,876 | char *phar_fix_filepath(char *path, int *new_len, int use_cwd) /* {{{ */
{
char *newpath;
int newpath_len;
char *ptr;
char *tok;
int ptr_length, path_length = *new_len;
if (PHAR_G(cwd_len) && use_cwd && path_length > 2 && path[0] == '.' && path[1] == '/') {
newpath_len = PHAR_G(cwd_len);
newpath = emalloc(st... | Exec Code | 0 | char *phar_fix_filepath(char *path, int *new_len, int use_cwd) /* {{{ */
{
char *newpath;
int newpath_len;
char *ptr;
char *tok;
int ptr_length, path_length = *new_len;
if (PHAR_G(cwd_len) && use_cwd && path_length > 2 && path[0] == '.' && path[1] == '/') {
newpath_len = PHAR_G(cwd_len);
newpath = emalloc(st... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,877 | static int phar_flush_clean_deleted_apply(zval *zv) /* {{{ */
{
phar_entry_info *entry = (phar_entry_info *)Z_PTR_P(zv);
if (entry->fp_refcount <= 0 && entry->is_deleted) {
return ZEND_HASH_APPLY_REMOVE;
} else {
return ZEND_HASH_APPLY_KEEP;
}
}
/* }}} */
| Exec Code | 0 | static int phar_flush_clean_deleted_apply(zval *zv) /* {{{ */
{
phar_entry_info *entry = (phar_entry_info *)Z_PTR_P(zv);
if (entry->fp_refcount <= 0 && entry->is_deleted) {
return ZEND_HASH_APPLY_REMOVE;
} else {
return ZEND_HASH_APPLY_KEEP;
}
}
/* }}} */
| @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,878 | int phar_open_from_filename(char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, char **error) /* {{{ */
{
php_stream *fp;
zend_string *actual;
int ret, is_data = 0;
if (error) {
*error = NULL;
}
if (!strstr(fname, ".phar")) {
is_data = 1;
}
if (phar_open_parsed... | Exec Code | 0 | int phar_open_from_filename(char *fname, int fname_len, char *alias, int alias_len, int options, phar_archive_data** pphar, char **error) /* {{{ */
{
php_stream *fp;
zend_string *actual;
int ret, is_data = 0;
if (error) {
*error = NULL;
}
if (!strstr(fname, ".phar")) {
is_data = 1;
}
if (phar_open_parsed... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,879 | int phar_open_or_create_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error) /* {{{ */
{
const char *ext_str, *z;
char *my_error;
int ext_len;
phar_archive_data **test, *unused = NULL;
test = &unused;
if (error) {
*error = NULL;
}... | Exec Code | 0 | int phar_open_or_create_filename(char *fname, int fname_len, char *alias, int alias_len, int is_data, int options, phar_archive_data** pphar, char **error) /* {{{ */
{
const char *ext_str, *z;
char *my_error;
int ext_len;
phar_archive_data **test, *unused = NULL;
test = &unused;
if (error) {
*error = NULL;
}... | @@ -2196,6 +2196,10 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
+ if (CHECK_NULL_PATH(filename, filename_len)) {
+ return FAILURE;
+ }
+
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
... | CWE-20 | null | null |
8,880 | PHP_METHOD(Phar, running)
{
char *fname, *arch, *entry;
int fname_len, arch_len, entry_len;
zend_bool retphar = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &retphar) == FAILURE) {
return;
}
fname = (char*)zend_get_executed_filename();
fname_len = strlen(fname);
if (fname_len > 7 && !memcmp(fname, "... | Exec Code | 0 | PHP_METHOD(Phar, running)
{
char *fname, *arch, *entry;
int fname_len, arch_len, entry_len;
zend_bool retphar = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|b", &retphar) == FAILURE) {
return;
}
fname = (char*)zend_get_executed_filename();
fname_len = strlen(fname);
if (fname_len > 7 && !memcmp(fname, "... | @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,881 | PHP_METHOD(Phar, webPhar)
{
zval *mimeoverride = NULL, *rewrite = NULL;
char *alias = NULL, *error, *index_php = NULL, *f404 = NULL, *ru = NULL;
size_t alias_len = 0, f404_len = 0, free_pathinfo = 0;
int ru_len = 0;
char *fname, *path_info, *mime_type = NULL, *entry, *pt;
const char *basename;
size_t fname_len,... | Exec Code | 0 | PHP_METHOD(Phar, webPhar)
{
zval *mimeoverride = NULL, *rewrite = NULL;
char *alias = NULL, *error, *index_php = NULL, *f404 = NULL, *ru = NULL;
size_t alias_len = 0, f404_len = 0, free_pathinfo = 0;
int ru_len = 0;
char *fname, *path_info, *mime_type = NULL, *entry, *pt;
const char *basename;
size_t fname_len,... | @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,882 | PHP_METHOD(Phar, mungServer)
{
zval *mungvalues, *data;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &mungvalues) == FAILURE) {
return;
}
if (!zend_hash_num_elements(Z_ARRVAL_P(mungvalues))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "No values passed to Phar::mungServer(), expecting an array of a... | Exec Code | 0 | PHP_METHOD(Phar, mungServer)
{
zval *mungvalues, *data;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &mungvalues) == FAILURE) {
return;
}
if (!zend_hash_num_elements(Z_ARRVAL_P(mungvalues))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "No values passed to Phar::mungServer(), expecting an array of a... | @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,883 | PHP_METHOD(Phar, interceptFileFuncs)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
phar_intercept_functions();
}
| Exec Code | 0 | PHP_METHOD(Phar, interceptFileFuncs)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
phar_intercept_functions();
}
| @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,884 | PHP_METHOD(Phar, mapPhar)
{
char *alias = NULL, *error;
size_t alias_len = 0;
zend_long dataoffset = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!l", &alias, &alias_len, &dataoffset) == FAILURE) {
return;
}
phar_request_initialize();
RETVAL_BOOL(phar_open_executed_filename(alias, alias_len, &error) == ... | Exec Code | 0 | PHP_METHOD(Phar, mapPhar)
{
char *alias = NULL, *error;
size_t alias_len = 0;
zend_long dataoffset = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!l", &alias, &alias_len, &dataoffset) == FAILURE) {
return;
}
phar_request_initialize();
RETVAL_BOOL(phar_open_executed_filename(alias, alias_len, &error) == ... | @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,885 | PHP_METHOD(Phar, apiVersion)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
RETURN_STRINGL(PHP_PHAR_API_VERSION, sizeof(PHP_PHAR_API_VERSION)-1);
}
| Exec Code | 0 | PHP_METHOD(Phar, apiVersion)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
RETURN_STRINGL(PHP_PHAR_API_VERSION, sizeof(PHP_PHAR_API_VERSION)-1);
}
| @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,886 | PHP_METHOD(Phar, canCompress)
{
zend_long method = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &method) == FAILURE) {
return;
}
phar_request_initialize();
switch (method) {
case PHAR_ENT_COMPRESSED_GZ:
if (PHAR_G(has_zlib)) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
case PHAR_ENT_COMPRESSED_... | Exec Code | 0 | PHP_METHOD(Phar, canCompress)
{
zend_long method = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &method) == FAILURE) {
return;
}
phar_request_initialize();
switch (method) {
case PHAR_ENT_COMPRESSED_GZ:
if (PHAR_G(has_zlib)) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
case PHAR_ENT_COMPRESSED_... | @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,887 | PHP_METHOD(Phar, getSupportedSignatures)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
array_init(return_value);
add_next_index_stringl(return_value, "MD5", 3);
add_next_index_stringl(return_value, "SHA-1", 5);
#ifdef PHAR_HASH_OK
add_next_index_stringl(return_value, "SHA-256", 7);
add_next_inde... | Exec Code | 0 | PHP_METHOD(Phar, getSupportedSignatures)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
array_init(return_value);
add_next_index_stringl(return_value, "MD5", 3);
add_next_index_stringl(return_value, "SHA-1", 5);
#ifdef PHAR_HASH_OK
add_next_index_stringl(return_value, "SHA-256", 7);
add_next_inde... | @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,888 | PHP_METHOD(Phar, getSupportedCompression)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
array_init(return_value);
phar_request_initialize();
if (PHAR_G(has_zlib)) {
add_next_index_stringl(return_value, "GZ", 2);
}
if (PHAR_G(has_bz2)) {
add_next_index_stringl(return_value, "BZIP2", 5);
}
}... | Exec Code | 0 | PHP_METHOD(Phar, getSupportedCompression)
{
if (zend_parse_parameters_none() == FAILURE) {
return;
}
array_init(return_value);
phar_request_initialize();
if (PHAR_G(has_zlib)) {
add_next_index_stringl(return_value, "GZ", 2);
}
if (PHAR_G(has_bz2)) {
add_next_index_stringl(return_value, "BZIP2", 5);
}
}... | @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,889 | PHP_METHOD(Phar, __destruct)
{
zval *zobj = getThis();
phar_archive_object *phar_obj = (phar_archive_object*)((char*)Z_OBJ_P(zobj) - Z_OBJ_P(zobj)->handlers->offset);
if (phar_obj->archive && phar_obj->archive->is_persistent) {
zend_hash_str_del(&PHAR_G(phar_persist_map), (const char *) phar_obj->archive, sizeof(... | Exec Code | 0 | PHP_METHOD(Phar, __destruct)
{
zval *zobj = getThis();
phar_archive_object *phar_obj = (phar_archive_object*)((char*)Z_OBJ_P(zobj) - Z_OBJ_P(zobj)->handlers->offset);
if (phar_obj->archive && phar_obj->archive->is_persistent) {
zend_hash_str_del(&PHAR_G(phar_persist_map), (const char *) phar_obj->archive, sizeof(... | @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,890 | PHP_METHOD(Phar, buildFromIterator)
{
zval *obj;
char *error;
size_t base_len = 0;
char *base = NULL;
struct _phar_t pass;
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out phar archive, phar is read-... | Exec Code | 0 | PHP_METHOD(Phar, buildFromIterator)
{
zval *obj;
char *error;
size_t base_len = 0;
char *base = NULL;
struct _phar_t pass;
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out phar archive, phar is read-... | @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,891 | PHP_METHOD(Phar, isFileFormat)
{
zend_long type;
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &type) == FAILURE) {
RETURN_FALSE;
}
switch (type) {
case PHAR_FORMAT_TAR:
RETURN_BOOL(phar_obj->archive->is_tar);
case PHAR_FORMAT_ZIP:
RETURN_BOOL(phar_obj->archive->is_zip);
ca... | Exec Code | 0 | PHP_METHOD(Phar, isFileFormat)
{
zend_long type;
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &type) == FAILURE) {
RETURN_FALSE;
}
switch (type) {
case PHAR_FORMAT_TAR:
RETURN_BOOL(phar_obj->archive->is_tar);
case PHAR_FORMAT_ZIP:
RETURN_BOOL(phar_obj->archive->is_zip);
ca... | @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,892 | PHP_METHOD(Phar, isCompressed)
{
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}
if (phar_obj->archive->flags & PHAR_FILE_COMPRESSED_GZ) {
RETURN_LONG(PHAR_ENT_COMPRESSED_GZ);
}
if (phar_obj->archive->flags & PHAR_FILE_COMPRESSED_BZ2) {
RETURN_LONG(PHAR_ENT_COMPRESSED_BZ2)... | Exec Code | 0 | PHP_METHOD(Phar, isCompressed)
{
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}
if (phar_obj->archive->flags & PHAR_FILE_COMPRESSED_GZ) {
RETURN_LONG(PHAR_ENT_COMPRESSED_GZ);
}
if (phar_obj->archive->flags & PHAR_FILE_COMPRESSED_BZ2) {
RETURN_LONG(PHAR_ENT_COMPRESSED_BZ2)... | @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,893 | PHP_METHOD(Phar, isWritable)
{
php_stream_statbuf ssb;
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}
if (!phar_obj->archive->is_writeable) {
RETURN_FALSE;
}
if (SUCCESS != php_stream_stat_path(phar_obj->archive->fname, &ssb)) {
if (phar_obj->archive->is_brandnew) {
/... | Exec Code | 0 | PHP_METHOD(Phar, isWritable)
{
php_stream_statbuf ssb;
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}
if (!phar_obj->archive->is_writeable) {
RETURN_FALSE;
}
if (SUCCESS != php_stream_stat_path(phar_obj->archive->fname, &ssb)) {
if (phar_obj->archive->is_brandnew) {
/... | @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,894 | PHP_METHOD(Phar, getPath)
{
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}
RETURN_STRINGL(phar_obj->archive->fname, phar_obj->archive->fname_len);
}
| Exec Code | 0 | PHP_METHOD(Phar, getPath)
{
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}
RETURN_STRINGL(phar_obj->archive->fname, phar_obj->archive->fname_len);
}
| @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,895 | PHP_METHOD(Phar, setAlias)
{
char *alias, *error, *oldalias;
phar_archive_data *fd_ptr;
size_t alias_len, oldalias_len;
int old_temp, readd = 0;
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out phar a... | Exec Code | 0 | PHP_METHOD(Phar, setAlias)
{
char *alias, *error, *oldalias;
phar_archive_data *fd_ptr;
size_t alias_len, oldalias_len;
int old_temp, readd = 0;
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out phar a... | @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,896 | PHP_METHOD(Phar, getVersion)
{
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}
RETURN_STRING(phar_obj->archive->version);
}
| Exec Code | 0 | PHP_METHOD(Phar, getVersion)
{
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}
RETURN_STRING(phar_obj->archive->version);
}
| @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,897 | PHP_METHOD(Phar, startBuffering)
{
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}
phar_obj->archive->donotflush = 1;
}
| Exec Code | 0 | PHP_METHOD(Phar, startBuffering)
{
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
return;
}
phar_obj->archive->donotflush = 1;
}
| @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,898 | PHP_METHOD(Phar, setStub)
{
zval *zstub;
char *stub, *error;
size_t stub_len;
zend_long len = -1;
php_stream *stream;
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot change stub, phar is read-only");
return;... | Exec Code | 0 | PHP_METHOD(Phar, setStub)
{
zval *zstub;
char *stub, *error;
size_t stub_len;
zend_long len = -1;
php_stream *stream;
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot change stub, phar is read-only");
return;... | @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
8,899 | PHP_METHOD(Phar, setDefaultStub)
{
char *index = NULL, *webindex = NULL, *error = NULL;
zend_string *stub = NULL;
size_t index_len = 0, webindex_len = 0;
int created_stub = 0;
PHAR_ARCHIVE_OBJECT();
if (phar_obj->archive->is_data) {
if (phar_obj->archive->is_tar) {
zend_throw_exception_ex(spl_ce_UnexpectedV... | Exec Code | 0 | PHP_METHOD(Phar, setDefaultStub)
{
char *index = NULL, *webindex = NULL, *error = NULL;
zend_string *stub = NULL;
size_t index_len = 0, webindex_len = 0;
int created_stub = 0;
PHAR_ARCHIVE_OBJECT();
if (phar_obj->archive->is_data) {
if (phar_obj->archive->is_tar) {
zend_throw_exception_ex(spl_ce_UnexpectedV... | @@ -459,7 +459,7 @@ PHP_METHOD(Phar, mount)
size_t path_len, actual_len;
phar_archive_data *pphar;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &path, &path_len, &actual, &actual_... | CWE-20 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.