idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
35,100 | krb5_anonymous_principal()
{
return &anon_princ;
}
| DoS Overflow | 0 | krb5_anonymous_principal()
{
return &anon_princ;
}
| @@ -40,10 +40,8 @@ build_principal_va(krb5_context context, krb5_principal princ,
data = malloc(size * sizeof(krb5_data));
if (!data) { retval = ENOMEM; }
- if (!retval) {
- r = strdup(realm);
- if (!r) { retval = ENOMEM; }
- }
+ if (!retval)
+ r = k5memdup0(realm, rlen, &retva... | CWE-119 | null | null |
35,101 | krb5_anonymous_realm()
{
return &anon_realm_data;
}
| DoS Overflow | 0 | krb5_anonymous_realm()
{
return &anon_realm_data;
}
| @@ -40,10 +40,8 @@ build_principal_va(krb5_context context, krb5_principal princ,
data = malloc(size * sizeof(krb5_data));
if (!data) { retval = ENOMEM; }
- if (!retval) {
- r = strdup(realm);
- if (!r) { retval = ENOMEM; }
- }
+ if (!retval)
+ r = k5memdup0(realm, rlen, &retva... | CWE-119 | null | null |
35,102 | krb5_build_principal(krb5_context context,
krb5_principal * princ,
unsigned int rlen,
const char * realm, ...)
{
krb5_error_code retval = 0;
va_list ap;
va_start(ap, realm);
retval = krb5_build_principal_alloc_va(context, princ, rlen, realm... | DoS Overflow | 0 | krb5_build_principal(krb5_context context,
krb5_principal * princ,
unsigned int rlen,
const char * realm, ...)
{
krb5_error_code retval = 0;
va_list ap;
va_start(ap, realm);
retval = krb5_build_principal_alloc_va(context, princ, rlen, realm... | @@ -40,10 +40,8 @@ build_principal_va(krb5_context context, krb5_principal princ,
data = malloc(size * sizeof(krb5_data));
if (!data) { retval = ENOMEM; }
- if (!retval) {
- r = strdup(realm);
- if (!r) { retval = ENOMEM; }
- }
+ if (!retval)
+ r = k5memdup0(realm, rlen, &retva... | CWE-119 | null | null |
35,103 | krb5_build_principal_alloc_va(krb5_context context,
krb5_principal *princ,
unsigned int rlen,
const char *realm,
va_list ap)
{
krb5_error_code retval = 0;
krb5_principal p;
p = malloc(siz... | DoS Overflow | 0 | krb5_build_principal_alloc_va(krb5_context context,
krb5_principal *princ,
unsigned int rlen,
const char *realm,
va_list ap)
{
krb5_error_code retval = 0;
krb5_principal p;
p = malloc(siz... | @@ -40,10 +40,8 @@ build_principal_va(krb5_context context, krb5_principal princ,
data = malloc(size * sizeof(krb5_data));
if (!data) { retval = ENOMEM; }
- if (!retval) {
- r = strdup(realm);
- if (!r) { retval = ENOMEM; }
- }
+ if (!retval)
+ r = k5memdup0(realm, rlen, &retva... | CWE-119 | null | null |
35,104 | krb5_build_principal_va(krb5_context context,
krb5_principal princ,
unsigned int rlen,
const char *realm,
va_list ap)
{
return build_principal_va(context, princ, rlen, realm, ap);
}
| DoS Overflow | 0 | krb5_build_principal_va(krb5_context context,
krb5_principal princ,
unsigned int rlen,
const char *realm,
va_list ap)
{
return build_principal_va(context, princ, rlen, realm, ap);
}
| @@ -40,10 +40,8 @@ build_principal_va(krb5_context context, krb5_principal princ,
data = malloc(size * sizeof(krb5_data));
if (!data) { retval = ENOMEM; }
- if (!retval) {
- r = strdup(realm);
- if (!r) { retval = ENOMEM; }
- }
+ if (!retval)
+ r = k5memdup0(realm, rlen, &retva... | CWE-119 | null | null |
35,105 | krb5_gss_inquire_sec_context_by_oid (OM_uint32 *minor_status,
const gss_ctx_id_t context_handle,
const gss_OID desired_object,
gss_buffer_set_t *data_set)
{
krb5_gss_ctx_id_rec *ctx;
size_t i;
... | DoS | 0 | krb5_gss_inquire_sec_context_by_oid (OM_uint32 *minor_status,
const gss_ctx_id_t context_handle,
const gss_OID desired_object,
gss_buffer_set_t *data_set)
{
krb5_gss_ctx_id_rec *ctx;
size_t i;
... | @@ -351,7 +351,7 @@ static struct {
}
};
-static OM_uint32 KRB5_CALLCONV
+OM_uint32 KRB5_CALLCONV
krb5_gss_inquire_sec_context_by_oid (OM_uint32 *minor_status,
const gss_ctx_id_t context_handle,
const gss_OID desired_object,
@@ -465,7 ... | CWE-18 | null | null |
35,106 | krb5_gss_set_sec_context_option (OM_uint32 *minor_status,
gss_ctx_id_t *context_handle,
const gss_OID desired_object,
const gss_buffer_t value)
{
#if 0
size_t i;
#endif
if (minor_status == NULL)
return... | DoS | 0 | krb5_gss_set_sec_context_option (OM_uint32 *minor_status,
gss_ctx_id_t *context_handle,
const gss_OID desired_object,
const gss_buffer_t value)
{
#if 0
size_t i;
#endif
if (minor_status == NULL)
return... | @@ -351,7 +351,7 @@ static struct {
}
};
-static OM_uint32 KRB5_CALLCONV
+OM_uint32 KRB5_CALLCONV
krb5_gss_inquire_sec_context_by_oid (OM_uint32 *minor_status,
const gss_ctx_id_t context_handle,
const gss_OID desired_object,
@@ -465,7 ... | CWE-18 | null | null |
35,107 | acc_ctx_cont(OM_uint32 *minstat,
gss_buffer_t buf,
gss_ctx_id_t *ctx,
gss_buffer_t *responseToken,
gss_buffer_t *mechListMIC,
OM_uint32 *negState,
send_token_flag *return_token)
{
OM_uint32 ret, tmpmin;
gss_OID supportedMech;
spnego_gss_ctx_id_t sc;
unsigned int len;
unsigned ch... | DoS | 0 | acc_ctx_cont(OM_uint32 *minstat,
gss_buffer_t buf,
gss_ctx_id_t *ctx,
gss_buffer_t *responseToken,
gss_buffer_t *mechListMIC,
OM_uint32 *negState,
send_token_flag *return_token)
{
OM_uint32 ret, tmpmin;
gss_OID supportedMech;
spnego_gss_ctx_id_t sc;
unsigned int len;
unsigned ch... | @@ -102,7 +102,7 @@ static OM_uint32 get_negotiable_mechs(OM_uint32 *, spnego_gss_cred_id_t,
gss_cred_usage_t, gss_OID_set *);
static void release_spnego_ctx(spnego_gss_ctx_id_t *);
static void check_spnego_options(spnego_gss_ctx_id_t);
-static spnego_gss_ctx_id_t create_spnego_ctx(void);
+static spnego_gs... | CWE-18 | null | null |
35,108 | check_spnego_options(spnego_gss_ctx_id_t spnego_ctx)
{
spnego_ctx->optionStr = gssint_get_modOptions(
(const gss_OID)&spnego_oids[0]);
}
| DoS | 0 | check_spnego_options(spnego_gss_ctx_id_t spnego_ctx)
{
spnego_ctx->optionStr = gssint_get_modOptions(
(const gss_OID)&spnego_oids[0]);
}
| @@ -102,7 +102,7 @@ static OM_uint32 get_negotiable_mechs(OM_uint32 *, spnego_gss_cred_id_t,
gss_cred_usage_t, gss_OID_set *);
static void release_spnego_ctx(spnego_gss_ctx_id_t *);
static void check_spnego_options(spnego_gss_ctx_id_t);
-static spnego_gss_ctx_id_t create_spnego_ctx(void);
+static spnego_gs... | CWE-18 | null | null |
35,109 | create_spnego_cred(OM_uint32 *minor_status, gss_cred_id_t mcred,
spnego_gss_cred_id_t *cred_out)
{
spnego_gss_cred_id_t spcred;
*cred_out = NULL;
spcred = calloc(1, sizeof(spnego_gss_cred_id_rec));
if (spcred == NULL) {
*minor_status = ENOMEM;
return GSS_S_FAILURE;
}
spcred->mcred = mcred;
*cred_out = ... | DoS | 0 | create_spnego_cred(OM_uint32 *minor_status, gss_cred_id_t mcred,
spnego_gss_cred_id_t *cred_out)
{
spnego_gss_cred_id_t spcred;
*cred_out = NULL;
spcred = calloc(1, sizeof(spnego_gss_cred_id_rec));
if (spcred == NULL) {
*minor_status = ENOMEM;
return GSS_S_FAILURE;
}
spcred->mcred = mcred;
*cred_out = ... | @@ -102,7 +102,7 @@ static OM_uint32 get_negotiable_mechs(OM_uint32 *, spnego_gss_cred_id_t,
gss_cred_usage_t, gss_OID_set *);
static void release_spnego_ctx(spnego_gss_ctx_id_t *);
static void check_spnego_options(spnego_gss_ctx_id_t);
-static spnego_gss_ctx_id_t create_spnego_ctx(void);
+static spnego_gs... | CWE-18 | null | null |
35,110 | get_available_mechs(OM_uint32 *minor_status,
gss_name_t name, gss_cred_usage_t usage,
gss_const_key_value_set_t cred_store,
gss_cred_id_t *creds, gss_OID_set *rmechs, OM_uint32 *time_rec)
{
unsigned int i;
int found = 0;
OM_uint32 major_status = GSS_S_COMPLETE, tmpmin;
gss_OID_set mechs, goodmechs;
gss_OID_set... | DoS | 0 | get_available_mechs(OM_uint32 *minor_status,
gss_name_t name, gss_cred_usage_t usage,
gss_const_key_value_set_t cred_store,
gss_cred_id_t *creds, gss_OID_set *rmechs, OM_uint32 *time_rec)
{
unsigned int i;
int found = 0;
OM_uint32 major_status = GSS_S_COMPLETE, tmpmin;
gss_OID_set mechs, goodmechs;
gss_OID_set... | @@ -102,7 +102,7 @@ static OM_uint32 get_negotiable_mechs(OM_uint32 *, spnego_gss_cred_id_t,
gss_cred_usage_t, gss_OID_set *);
static void release_spnego_ctx(spnego_gss_ctx_id_t *);
static void check_spnego_options(spnego_gss_ctx_id_t);
-static spnego_gss_ctx_id_t create_spnego_ctx(void);
+static spnego_gs... | CWE-18 | null | null |
35,111 | init_ctx_call_init(OM_uint32 *minor_status,
spnego_gss_ctx_id_t sc,
spnego_gss_cred_id_t spcred,
gss_name_t target_name,
OM_uint32 req_flags,
OM_uint32 time_req,
gss_buffer_t mechtok_in,
gss_OID *actual_mech,
gss_buffer_t mechtok_out,
OM_uint32 *ret_flags,
OM_uint32 *ti... | DoS | 0 | init_ctx_call_init(OM_uint32 *minor_status,
spnego_gss_ctx_id_t sc,
spnego_gss_cred_id_t spcred,
gss_name_t target_name,
OM_uint32 req_flags,
OM_uint32 time_req,
gss_buffer_t mechtok_in,
gss_OID *actual_mech,
gss_buffer_t mechtok_out,
OM_uint32 *ret_flags,
OM_uint32 *ti... | @@ -102,7 +102,7 @@ static OM_uint32 get_negotiable_mechs(OM_uint32 *, spnego_gss_cred_id_t,
gss_cred_usage_t, gss_OID_set *);
static void release_spnego_ctx(spnego_gss_ctx_id_t *);
static void check_spnego_options(spnego_gss_ctx_id_t);
-static spnego_gss_ctx_id_t create_spnego_ctx(void);
+static spnego_gs... | CWE-18 | null | null |
35,112 | init_ctx_reselect(OM_uint32 *minor_status, spnego_gss_ctx_id_t sc,
OM_uint32 acc_negState, gss_OID supportedMech,
gss_buffer_t *responseToken, gss_buffer_t *mechListMIC,
OM_uint32 *negState, send_token_flag *tokflag)
{
OM_uint32 tmpmin;
size_t i;
gss_delete_sec_context(&tmpmin, &sc->ctx_handle,
... | DoS | 0 | init_ctx_reselect(OM_uint32 *minor_status, spnego_gss_ctx_id_t sc,
OM_uint32 acc_negState, gss_OID supportedMech,
gss_buffer_t *responseToken, gss_buffer_t *mechListMIC,
OM_uint32 *negState, send_token_flag *tokflag)
{
OM_uint32 tmpmin;
size_t i;
gss_delete_sec_context(&tmpmin, &sc->ctx_handle,
... | @@ -102,7 +102,7 @@ static OM_uint32 get_negotiable_mechs(OM_uint32 *, spnego_gss_cred_id_t,
gss_cred_usage_t, gss_OID_set *);
static void release_spnego_ctx(spnego_gss_ctx_id_t *);
static void check_spnego_options(spnego_gss_ctx_id_t);
-static spnego_gss_ctx_id_t create_spnego_ctx(void);
+static spnego_gs... | CWE-18 | null | null |
35,113 | make_NegHints(OM_uint32 *minor_status, gss_buffer_t *outbuf)
{
OM_uint32 major_status;
unsigned int tlen = 0;
unsigned int hintNameSize = 0;
unsigned char *ptr;
unsigned char *t;
const char *hintname = "not_defined_in_RFC4178@please_ignore";
const size_t hintname_len = strlen(hintname);
*outbuf = GSS_C_NO_BUFF... | DoS | 0 | make_NegHints(OM_uint32 *minor_status, gss_buffer_t *outbuf)
{
OM_uint32 major_status;
unsigned int tlen = 0;
unsigned int hintNameSize = 0;
unsigned char *ptr;
unsigned char *t;
const char *hintname = "not_defined_in_RFC4178@please_ignore";
const size_t hintname_len = strlen(hintname);
*outbuf = GSS_C_NO_BUFF... | @@ -102,7 +102,7 @@ static OM_uint32 get_negotiable_mechs(OM_uint32 *, spnego_gss_cred_id_t,
gss_cred_usage_t, gss_OID_set *);
static void release_spnego_ctx(spnego_gss_ctx_id_t *);
static void check_spnego_options(spnego_gss_ctx_id_t);
-static spnego_gss_ctx_id_t create_spnego_ctx(void);
+static spnego_gs... | CWE-18 | null | null |
35,114 | spnego_gss_acquire_cred_from(OM_uint32 *minor_status,
const gss_name_t desired_name,
OM_uint32 time_req,
const gss_OID_set desired_mechs,
gss_cred_usage_t cred_usage,
gss_const_key_value_set_t cred_store,
gss_cred_id_t *output_cred_handle,
gss_OID_set *actual_mech... | DoS | 0 | spnego_gss_acquire_cred_from(OM_uint32 *minor_status,
const gss_name_t desired_name,
OM_uint32 time_req,
const gss_OID_set desired_mechs,
gss_cred_usage_t cred_usage,
gss_const_key_value_set_t cred_store,
gss_cred_id_t *output_cred_handle,
gss_OID_set *actual_mech... | @@ -102,7 +102,7 @@ static OM_uint32 get_negotiable_mechs(OM_uint32 *, spnego_gss_cred_id_t,
gss_cred_usage_t, gss_OID_set *);
static void release_spnego_ctx(spnego_gss_ctx_id_t *);
static void check_spnego_options(spnego_gss_ctx_id_t);
-static spnego_gss_ctx_id_t create_spnego_ctx(void);
+static spnego_gs... | CWE-18 | null | null |
35,115 | spnego_gss_acquire_cred_impersonate_name(OM_uint32 *minor_status,
const gss_cred_id_t impersonator_cred_handle,
const gss_name_t desired_name,
OM_uint32 time_req,
gss_OID_set desired_mechs,
gss_cred_usage_t cred_usage,
gss_cred_id_t *output_cred_handle,
gss_OID_set *actual_mech... | DoS | 0 | spnego_gss_acquire_cred_impersonate_name(OM_uint32 *minor_status,
const gss_cred_id_t impersonator_cred_handle,
const gss_name_t desired_name,
OM_uint32 time_req,
gss_OID_set desired_mechs,
gss_cred_usage_t cred_usage,
gss_cred_id_t *output_cred_handle,
gss_OID_set *actual_mech... | @@ -102,7 +102,7 @@ static OM_uint32 get_negotiable_mechs(OM_uint32 *, spnego_gss_cred_id_t,
gss_cred_usage_t, gss_OID_set *);
static void release_spnego_ctx(spnego_gss_ctx_id_t *);
static void check_spnego_options(spnego_gss_ctx_id_t);
-static spnego_gss_ctx_id_t create_spnego_ctx(void);
+static spnego_gs... | CWE-18 | null | null |
35,116 | spnego_gss_acquire_cred_with_password(OM_uint32 *minor_status,
const gss_name_t desired_name,
const gss_buffer_t password,
OM_uint32 time_req,
const gss_OID_set desired_mechs,
gss_cred_usage_t cred_usage,
gss_cred_id_t *output_cred_handle,
gss_OID_se... | DoS | 0 | spnego_gss_acquire_cred_with_password(OM_uint32 *minor_status,
const gss_name_t desired_name,
const gss_buffer_t password,
OM_uint32 time_req,
const gss_OID_set desired_mechs,
gss_cred_usage_t cred_usage,
gss_cred_id_t *output_cred_handle,
gss_OID_se... | @@ -102,7 +102,7 @@ static OM_uint32 get_negotiable_mechs(OM_uint32 *, spnego_gss_cred_id_t,
gss_cred_usage_t, gss_OID_set *);
static void release_spnego_ctx(spnego_gss_ctx_id_t *);
static void check_spnego_options(spnego_gss_ctx_id_t);
-static spnego_gss_ctx_id_t create_spnego_ctx(void);
+static spnego_gs... | CWE-18 | null | null |
35,117 | spnego_gss_set_cred_option(
OM_uint32 *minor_status,
gss_cred_id_t *cred_handle,
const gss_OID desired_object,
const gss_buffer_t value)
{
OM_uint32 ret;
OM_uint32 tmp_minor_status;
spnego_gss_cred_id_t spcred = (spnego_gss_cred_id_t)*cred_handle;
gss_cred_id_t mcred;
mcred = (spcred == NULL) ? GSS_C_NO_C... | DoS | 0 | spnego_gss_set_cred_option(
OM_uint32 *minor_status,
gss_cred_id_t *cred_handle,
const gss_OID desired_object,
const gss_buffer_t value)
{
OM_uint32 ret;
OM_uint32 tmp_minor_status;
spnego_gss_cred_id_t spcred = (spnego_gss_cred_id_t)*cred_handle;
gss_cred_id_t mcred;
mcred = (spcred == NULL) ? GSS_C_NO_C... | @@ -102,7 +102,7 @@ static OM_uint32 get_negotiable_mechs(OM_uint32 *, spnego_gss_cred_id_t,
gss_cred_usage_t, gss_OID_set *);
static void release_spnego_ctx(spnego_gss_ctx_id_t *);
static void check_spnego_options(spnego_gss_ctx_id_t);
-static spnego_gss_ctx_id_t create_spnego_ctx(void);
+static spnego_gs... | CWE-18 | null | null |
35,118 | decrypt_encdata(krb5_context context, krb5_keyblock *armor_key,
krb5_pa_otp_req *req, krb5_data *out)
{
krb5_error_code retval;
krb5_data plaintext;
if (req == NULL)
return EINVAL;
retval = alloc_data(&plaintext, req->enc_data.ciphertext.length);
if (retval)
return ... | Bypass | 0 | decrypt_encdata(krb5_context context, krb5_keyblock *armor_key,
krb5_pa_otp_req *req, krb5_data *out)
{
krb5_error_code retval;
krb5_data plaintext;
if (req == NULL)
return EINVAL;
retval = alloc_data(&plaintext, req->enc_data.ciphertext.length);
if (retval)
return ... | @@ -42,6 +42,7 @@ static krb5_preauthtype otp_pa_type_list[] =
struct request_state {
krb5_kdcpreauth_verify_respond_fn respond;
void *arg;
+ krb5_enc_tkt_part *enc_tkt_reply;
};
static krb5_error_code
@@ -159,6 +160,9 @@ on_response(void *data, krb5_error_code retval, otp_response response)
if (... | CWE-264 | null | null |
35,119 | nonce_generate(krb5_context ctx, unsigned int length, krb5_data *nonce_out)
{
krb5_data nonce;
krb5_error_code retval;
krb5_timestamp now;
retval = krb5_timeofday(ctx, &now);
if (retval != 0)
return retval;
retval = alloc_data(&nonce, sizeof(now) + length);
if (retval != 0)
... | Bypass | 0 | nonce_generate(krb5_context ctx, unsigned int length, krb5_data *nonce_out)
{
krb5_data nonce;
krb5_error_code retval;
krb5_timestamp now;
retval = krb5_timeofday(ctx, &now);
if (retval != 0)
return retval;
retval = alloc_data(&nonce, sizeof(now) + length);
if (retval != 0)
... | @@ -42,6 +42,7 @@ static krb5_preauthtype otp_pa_type_list[] =
struct request_state {
krb5_kdcpreauth_verify_respond_fn respond;
void *arg;
+ krb5_enc_tkt_part *enc_tkt_reply;
};
static krb5_error_code
@@ -159,6 +160,9 @@ on_response(void *data, krb5_error_code retval, otp_response response)
if (... | CWE-264 | null | null |
35,120 | otp_edata(krb5_context context, krb5_kdc_req *request,
krb5_kdcpreauth_callbacks cb, krb5_kdcpreauth_rock rock,
krb5_kdcpreauth_moddata moddata, krb5_preauthtype pa_type,
krb5_kdcpreauth_edata_respond_fn respond, void *arg)
{
krb5_otp_tokeninfo ti, *tis[2] = { &ti, NULL };
krb5_key... | Bypass | 0 | otp_edata(krb5_context context, krb5_kdc_req *request,
krb5_kdcpreauth_callbacks cb, krb5_kdcpreauth_rock rock,
krb5_kdcpreauth_moddata moddata, krb5_preauthtype pa_type,
krb5_kdcpreauth_edata_respond_fn respond, void *arg)
{
krb5_otp_tokeninfo ti, *tis[2] = { &ti, NULL };
krb5_key... | @@ -42,6 +42,7 @@ static krb5_preauthtype otp_pa_type_list[] =
struct request_state {
krb5_kdcpreauth_verify_respond_fn respond;
void *arg;
+ krb5_enc_tkt_part *enc_tkt_reply;
};
static krb5_error_code
@@ -159,6 +160,9 @@ on_response(void *data, krb5_error_code retval, otp_response response)
if (... | CWE-264 | null | null |
35,121 | otp_fini(krb5_context context, krb5_kdcpreauth_moddata moddata)
{
otp_state_free((otp_state *)moddata);
}
| Bypass | 0 | otp_fini(krb5_context context, krb5_kdcpreauth_moddata moddata)
{
otp_state_free((otp_state *)moddata);
}
| @@ -42,6 +42,7 @@ static krb5_preauthtype otp_pa_type_list[] =
struct request_state {
krb5_kdcpreauth_verify_respond_fn respond;
void *arg;
+ krb5_enc_tkt_part *enc_tkt_reply;
};
static krb5_error_code
@@ -159,6 +160,9 @@ on_response(void *data, krb5_error_code retval, otp_response response)
if (... | CWE-264 | null | null |
35,122 | otp_flags(krb5_context context, krb5_preauthtype pa_type)
{
return PA_REPLACES_KEY;
}
| Bypass | 0 | otp_flags(krb5_context context, krb5_preauthtype pa_type)
{
return PA_REPLACES_KEY;
}
| @@ -42,6 +42,7 @@ static krb5_preauthtype otp_pa_type_list[] =
struct request_state {
krb5_kdcpreauth_verify_respond_fn respond;
void *arg;
+ krb5_enc_tkt_part *enc_tkt_reply;
};
static krb5_error_code
@@ -159,6 +160,9 @@ on_response(void *data, krb5_error_code retval, otp_response response)
if (... | CWE-264 | null | null |
35,123 | otp_init(krb5_context context, krb5_kdcpreauth_moddata *moddata_out,
const char **realmnames)
{
krb5_error_code retval;
otp_state *state;
retval = otp_state_new(context, &state);
if (retval)
return retval;
*moddata_out = (krb5_kdcpreauth_moddata)state;
return 0;
}
| Bypass | 0 | otp_init(krb5_context context, krb5_kdcpreauth_moddata *moddata_out,
const char **realmnames)
{
krb5_error_code retval;
otp_state *state;
retval = otp_state_new(context, &state);
if (retval)
return retval;
*moddata_out = (krb5_kdcpreauth_moddata)state;
return 0;
}
| @@ -42,6 +42,7 @@ static krb5_preauthtype otp_pa_type_list[] =
struct request_state {
krb5_kdcpreauth_verify_respond_fn respond;
void *arg;
+ krb5_enc_tkt_part *enc_tkt_reply;
};
static krb5_error_code
@@ -159,6 +160,9 @@ on_response(void *data, krb5_error_code retval, otp_response response)
if (... | CWE-264 | null | null |
35,124 | otp_return_padata(krb5_context context, krb5_pa_data *padata,
krb5_data *req_pkt, krb5_kdc_req *request,
krb5_kdc_rep *reply, krb5_keyblock *encrypting_key,
krb5_pa_data **send_pa_out, krb5_kdcpreauth_callbacks cb,
krb5_kdcpreauth_rock rock, krb5_k... | Bypass | 0 | otp_return_padata(krb5_context context, krb5_pa_data *padata,
krb5_data *req_pkt, krb5_kdc_req *request,
krb5_kdc_rep *reply, krb5_keyblock *encrypting_key,
krb5_pa_data **send_pa_out, krb5_kdcpreauth_callbacks cb,
krb5_kdcpreauth_rock rock, krb5_k... | @@ -42,6 +42,7 @@ static krb5_preauthtype otp_pa_type_list[] =
struct request_state {
krb5_kdcpreauth_verify_respond_fn respond;
void *arg;
+ krb5_enc_tkt_part *enc_tkt_reply;
};
static krb5_error_code
@@ -159,6 +160,9 @@ on_response(void *data, krb5_error_code retval, otp_response response)
if (... | CWE-264 | null | null |
35,125 | timestamp_verify(krb5_context ctx, const krb5_data *nonce)
{
krb5_error_code retval = EINVAL;
krb5_pa_enc_ts *et = NULL;
if (nonce->data == NULL)
goto out;
/* Decode the PA-ENC-TS-ENC structure. */
retval = decode_krb5_pa_enc_ts(nonce, &et);
if (retval != 0)
goto out;
/* C... | Bypass | 0 | timestamp_verify(krb5_context ctx, const krb5_data *nonce)
{
krb5_error_code retval = EINVAL;
krb5_pa_enc_ts *et = NULL;
if (nonce->data == NULL)
goto out;
/* Decode the PA-ENC-TS-ENC structure. */
retval = decode_krb5_pa_enc_ts(nonce, &et);
if (retval != 0)
goto out;
/* C... | @@ -42,6 +42,7 @@ static krb5_preauthtype otp_pa_type_list[] =
struct request_state {
krb5_kdcpreauth_verify_respond_fn respond;
void *arg;
+ krb5_enc_tkt_part *enc_tkt_reply;
};
static krb5_error_code
@@ -159,6 +160,9 @@ on_response(void *data, krb5_error_code retval, otp_response response)
if (... | CWE-264 | null | null |
35,126 | pkinit_fini_kdc_req_context(krb5_context context, void *ctx)
{
pkinit_kdc_req_context reqctx = (pkinit_kdc_req_context)ctx;
if (reqctx == NULL || reqctx->magic != PKINIT_CTX_MAGIC) {
pkiDebug("pkinit_fini_kdc_req_context: got bad reqctx (%p)!\n", reqctx);
return;
}
pkiDebug("%s: freeing... | Bypass | 0 | pkinit_fini_kdc_req_context(krb5_context context, void *ctx)
{
pkinit_kdc_req_context reqctx = (pkinit_kdc_req_context)ctx;
if (reqctx == NULL || reqctx->magic != PKINIT_CTX_MAGIC) {
pkiDebug("pkinit_fini_kdc_req_context: got bad reqctx (%p)!\n", reqctx);
return;
}
pkiDebug("%s: freeing... | @@ -301,7 +301,7 @@ pkinit_server_verify_padata(krb5_context context,
pkiDebug("pkinit_verify_padata: entered!\n");
if (data == NULL || data->length <= 0 || data->contents == NULL) {
- (*respond)(arg, 0, NULL, NULL, NULL);
+ (*respond)(arg, EINVAL, NULL, NULL, NULL);
return;
}
... | CWE-264 | null | null |
35,127 | pkinit_init_kdc_profile(krb5_context context, pkinit_kdc_context plgctx)
{
krb5_error_code retval;
char *eku_string = NULL;
pkiDebug("%s: entered for realm %s\n", __FUNCTION__, plgctx->realmname);
retval = pkinit_kdcdefault_string(context, plgctx->realmname,
KRB5_C... | Bypass | 0 | pkinit_init_kdc_profile(krb5_context context, pkinit_kdc_context plgctx)
{
krb5_error_code retval;
char *eku_string = NULL;
pkiDebug("%s: entered for realm %s\n", __FUNCTION__, plgctx->realmname);
retval = pkinit_kdcdefault_string(context, plgctx->realmname,
KRB5_C... | @@ -301,7 +301,7 @@ pkinit_server_verify_padata(krb5_context context,
pkiDebug("pkinit_verify_padata: entered!\n");
if (data == NULL || data->length <= 0 || data->contents == NULL) {
- (*respond)(arg, 0, NULL, NULL, NULL);
+ (*respond)(arg, EINVAL, NULL, NULL, NULL);
return;
}
... | CWE-264 | null | null |
35,128 | pkinit_pick_kdf_alg(krb5_context context, krb5_data **kdf_list,
krb5_data **alg_oid)
{
krb5_error_code retval = 0;
krb5_data *req_oid = NULL;
const krb5_data *supp_oid = NULL;
krb5_data *tmp_oid = NULL;
int i, j = 0;
/* if we don't find a match, return NULL value */
*alg... | Bypass | 0 | pkinit_pick_kdf_alg(krb5_context context, krb5_data **kdf_list,
krb5_data **alg_oid)
{
krb5_error_code retval = 0;
krb5_data *req_oid = NULL;
const krb5_data *supp_oid = NULL;
krb5_data *tmp_oid = NULL;
int i, j = 0;
/* if we don't find a match, return NULL value */
*alg... | @@ -301,7 +301,7 @@ pkinit_server_verify_padata(krb5_context context,
pkiDebug("pkinit_verify_padata: entered!\n");
if (data == NULL || data->length <= 0 || data->contents == NULL) {
- (*respond)(arg, 0, NULL, NULL, NULL);
+ (*respond)(arg, EINVAL, NULL, NULL, NULL);
return;
}
... | CWE-264 | null | null |
35,129 | pkinit_server_plugin_fini(krb5_context context,
krb5_kdcpreauth_moddata moddata)
{
pkinit_kdc_context *realm_contexts = (pkinit_kdc_context *)moddata;
int i;
if (realm_contexts == NULL)
return;
for (i = 0; realm_contexts[i] != NULL; i++) {
pkinit_server_plugin... | Bypass | 0 | pkinit_server_plugin_fini(krb5_context context,
krb5_kdcpreauth_moddata moddata)
{
pkinit_kdc_context *realm_contexts = (pkinit_kdc_context *)moddata;
int i;
if (realm_contexts == NULL)
return;
for (i = 0; realm_contexts[i] != NULL; i++) {
pkinit_server_plugin... | @@ -301,7 +301,7 @@ pkinit_server_verify_padata(krb5_context context,
pkiDebug("pkinit_verify_padata: entered!\n");
if (data == NULL || data->length <= 0 || data->contents == NULL) {
- (*respond)(arg, 0, NULL, NULL, NULL);
+ (*respond)(arg, EINVAL, NULL, NULL, NULL);
return;
}
... | CWE-264 | null | null |
35,130 | pkinit_server_plugin_init_realm(krb5_context context, const char *realmname,
pkinit_kdc_context *pplgctx)
{
krb5_error_code retval = ENOMEM;
pkinit_kdc_context plgctx = NULL;
*pplgctx = NULL;
plgctx = calloc(1, sizeof(*plgctx));
if (plgctx == NULL)
goto erro... | Bypass | 0 | pkinit_server_plugin_init_realm(krb5_context context, const char *realmname,
pkinit_kdc_context *pplgctx)
{
krb5_error_code retval = ENOMEM;
pkinit_kdc_context plgctx = NULL;
*pplgctx = NULL;
plgctx = calloc(1, sizeof(*plgctx));
if (plgctx == NULL)
goto erro... | @@ -301,7 +301,7 @@ pkinit_server_verify_padata(krb5_context context,
pkiDebug("pkinit_verify_padata: entered!\n");
if (data == NULL || data->length <= 0 || data->contents == NULL) {
- (*respond)(arg, 0, NULL, NULL, NULL);
+ (*respond)(arg, EINVAL, NULL, NULL, NULL);
return;
}
... | CWE-264 | null | null |
35,131 | pkinit_server_return_padata(krb5_context context,
krb5_pa_data * padata,
krb5_data *req_pkt,
krb5_kdc_req * request,
krb5_kdc_rep * reply,
krb5_keyblock * encrypting_key,
... | Bypass | 0 | pkinit_server_return_padata(krb5_context context,
krb5_pa_data * padata,
krb5_data *req_pkt,
krb5_kdc_req * request,
krb5_kdc_rep * reply,
krb5_keyblock * encrypting_key,
... | @@ -301,7 +301,7 @@ pkinit_server_verify_padata(krb5_context context,
pkiDebug("pkinit_verify_padata: entered!\n");
if (data == NULL || data->length <= 0 || data->contents == NULL) {
- (*respond)(arg, 0, NULL, NULL, NULL);
+ (*respond)(arg, EINVAL, NULL, NULL, NULL);
return;
}
... | CWE-264 | null | null |
35,132 | _load_ucode_intel_bsp(struct mc_saved_data *mc_saved_data,
unsigned long *mc_saved_in_initrd,
unsigned long initrd_start_early,
unsigned long initrd_end_early,
struct ucode_cpu_info *uci)
{
enum ucode_state ret;
collect_cpu_info_early(uci);
scan_microcode(initrd_start_early, initrd_e... | Overflow +Priv | 0 | _load_ucode_intel_bsp(struct mc_saved_data *mc_saved_data,
unsigned long *mc_saved_in_initrd,
unsigned long initrd_start_early,
unsigned long initrd_end_early,
struct ucode_cpu_info *uci)
{
enum ucode_state ret;
collect_cpu_info_early(uci);
scan_microcode(initrd_start_early, initrd_e... | @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,133 | static void _save_mc(struct microcode_intel **mc_saved, u8 *ucode_ptr,
unsigned int *mc_saved_count_p)
{
int i;
int found = 0;
unsigned int mc_saved_count = *mc_saved_count_p;
struct microcode_header_intel *mc_header;
mc_header = (struct microcode_header_intel *)ucode_ptr;
for (i = 0; i < mc_saved_count; ... | Overflow +Priv | 0 | static void _save_mc(struct microcode_intel **mc_saved, u8 *ucode_ptr,
unsigned int *mc_saved_count_p)
{
int i;
int found = 0;
unsigned int mc_saved_count = *mc_saved_count_p;
struct microcode_header_intel *mc_header;
mc_header = (struct microcode_header_intel *)ucode_ptr;
for (i = 0; i < mc_saved_count; ... | @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,134 | static int apply_microcode_early(struct ucode_cpu_info *uci, bool early)
{
struct microcode_intel *mc_intel;
unsigned int val[2];
mc_intel = uci->mc;
if (mc_intel == NULL)
return 0;
/* write microcode via MSR 0x79 */
native_wrmsr(MSR_IA32_UCODE_WRITE,
(unsigned long) mc_intel->bits,
(unsigned lo... | Overflow +Priv | 0 | static int apply_microcode_early(struct ucode_cpu_info *uci, bool early)
{
struct microcode_intel *mc_intel;
unsigned int val[2];
mc_intel = uci->mc;
if (mc_intel == NULL)
return 0;
/* write microcode via MSR 0x79 */
native_wrmsr(MSR_IA32_UCODE_WRITE,
(unsigned long) mc_intel->bits,
(unsigned lo... | @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,135 | static inline void flush_tlb_early(void)
{
__native_flush_tlb_global_irq_disabled();
}
| Overflow +Priv | 0 | static inline void flush_tlb_early(void)
{
__native_flush_tlb_global_irq_disabled();
}
| @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,136 | static u8 get_x86_family(unsigned long sig)
{
u8 x86;
x86 = (sig >> 8) & 0xf;
if (x86 == 0xf)
x86 += (sig >> 20) & 0xff;
return x86;
}
| Overflow +Priv | 0 | static u8 get_x86_family(unsigned long sig)
{
u8 x86;
x86 = (sig >> 8) & 0xf;
if (x86 == 0xf)
x86 += (sig >> 20) & 0xff;
return x86;
}
| @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,137 | static u8 get_x86_model(unsigned long sig)
{
u8 x86, x86_model;
x86 = get_x86_family(sig);
x86_model = (sig >> 4) & 0xf;
if (x86 == 0x6 || x86 == 0xf)
x86_model += ((sig >> 16) & 0xf) << 4;
return x86_model;
}
| Overflow +Priv | 0 | static u8 get_x86_model(unsigned long sig)
{
u8 x86, x86_model;
x86 = get_x86_family(sig);
x86_model = (sig >> 4) & 0xf;
if (x86 == 0x6 || x86 == 0xf)
x86_model += ((sig >> 16) & 0xf) << 4;
return x86_model;
}
| @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,138 | load_microcode(struct mc_saved_data *mc_saved_data,
unsigned long *mc_saved_in_initrd,
unsigned long initrd_start,
struct ucode_cpu_info *uci)
{
struct microcode_intel *mc_saved_tmp[MAX_UCODE_COUNT];
unsigned int count = mc_saved_data->mc_saved_count;
if (!mc_saved_data->mc_saved) {
microc... | Overflow +Priv | 0 | load_microcode(struct mc_saved_data *mc_saved_data,
unsigned long *mc_saved_in_initrd,
unsigned long initrd_start,
struct ucode_cpu_info *uci)
{
struct microcode_intel *mc_saved_tmp[MAX_UCODE_COUNT];
unsigned int count = mc_saved_data->mc_saved_count;
if (!mc_saved_data->mc_saved) {
microc... | @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,139 | void load_ucode_intel_ap(void)
{
struct mc_saved_data *mc_saved_data_p;
struct ucode_cpu_info uci;
unsigned long *mc_saved_in_initrd_p;
unsigned long initrd_start_addr;
#ifdef CONFIG_X86_32
unsigned long *initrd_start_p;
mc_saved_in_initrd_p =
(unsigned long *)__pa_nodebug(mc_saved_in_initrd);
mc_saved_data_p... | Overflow +Priv | 0 | void load_ucode_intel_ap(void)
{
struct mc_saved_data *mc_saved_data_p;
struct ucode_cpu_info uci;
unsigned long *mc_saved_in_initrd_p;
unsigned long initrd_start_addr;
#ifdef CONFIG_X86_32
unsigned long *initrd_start_p;
mc_saved_in_initrd_p =
(unsigned long *)__pa_nodebug(mc_saved_in_initrd);
mc_saved_data_p... | @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,140 | load_ucode_intel_bsp(void)
{
u64 ramdisk_image, ramdisk_size;
unsigned long initrd_start_early, initrd_end_early;
struct ucode_cpu_info uci;
#ifdef CONFIG_X86_32
struct boot_params *boot_params_p;
boot_params_p = (struct boot_params *)__pa_nodebug(&boot_params);
ramdisk_image = boot_params_p->hdr.ramdisk_image;
... | Overflow +Priv | 0 | load_ucode_intel_bsp(void)
{
u64 ramdisk_image, ramdisk_size;
unsigned long initrd_start_early, initrd_end_early;
struct ucode_cpu_info uci;
#ifdef CONFIG_X86_32
struct boot_params *boot_params_p;
boot_params_p = (struct boot_params *)__pa_nodebug(&boot_params);
ramdisk_image = boot_params_p->hdr.ramdisk_image;
... | @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,141 | matching_model_microcode(struct microcode_header_intel *mc_header,
unsigned long sig)
{
u8 x86, x86_model;
u8 x86_ucode, x86_model_ucode;
struct extended_sigtable *ext_header;
unsigned long total_size = get_totalsize(mc_header);
unsigned long data_size = get_datasize(mc_header);
int ext_sigcount, i;
struct ex... | Overflow +Priv | 0 | matching_model_microcode(struct microcode_header_intel *mc_header,
unsigned long sig)
{
u8 x86, x86_model;
u8 x86_ucode, x86_model_ucode;
struct extended_sigtable *ext_header;
unsigned long total_size = get_totalsize(mc_header);
unsigned long data_size = get_datasize(mc_header);
int ext_sigcount, i;
struct ex... | @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,142 | microcode_phys(struct microcode_intel **mc_saved_tmp,
struct mc_saved_data *mc_saved_data)
{
int i;
struct microcode_intel ***mc_saved;
mc_saved = (struct microcode_intel ***)
__pa_nodebug(&mc_saved_data->mc_saved);
for (i = 0; i < mc_saved_data->mc_saved_count; i++) {
struct microcode_intel *p;
... | Overflow +Priv | 0 | microcode_phys(struct microcode_intel **mc_saved_tmp,
struct mc_saved_data *mc_saved_data)
{
int i;
struct microcode_intel ***mc_saved;
mc_saved = (struct microcode_intel ***)
__pa_nodebug(&mc_saved_data->mc_saved);
for (i = 0; i < mc_saved_data->mc_saved_count; i++) {
struct microcode_intel *p;
... | @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,143 | microcode_pointer(struct microcode_intel **mc_saved,
unsigned long *mc_saved_in_initrd,
unsigned long initrd_start, int mc_saved_count)
{
int i;
for (i = 0; i < mc_saved_count; i++)
mc_saved[i] = (struct microcode_intel *)
(mc_saved_in_initrd[i] + initrd_start);
}
| Overflow +Priv | 0 | microcode_pointer(struct microcode_intel **mc_saved,
unsigned long *mc_saved_in_initrd,
unsigned long initrd_start, int mc_saved_count)
{
int i;
for (i = 0; i < mc_saved_count; i++)
mc_saved[i] = (struct microcode_intel *)
(mc_saved_in_initrd[i] + initrd_start);
}
| @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,144 | static void print_ucode(struct ucode_cpu_info *uci)
{
struct microcode_intel *mc_intel;
int *delay_ucode_info_p;
int *current_mc_date_p;
mc_intel = uci->mc;
if (mc_intel == NULL)
return;
delay_ucode_info_p = (int *)__pa_nodebug(&delay_ucode_info);
current_mc_date_p = (int *)__pa_nodebug(¤t_mc_date);
... | Overflow +Priv | 0 | static void print_ucode(struct ucode_cpu_info *uci)
{
struct microcode_intel *mc_intel;
int *delay_ucode_info_p;
int *current_mc_date_p;
mc_intel = uci->mc;
if (mc_intel == NULL)
return;
delay_ucode_info_p = (int *)__pa_nodebug(&delay_ucode_info);
current_mc_date_p = (int *)__pa_nodebug(¤t_mc_date);
... | @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,145 | static inline void print_ucode(struct ucode_cpu_info *uci)
{
struct microcode_intel *mc_intel;
mc_intel = uci->mc;
if (mc_intel == NULL)
return;
print_ucode_info(uci, mc_intel->hdr.date);
}
| Overflow +Priv | 0 | static inline void print_ucode(struct ucode_cpu_info *uci)
{
struct microcode_intel *mc_intel;
mc_intel = uci->mc;
if (mc_intel == NULL)
return;
print_ucode_info(uci, mc_intel->hdr.date);
}
| @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,146 | print_ucode_info(struct ucode_cpu_info *uci, unsigned int date)
{
int cpu = smp_processor_id();
pr_info("CPU%d microcode updated early to revision 0x%x, date = %04x-%02x-%02x\n",
cpu,
uci->cpu_sig.rev,
date & 0xffff,
date >> 24,
(date >> 16) & 0xff);
}
| Overflow +Priv | 0 | print_ucode_info(struct ucode_cpu_info *uci, unsigned int date)
{
int cpu = smp_processor_id();
pr_info("CPU%d microcode updated early to revision 0x%x, date = %04x-%02x-%02x\n",
cpu,
uci->cpu_sig.rev,
date & 0xffff,
date >> 24,
(date >> 16) & 0xff);
}
| @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,147 | int save_mc_for_early(u8 *mc)
{
struct microcode_intel *mc_saved_tmp[MAX_UCODE_COUNT];
unsigned int mc_saved_count_init;
unsigned int mc_saved_count;
struct microcode_intel **mc_saved;
int ret = 0;
int i;
/*
* Hold hotplug lock so mc_saved_data is not accessed by a CPU in
* hotplug.
*/
mutex_lock(&x86_cp... | Overflow +Priv | 0 | int save_mc_for_early(u8 *mc)
{
struct microcode_intel *mc_saved_tmp[MAX_UCODE_COUNT];
unsigned int mc_saved_count_init;
unsigned int mc_saved_count;
struct microcode_intel **mc_saved;
int ret = 0;
int i;
/*
* Hold hotplug lock so mc_saved_data is not accessed by a CPU in
* hotplug.
*/
mutex_lock(&x86_cp... | @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,148 | save_microcode(struct mc_saved_data *mc_saved_data,
struct microcode_intel **mc_saved_src,
unsigned int mc_saved_count)
{
int i, j;
struct microcode_intel **mc_saved_p;
int ret;
if (!mc_saved_count)
return -EINVAL;
/*
* Copy new microcode data.
*/
mc_saved_p = kmalloc(mc_saved_count*sizeof... | Overflow +Priv | 0 | save_microcode(struct mc_saved_data *mc_saved_data,
struct microcode_intel **mc_saved_src,
unsigned int mc_saved_count)
{
int i, j;
struct microcode_intel **mc_saved_p;
int ret;
if (!mc_saved_count)
return -EINVAL;
/*
* Copy new microcode data.
*/
mc_saved_p = kmalloc(mc_saved_count*sizeof... | @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,149 | int __init save_microcode_in_initrd_intel(void)
{
unsigned int count = mc_saved_data.mc_saved_count;
struct microcode_intel *mc_saved[MAX_UCODE_COUNT];
int ret = 0;
if (count == 0)
return ret;
microcode_pointer(mc_saved, mc_saved_in_initrd, initrd_start, count);
ret = save_microcode(&mc_saved_data, mc_saved, ... | Overflow +Priv | 0 | int __init save_microcode_in_initrd_intel(void)
{
unsigned int count = mc_saved_data.mc_saved_count;
struct microcode_intel *mc_saved[MAX_UCODE_COUNT];
int ret = 0;
if (count == 0)
return ret;
microcode_pointer(mc_saved, mc_saved_in_initrd, initrd_start, count);
ret = save_microcode(&mc_saved_data, mc_saved, ... | @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,150 | scan_microcode(unsigned long start, unsigned long end,
struct mc_saved_data *mc_saved_data,
unsigned long *mc_saved_in_initrd,
struct ucode_cpu_info *uci)
{
unsigned int size = end - start + 1;
struct cpio_data cd;
long offset = 0;
#ifdef CONFIG_X86_32
char *p = (char *)__pa_nodebug(ucode_name);
#else
char *... | Overflow +Priv | 0 | scan_microcode(unsigned long start, unsigned long end,
struct mc_saved_data *mc_saved_data,
unsigned long *mc_saved_in_initrd,
struct ucode_cpu_info *uci)
{
unsigned int size = end - start + 1;
struct cpio_data cd;
long offset = 0;
#ifdef CONFIG_X86_32
char *p = (char *)__pa_nodebug(ucode_name);
#else
char *... | @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,151 | static void __ref show_saved_mc(void)
{
int i, j;
unsigned int sig, pf, rev, total_size, data_size, date;
struct ucode_cpu_info uci;
if (mc_saved_data.mc_saved_count == 0) {
pr_debug("no microcode data saved.\n");
return;
}
pr_debug("Total microcode saved: %d\n", mc_saved_data.mc_saved_count);
collect_cpu_... | Overflow +Priv | 0 | static void __ref show_saved_mc(void)
{
int i, j;
unsigned int sig, pf, rev, total_size, data_size, date;
struct ucode_cpu_info uci;
if (mc_saved_data.mc_saved_count == 0) {
pr_debug("no microcode data saved.\n");
return;
}
pr_debug("Total microcode saved: %d\n", mc_saved_data.mc_saved_count);
collect_cpu_... | @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,152 | static inline void show_saved_mc(void)
{
}
| Overflow +Priv | 0 | static inline void show_saved_mc(void)
{
}
| @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,153 | void show_ucode_info_early(void)
{
struct ucode_cpu_info uci;
if (delay_ucode_info) {
collect_cpu_info_early(&uci);
print_ucode_info(&uci, current_mc_date);
delay_ucode_info = 0;
}
}
| Overflow +Priv | 0 | void show_ucode_info_early(void)
{
struct ucode_cpu_info uci;
if (delay_ucode_info) {
collect_cpu_info_early(&uci);
print_ucode_info(&uci, current_mc_date);
delay_ucode_info = 0;
}
}
| @@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start,
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
int i;
- while (leftover) {
+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_to... | CWE-119 | null | null |
35,154 | cpio_i64toa(int64_t n0)
{
/* 2^64 =~ 1.8 * 10^19, so 20 decimal digits suffice.
* We also need 1 byte for '-' and 1 for '\0'.
*/
static char buff[22];
int64_t n = n0 < 0 ? -n0 : n0;
char *p = buff + sizeof(buff);
*--p = '\0';
do {
*--p = '0' + (int)(n % 10);
n /= 10;
} while (n > 0);
if (n0 < 0)
*--p... | Dir. Trav. | 0 | cpio_i64toa(int64_t n0)
{
/* 2^64 =~ 1.8 * 10^19, so 20 decimal digits suffice.
* We also need 1 byte for '-' and 1 for '\0'.
*/
static char buff[22];
int64_t n = n0 < 0 ? -n0 : n0;
char *p = buff + sizeof(buff);
*--p = '\0';
do {
*--p = '0' + (int)(n % 10);
n /= 10;
} while (n > 0);
if (n0 < 0)
*--p... | @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,155 | cpio_rename(const char *name)
{
static char buff[1024];
FILE *t;
char *p, *ret;
#if defined(_WIN32) && !defined(__CYGWIN__)
FILE *to;
t = fopen("CONIN$", "r");
if (t == NULL)
return (name);
to = fopen("CONOUT$", "w");
if (to == NULL) {
fclose(t);
return (name);
}
fprintf(to, "%s (Enter/./(new name))? "... | Dir. Trav. | 0 | cpio_rename(const char *name)
{
static char buff[1024];
FILE *t;
char *p, *ret;
#if defined(_WIN32) && !defined(__CYGWIN__)
FILE *to;
t = fopen("CONIN$", "r");
if (t == NULL)
return (name);
to = fopen("CONOUT$", "w");
if (to == NULL) {
fclose(t);
return (name);
}
fprintf(to, "%s (Enter/./(new name))? "... | @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,156 | entry_to_archive(struct cpio *cpio, struct archive_entry *entry)
{
const char *destpath = archive_entry_pathname(entry);
const char *srcpath = archive_entry_sourcepath(entry);
int fd = -1;
ssize_t bytes_read;
int r;
/* Print out the destination name to the user. */
if (cpio->verbose)
fprintf(stderr,"%s", dest... | Dir. Trav. | 0 | entry_to_archive(struct cpio *cpio, struct archive_entry *entry)
{
const char *destpath = archive_entry_pathname(entry);
const char *srcpath = archive_entry_sourcepath(entry);
int fd = -1;
ssize_t bytes_read;
int r;
/* Print out the destination name to the user. */
if (cpio->verbose)
fprintf(stderr,"%s", dest... | @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,157 | file_to_archive(struct cpio *cpio, const char *srcpath)
{
const char *destpath;
struct archive_entry *entry, *spare;
size_t len;
int r;
/*
* Create an archive_entry describing the source file.
*
*/
entry = archive_entry_new();
if (entry == NULL)
lafe_errc(1, 0, "Couldn't allocate entry");
archive_entry... | Dir. Trav. | 0 | file_to_archive(struct cpio *cpio, const char *srcpath)
{
const char *destpath;
struct archive_entry *entry, *spare;
size_t len;
int r;
/*
* Create an archive_entry describing the source file.
*
*/
entry = archive_entry_new();
if (entry == NULL)
lafe_errc(1, 0, "Couldn't allocate entry");
archive_entry... | @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,158 | list_item_verbose(struct cpio *cpio, struct archive_entry *entry)
{
char size[32];
char date[32];
char uids[16], gids[16];
const char *uname, *gname;
FILE *out = stdout;
const char *fmt;
time_t mtime;
static time_t now;
if (!now)
time(&now);
if (cpio->option_numeric_uid_gid) {
/* Form... | Dir. Trav. | 0 | list_item_verbose(struct cpio *cpio, struct archive_entry *entry)
{
char size[32];
char date[32];
char uids[16], gids[16];
const char *uname, *gname;
FILE *out = stdout;
const char *fmt;
time_t mtime;
static time_t now;
if (!now)
time(&now);
if (cpio->option_numeric_uid_gid) {
/* Form... | @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,159 | long_help(void)
{
const char *prog;
const char *p;
prog = lafe_getprogname();
fflush(stderr);
p = (strcmp(prog,"bsdcpio") != 0) ? "(bsdcpio)" : "";
printf("%s%s: manipulate archive files\n", prog, p);
for (p = long_help_msg; *p != '\0'; p++) {
if (*p == '%') {
if (p[1] == 'p') {
fputs(prog, stdout);... | Dir. Trav. | 0 | long_help(void)
{
const char *prog;
const char *p;
prog = lafe_getprogname();
fflush(stderr);
p = (strcmp(prog,"bsdcpio") != 0) ? "(bsdcpio)" : "";
printf("%s%s: manipulate archive files\n", prog, p);
for (p = long_help_msg; *p != '\0'; p++) {
if (*p == '%') {
if (p[1] == 'p') {
fputs(prog, stdout);... | @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,160 | lookup_gname(struct cpio *cpio, gid_t gid)
{
return (lookup_name(cpio, &cpio->gname_cache,
&lookup_gname_helper, (id_t)gid));
}
| Dir. Trav. | 0 | lookup_gname(struct cpio *cpio, gid_t gid)
{
return (lookup_name(cpio, &cpio->gname_cache,
&lookup_gname_helper, (id_t)gid));
}
| @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,161 | lookup_gname_helper(struct cpio *cpio, const char **name, id_t id)
{
struct group *grent;
(void)cpio; /* UNUSED */
errno = 0;
grent = getgrgid((gid_t)id);
if (grent == NULL) {
*name = NULL;
if (errno != 0)
lafe_warnc(errno, "getgrgid(%s) failed",
cpio_i64toa((int64_t)id));
return (errno);
}
*n... | Dir. Trav. | 0 | lookup_gname_helper(struct cpio *cpio, const char **name, id_t id)
{
struct group *grent;
(void)cpio; /* UNUSED */
errno = 0;
grent = getgrgid((gid_t)id);
if (grent == NULL) {
*name = NULL;
if (errno != 0)
lafe_warnc(errno, "getgrgid(%s) failed",
cpio_i64toa((int64_t)id));
return (errno);
}
*n... | @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,162 | lookup_name(struct cpio *cpio, struct name_cache **name_cache_variable,
int (*lookup_fn)(struct cpio *, const char **, id_t), id_t id)
{
char asnum[16];
struct name_cache *cache;
const char *name;
int slot;
if (*name_cache_variable == NULL) {
*name_cache_variable = malloc(sizeof(struct name_cache));
if (... | Dir. Trav. | 0 | lookup_name(struct cpio *cpio, struct name_cache **name_cache_variable,
int (*lookup_fn)(struct cpio *, const char **, id_t), id_t id)
{
char asnum[16];
struct name_cache *cache;
const char *name;
int slot;
if (*name_cache_variable == NULL) {
*name_cache_variable = malloc(sizeof(struct name_cache));
if (... | @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,163 | mode_in(struct cpio *cpio)
{
struct archive *a;
struct archive_entry *entry;
struct archive *ext;
const char *destpath;
int r;
ext = archive_write_disk_new();
if (ext == NULL)
lafe_errc(1, 0, "Couldn't allocate restore object");
r = archive_write_disk_set_options(ext, cpio->extract_flags);
if (r != ARCHIVE_... | Dir. Trav. | 0 | mode_in(struct cpio *cpio)
{
struct archive *a;
struct archive_entry *entry;
struct archive *ext;
const char *destpath;
int r;
ext = archive_write_disk_new();
if (ext == NULL)
lafe_errc(1, 0, "Couldn't allocate restore object");
r = archive_write_disk_set_options(ext, cpio->extract_flags);
if (r != ARCHIVE_... | @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,164 | mode_list(struct cpio *cpio)
{
struct archive *a;
struct archive_entry *entry;
int r;
a = archive_read_new();
if (a == NULL)
lafe_errc(1, 0, "Couldn't allocate archive object");
archive_read_support_filter_all(a);
archive_read_support_format_all(a);
if (cpio->passphrase != NULL)
r = archive_read_add_passph... | Dir. Trav. | 0 | mode_list(struct cpio *cpio)
{
struct archive *a;
struct archive_entry *entry;
int r;
a = archive_read_new();
if (a == NULL)
lafe_errc(1, 0, "Couldn't allocate archive object");
archive_read_support_filter_all(a);
archive_read_support_format_all(a);
if (cpio->passphrase != NULL)
r = archive_read_add_passph... | @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,165 | mode_pass(struct cpio *cpio, const char *destdir)
{
struct lafe_line_reader *lr;
const char *p;
int r;
/* Ensure target dir has a trailing '/' to simplify path surgery. */
cpio->destdir = malloc(strlen(destdir) + 8);
strcpy(cpio->destdir, destdir);
if (destdir[strlen(destdir) - 1] != '/')
strcat(cpio->destdir... | Dir. Trav. | 0 | mode_pass(struct cpio *cpio, const char *destdir)
{
struct lafe_line_reader *lr;
const char *p;
int r;
/* Ensure target dir has a trailing '/' to simplify path surgery. */
cpio->destdir = malloc(strlen(destdir) + 8);
strcpy(cpio->destdir, destdir);
if (destdir[strlen(destdir) - 1] != '/')
strcat(cpio->destdir... | @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,166 | passphrase_free(char *ppbuff)
{
if (ppbuff != NULL) {
memset(ppbuff, 0, PPBUFF_SIZE);
free(ppbuff);
}
}
| Dir. Trav. | 0 | passphrase_free(char *ppbuff)
{
if (ppbuff != NULL) {
memset(ppbuff, 0, PPBUFF_SIZE);
free(ppbuff);
}
}
| @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,167 | remove_leading_slash(const char *p)
{
const char *rp;
/* Remove leading "//./" or "//?/" or "//?/UNC/"
* (absolute path prefixes used by Windows API) */
if ((p[0] == '/' || p[0] == '\\') &&
(p[1] == '/' || p[1] == '\\') &&
(p[2] == '.' || p[2] == '?') &&
(p[3] == '/' || p[3] == '\\'))
{
if (p[2]... | Dir. Trav. | 0 | remove_leading_slash(const char *p)
{
const char *rp;
/* Remove leading "//./" or "//?/" or "//?/UNC/"
* (absolute path prefixes used by Windows API) */
if ((p[0] == '/' || p[0] == '\\') &&
(p[1] == '/' || p[1] == '\\') &&
(p[2] == '.' || p[2] == '?') &&
(p[3] == '/' || p[3] == '\\'))
{
if (p[2]... | @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,168 | restore_time(struct cpio *cpio, struct archive_entry *entry,
const char *name, int fd)
{
#ifndef HAVE_UTIMES
static int warned = 0;
(void)cpio; /* UNUSED */
(void)entry; /* UNUSED */
(void)name; /* UNUSED */
if (!warned)
lafe_warnc(0, "Can't restore access times on this platform");
warned = 1;
return (fd... | Dir. Trav. | 0 | restore_time(struct cpio *cpio, struct archive_entry *entry,
const char *name, int fd)
{
#ifndef HAVE_UTIMES
static int warned = 0;
(void)cpio; /* UNUSED */
(void)entry; /* UNUSED */
(void)name; /* UNUSED */
if (!warned)
lafe_warnc(0, "Can't restore access times on this platform");
warned = 1;
return (fd... | @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,169 | usage(void)
{
const char *p;
p = lafe_getprogname();
fprintf(stderr, "Brief Usage:\n");
fprintf(stderr, " List: %s -it < archive\n", p);
fprintf(stderr, " Extract: %s -i < archive\n", p);
fprintf(stderr, " Create: %s -o < filenames > archive\n", p);
fprintf(stderr, " Help: %s --help\n", p);
exit(1)... | Dir. Trav. | 0 | usage(void)
{
const char *p;
p = lafe_getprogname();
fprintf(stderr, "Brief Usage:\n");
fprintf(stderr, " List: %s -it < archive\n", p);
fprintf(stderr, " Extract: %s -i < archive\n", p);
fprintf(stderr, " Create: %s -o < filenames > archive\n", p);
fprintf(stderr, " Help: %s --help\n", p);
exit(1)... | @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,170 | version(void)
{
fprintf(stdout,"bsdcpio %s -- %s\n",
BSDCPIO_VERSION_STRING,
archive_version_details());
exit(0);
}
| Dir. Trav. | 0 | version(void)
{
fprintf(stdout,"bsdcpio %s -- %s\n",
BSDCPIO_VERSION_STRING,
archive_version_details());
exit(0);
}
| @@ -171,6 +171,7 @@ main(int argc, char *argv[])
cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
cpio->extract_flags |= ARCH... | CWE-22 | null | null |
35,171 | _archive_write_disk_close(struct archive *_a)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
struct fixup_entry *next, *p;
int ret;
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA,
"archive_write_disk_close");
ret = _archive_write_d... | Dir. Trav. | 0 | _archive_write_disk_close(struct archive *_a)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
struct fixup_entry *next, *p;
int ret;
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA,
"archive_write_disk_close");
ret = _archive_write_d... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,172 | _archive_write_disk_data(struct archive *_a, const void *buff, size_t size)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_DATA, "archive_write_data");
if (a->todo & TODO_HFS_COMPRESSION)
return (hfs_write_data_block... | Dir. Trav. | 0 | _archive_write_disk_data(struct archive *_a, const void *buff, size_t size)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_DATA, "archive_write_data");
if (a->todo & TODO_HFS_COMPRESSION)
return (hfs_write_data_block... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,173 | _archive_write_disk_free(struct archive *_a)
{
struct archive_write_disk *a;
int ret;
if (_a == NULL)
return (ARCHIVE_OK);
archive_check_magic(_a, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, "archive_write_disk_free");
a = (struct archive_write_disk *)_a;
ret = _archive_write_disk_cl... | Dir. Trav. | 0 | _archive_write_disk_free(struct archive *_a)
{
struct archive_write_disk *a;
int ret;
if (_a == NULL)
return (ARCHIVE_OK);
archive_check_magic(_a, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, "archive_write_disk_free");
a = (struct archive_write_disk *)_a;
ret = _archive_write_disk_cl... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,174 | _archive_write_disk_header(struct archive *_a, struct archive_entry *entry)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
struct fixup_entry *fe;
int ret, r;
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA,
"archive_write_disk_heade... | Dir. Trav. | 0 | _archive_write_disk_header(struct archive *_a, struct archive_entry *entry)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
struct fixup_entry *fe;
int ret, r;
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA,
"archive_write_disk_heade... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,175 | archive_write_disk_set_group_lookup(struct archive *_a,
void *private_data,
int64_t (*lookup_gid)(void *private, const char *gname, int64_t gid),
void (*cleanup_gid)(void *private))
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,... | Dir. Trav. | 0 | archive_write_disk_set_group_lookup(struct archive *_a,
void *private_data,
int64_t (*lookup_gid)(void *private, const char *gname, int64_t gid),
void (*cleanup_gid)(void *private))
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,176 | archive_write_disk_set_options(struct archive *_a, int flags)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
a->flags = flags;
return (ARCHIVE_OK);
}
| Dir. Trav. | 0 | archive_write_disk_set_options(struct archive *_a, int flags)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
a->flags = flags;
return (ARCHIVE_OK);
}
| @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,177 | archive_write_disk_set_skip_file(struct archive *_a, int64_t d, int64_t i)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_ANY, "archive_write_disk_set_skip_file");
a->skip_file_set = 1;
a->skip_file_dev = d;
a->skip_fi... | Dir. Trav. | 0 | archive_write_disk_set_skip_file(struct archive *_a, int64_t d, int64_t i)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_ANY, "archive_write_disk_set_skip_file");
a->skip_file_set = 1;
a->skip_file_dev = d;
a->skip_fi... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,178 | archive_write_disk_uid(struct archive *_a, const char *name, int64_t id)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_ANY, "archive_write_disk_uid");
if (a->lookup_uid)
return (a->lookup_uid)(a->lookup_uid_data, name... | Dir. Trav. | 0 | archive_write_disk_uid(struct archive *_a, const char *name, int64_t id)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_ANY, "archive_write_disk_uid");
if (a->lookup_uid)
return (a->lookup_uid)(a->lookup_uid_data, name... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,179 | archive_write_disk_vtable(void)
{
static struct archive_vtable av;
static int inited = 0;
if (!inited) {
av.archive_close = _archive_write_disk_close;
av.archive_filter_bytes = _archive_write_disk_filter_bytes;
av.archive_free = _archive_write_disk_free;
av.archive_write_header = _archive_write_disk_header;... | Dir. Trav. | 0 | archive_write_disk_vtable(void)
{
static struct archive_vtable av;
static int inited = 0;
if (!inited) {
av.archive_close = _archive_write_disk_close;
av.archive_filter_bytes = _archive_write_disk_filter_bytes;
av.archive_free = _archive_write_disk_free;
av.archive_write_header = _archive_write_disk_header;... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,180 | check_symlinks(struct archive_write_disk *a)
{
#if !defined(HAVE_LSTAT)
/* Platform doesn't have lstat, so we can't look for symlinks. */
(void)a; /* UNUSED */
return (ARCHIVE_OK);
#else
char *pn;
char c;
int r;
struct stat st;
/*
* Guard against symlink tricks. Reject any archive entry whose
* destinatio... | Dir. Trav. | 0 | check_symlinks(struct archive_write_disk *a)
{
#if !defined(HAVE_LSTAT)
/* Platform doesn't have lstat, so we can't look for symlinks. */
(void)a; /* UNUSED */
return (ARCHIVE_OK);
#else
char *pn;
char c;
int r;
struct stat st;
/*
* Guard against symlink tricks. Reject any archive entry whose
* destinatio... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,181 | cleanup_pathname_win(struct archive_write_disk *a)
{
wchar_t wc;
char *p;
size_t alen, l;
int mb, complete, utf8;
alen = 0;
mb = 0;
complete = 1;
utf8 = (strcmp(nl_langinfo(CODESET), "UTF-8") == 0)? 1: 0;
for (p = a->name; *p != '\0'; p++) {
++alen;
if (*p == '\\') {
/* If previous byte is smaller than... | Dir. Trav. | 0 | cleanup_pathname_win(struct archive_write_disk *a)
{
wchar_t wc;
char *p;
size_t alen, l;
int mb, complete, utf8;
alen = 0;
mb = 0;
complete = 1;
utf8 = (strcmp(nl_langinfo(CODESET), "UTF-8") == 0)? 1: 0;
for (p = a->name; *p != '\0'; p++) {
++alen;
if (*p == '\\') {
/* If previous byte is smaller than... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,182 | copy_metadata(struct archive_write_disk *a, const char *metadata,
const char *datafork, int datafork_compressed)
{
int ret = ARCHIVE_OK;
if (datafork_compressed) {
int dffd, tmpfd;
tmpfd = create_tempdatafork(a, metadata);
if (tmpfd == -1)
return (ARCHIVE_WARN);
/*
* Do not open the data fork com... | Dir. Trav. | 0 | copy_metadata(struct archive_write_disk *a, const char *metadata,
const char *datafork, int datafork_compressed)
{
int ret = ARCHIVE_OK;
if (datafork_compressed) {
int dffd, tmpfd;
tmpfd = create_tempdatafork(a, metadata);
if (tmpfd == -1)
return (ARCHIVE_WARN);
/*
* Do not open the data fork com... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,183 | copy_xattrs(struct archive_write_disk *a, int tmpfd, int dffd)
{
ssize_t xattr_size;
char *xattr_names = NULL, *xattr_val = NULL;
int ret = ARCHIVE_OK, xattr_i;
xattr_size = flistxattr(tmpfd, NULL, 0, 0);
if (xattr_size == -1) {
archive_set_error(&a->archive, errno,
"Failed to read metadata(xattr)");
re... | Dir. Trav. | 0 | copy_xattrs(struct archive_write_disk *a, int tmpfd, int dffd)
{
ssize_t xattr_size;
char *xattr_names = NULL, *xattr_val = NULL;
int ret = ARCHIVE_OK, xattr_i;
xattr_size = flistxattr(tmpfd, NULL, 0, 0);
if (xattr_size == -1) {
archive_set_error(&a->archive, errno,
"Failed to read metadata(xattr)");
re... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,184 | create_dir(struct archive_write_disk *a, char *path)
{
struct stat st;
struct fixup_entry *le;
char *slash, *base;
mode_t mode_final, mode;
int r;
/* Check for special names and just skip them. */
slash = strrchr(path, '/');
if (slash == NULL)
base = path;
else
base = slash + 1;
if (base[0] == '\0' ||
... | Dir. Trav. | 0 | create_dir(struct archive_write_disk *a, char *path)
{
struct stat st;
struct fixup_entry *le;
char *slash, *base;
mode_t mode_final, mode;
int r;
/* Check for special names and just skip them. */
slash = strrchr(path, '/');
if (slash == NULL)
base = path;
else
base = slash + 1;
if (base[0] == '\0' ||
... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,185 | create_filesystem_object(struct archive_write_disk *a)
{
/* Create the entry. */
const char *linkname;
mode_t final_mode, mode;
int r;
/* We identify hard/symlinks according to the link names. */
/* Since link(2) and symlink(2) don't handle modes, we're done here. */
linkname = archive_entry_hardlink(a->entry);... | Dir. Trav. | 0 | create_filesystem_object(struct archive_write_disk *a)
{
/* Create the entry. */
const char *linkname;
mode_t final_mode, mode;
int r;
/* We identify hard/symlinks according to the link names. */
/* Since link(2) and symlink(2) don't handle modes, we're done here. */
linkname = archive_entry_hardlink(a->entry);... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,186 | create_tempdatafork(struct archive_write_disk *a, const char *pathname)
{
struct archive_string tmpdatafork;
int tmpfd;
archive_string_init(&tmpdatafork);
archive_strcpy(&tmpdatafork, "tar.md.XXXXXX");
tmpfd = mkstemp(tmpdatafork.s);
if (tmpfd < 0) {
archive_set_error(&a->archive, errno,
"Failed to mkste... | Dir. Trav. | 0 | create_tempdatafork(struct archive_write_disk *a, const char *pathname)
{
struct archive_string tmpdatafork;
int tmpfd;
archive_string_init(&tmpdatafork);
archive_strcpy(&tmpdatafork, "tar.md.XXXXXX");
tmpfd = mkstemp(tmpdatafork.s);
if (tmpfd < 0) {
archive_set_error(&a->archive, errno,
"Failed to mkste... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,187 | current_fixup(struct archive_write_disk *a, const char *pathname)
{
if (a->current_fixup == NULL)
a->current_fixup = new_fixup(a, pathname);
return (a->current_fixup);
}
| Dir. Trav. | 0 | current_fixup(struct archive_write_disk *a, const char *pathname)
{
if (a->current_fixup == NULL)
a->current_fixup = new_fixup(a, pathname);
return (a->current_fixup);
}
| @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,188 | edit_deep_directories(struct archive_write_disk *a)
{
int ret;
char *tail = a->name;
/* If path is short, avoid the open() below. */
if (strlen(tail) <= PATH_MAX)
return;
/* Try to record our starting dir. */
a->restore_pwd = open(".", O_RDONLY | O_BINARY | O_CLOEXEC);
__archive_ensure_cloexec_flag(a->restor... | Dir. Trav. | 0 | edit_deep_directories(struct archive_write_disk *a)
{
int ret;
char *tail = a->name;
/* If path is short, avoid the open() below. */
if (strlen(tail) <= PATH_MAX)
return;
/* Try to record our starting dir. */
a->restore_pwd = open(".", O_RDONLY | O_BINARY | O_CLOEXEC);
__archive_ensure_cloexec_flag(a->restor... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,189 | fixup_appledouble(struct archive_write_disk *a, const char *pathname)
{
(void)a; /* UNUSED */
(void)pathname; /* UNUSED */
return (ARCHIVE_OK);
}
| Dir. Trav. | 0 | fixup_appledouble(struct archive_write_disk *a, const char *pathname)
{
(void)a; /* UNUSED */
(void)pathname; /* UNUSED */
return (ARCHIVE_OK);
}
| @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,190 | fixup_appledouble(struct archive_write_disk *a, const char *pathname)
{
char buff[8];
struct stat st;
const char *p;
struct archive_string datafork;
int fd = -1, ret = ARCHIVE_OK;
archive_string_init(&datafork);
/* Check if the current file name is a type of the resource
* fork file. */
p = strrchr(pathname,... | Dir. Trav. | 0 | fixup_appledouble(struct archive_write_disk *a, const char *pathname)
{
char buff[8];
struct stat st;
const char *p;
struct archive_string datafork;
int fd = -1, ret = ARCHIVE_OK;
archive_string_init(&datafork);
/* Check if the current file name is a type of the resource
* fork file. */
p = strrchr(pathname,... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,191 | hfs_drive_compressor(struct archive_write_disk *a, const char *buff,
size_t size)
{
unsigned char *buffer_compressed;
size_t bytes_compressed;
size_t bytes_used;
int ret;
ret = hfs_reset_compressor(a);
if (ret != ARCHIVE_OK)
return (ret);
if (a->compressed_buffer == NULL) {
size_t block_size;
block_... | Dir. Trav. | 0 | hfs_drive_compressor(struct archive_write_disk *a, const char *buff,
size_t size)
{
unsigned char *buffer_compressed;
size_t bytes_compressed;
size_t bytes_used;
int ret;
ret = hfs_reset_compressor(a);
if (ret != ARCHIVE_OK)
return (ret);
if (a->compressed_buffer == NULL) {
size_t block_size;
block_... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,192 | hfs_reset_compressor(struct archive_write_disk *a)
{
int ret;
if (a->stream_valid)
ret = deflateReset(&a->stream);
else
ret = deflateInit(&a->stream, a->decmpfs_compression_level);
if (ret != Z_OK) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Failed to initialize compressor");
return (ARCHI... | Dir. Trav. | 0 | hfs_reset_compressor(struct archive_write_disk *a)
{
int ret;
if (a->stream_valid)
ret = deflateReset(&a->stream);
else
ret = deflateInit(&a->stream, a->decmpfs_compression_level);
if (ret != Z_OK) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Failed to initialize compressor");
return (ARCHI... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,193 | hfs_set_compressed_fflag(struct archive_write_disk *a)
{
int r;
if ((r = lazy_stat(a)) != ARCHIVE_OK)
return (r);
a->st.st_flags |= UF_COMPRESSED;
if (fchflags(a->fd, a->st.st_flags) != 0) {
archive_set_error(&a->archive, errno,
"Failed to set UF_COMPRESSED file flag");
return (ARCHIVE_WARN);
}
retu... | Dir. Trav. | 0 | hfs_set_compressed_fflag(struct archive_write_disk *a)
{
int r;
if ((r = lazy_stat(a)) != ARCHIVE_OK)
return (r);
a->st.st_flags |= UF_COMPRESSED;
if (fchflags(a->fd, a->st.st_flags) != 0) {
archive_set_error(&a->archive, errno,
"Failed to set UF_COMPRESSED file flag");
return (ARCHIVE_WARN);
}
retu... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,194 | hfs_set_resource_fork_footer(unsigned char *buff, size_t buff_size)
{
static const char rsrc_footer[RSRC_F_SIZE] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1c, 0x00, 0x32, 0x00, 0x00, 'c', 'm',
'... | Dir. Trav. | 0 | hfs_set_resource_fork_footer(unsigned char *buff, size_t buff_size)
{
static const char rsrc_footer[RSRC_F_SIZE] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1c, 0x00, 0x32, 0x00, 0x00, 'c', 'm',
'... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,195 | hfs_write_compressed_data(struct archive_write_disk *a, size_t bytes_compressed)
{
int ret;
ret = hfs_write_resource_fork(a, a->compressed_buffer,
bytes_compressed, a->compressed_rsrc_position);
if (ret == ARCHIVE_OK)
a->compressed_rsrc_position += bytes_compressed;
return (ret);
}
| Dir. Trav. | 0 | hfs_write_compressed_data(struct archive_write_disk *a, size_t bytes_compressed)
{
int ret;
ret = hfs_write_resource_fork(a, a->compressed_buffer,
bytes_compressed, a->compressed_rsrc_position);
if (ret == ARCHIVE_OK)
a->compressed_rsrc_position += bytes_compressed;
return (ret);
}
| @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,196 | hfs_write_data_block(struct archive_write_disk *a, const char *buff,
size_t size)
{
uint64_t start_size = size;
ssize_t bytes_written = 0;
ssize_t bytes_to_write;
if (size == 0)
return (ARCHIVE_OK);
if (a->filesize == 0 || a->fd < 0) {
archive_set_error(&a->archive, 0,
"Attempt to write to an empty... | Dir. Trav. | 0 | hfs_write_data_block(struct archive_write_disk *a, const char *buff,
size_t size)
{
uint64_t start_size = size;
ssize_t bytes_written = 0;
ssize_t bytes_to_write;
if (size == 0)
return (ARCHIVE_OK);
if (a->filesize == 0 || a->fd < 0) {
archive_set_error(&a->archive, 0,
"Attempt to write to an empty... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,197 | hfs_write_decmpfs(struct archive_write_disk *a)
{
int r;
uint32_t compression_type;
r = fsetxattr(a->fd, DECMPFS_XATTR_NAME, a->decmpfs_header_p,
a->decmpfs_attr_size, 0, 0);
if (r < 0) {
archive_set_error(&a->archive, errno,
"Cannot restore xattr:%s", DECMPFS_XATTR_NAME);
compression_type = archive... | Dir. Trav. | 0 | hfs_write_decmpfs(struct archive_write_disk *a)
{
int r;
uint32_t compression_type;
r = fsetxattr(a->fd, DECMPFS_XATTR_NAME, a->decmpfs_header_p,
a->decmpfs_attr_size, 0, 0);
if (r < 0) {
archive_set_error(&a->archive, errno,
"Cannot restore xattr:%s", DECMPFS_XATTR_NAME);
compression_type = archive... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,198 | hfs_write_decmpfs_block(struct archive_write_disk *a, const char *buff,
size_t size)
{
const char *buffer_to_write;
size_t bytes_to_write;
int ret;
if (a->decmpfs_block_count == (unsigned)-1) {
void *new_block;
size_t new_size;
unsigned int block_count;
if (a->decmpfs_header_p == NULL) {
new_block ... | Dir. Trav. | 0 | hfs_write_decmpfs_block(struct archive_write_disk *a, const char *buff,
size_t size)
{
const char *buffer_to_write;
size_t bytes_to_write;
int ret;
if (a->decmpfs_block_count == (unsigned)-1) {
void *new_block;
size_t new_size;
unsigned int block_count;
if (a->decmpfs_header_p == NULL) {
new_block ... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
35,199 | hfs_write_resource_fork(struct archive_write_disk *a, unsigned char *buff,
size_t bytes, uint32_t position)
{
int ret;
ret = fsetxattr(a->fd, XATTR_RESOURCEFORK_NAME, buff, bytes,
position, a->rsrc_xattr_options);
if (ret < 0) {
archive_set_error(&a->archive, errno,
"Cannot restore xattr: %s at %u ... | Dir. Trav. | 0 | hfs_write_resource_fork(struct archive_write_disk *a, unsigned char *buff,
size_t bytes, uint32_t position)
{
int ret;
ret = fsetxattr(a->fd, XATTR_RESOURCEFORK_NAME, buff, bytes,
position, a->rsrc_xattr_options);
if (ret < 0) {
archive_set_error(&a->archive, errno,
"Cannot restore xattr: %s at %u ... | @@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
/*
* Canonicalize the pathname. In particular, this strips duplicate
* '/' characters, '.' elements, and trailing '/'. It also raises an
- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
- * set) any '..' in the path.
... | CWE-22 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.