func
stringlengths 0
484k
| target
int64 0
1
| cwe
listlengths 0
4
| project
stringclasses 799
values | commit_id
stringlengths 40
40
| hash
float64 1,215,700,430,453,689,100,000,000B
340,281,914,521,452,260,000,000,000,000B
| size
int64 1
24k
| message
stringlengths 0
13.3k
|
---|---|---|---|---|---|---|---|
static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1;
zval *expr = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
zend_bool result;
if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) {
result = instanceof_function(Z_OBJCE_P(expr), EX_T(opline->op2.u.var).class_entry TSRMLS_CC);
} else {
result = 0;
}
ZVAL_BOOL(&EX_T(opline->result.u.var).tmp_var, result);
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
ZEND_VM_NEXT_OPCODE();
}
| 0 |
[] |
php-src
|
ce96fd6b0761d98353761bf78d5bfb55291179fd
| 313,846,778,945,575,540,000,000,000,000,000,000,000 | 16 |
- fix #39863, do not accept paths with NULL in them. See http://news.php.net/php.internals/50191, trunk will have the patch later (adding a macro and/or changing (some) APIs. Patch by Rasmus
|
static int task_switch_32(struct x86_emulate_ctxt *ctxt,
u16 tss_selector, u16 old_tss_sel,
ulong old_tss_base, struct desc_struct *new_desc)
{
const struct x86_emulate_ops *ops = ctxt->ops;
struct tss_segment_32 tss_seg;
int ret;
u32 new_tss_base = get_desc_base(new_desc);
u32 eip_offset = offsetof(struct tss_segment_32, eip);
u32 ldt_sel_offset = offsetof(struct tss_segment_32, ldt_selector);
ret = ops->read_std(ctxt, old_tss_base, &tss_seg, sizeof tss_seg,
&ctxt->exception);
if (ret != X86EMUL_CONTINUE)
return ret;
save_state_to_tss32(ctxt, &tss_seg);
/* Only GP registers and segment selectors are saved */
ret = ops->write_std(ctxt, old_tss_base + eip_offset, &tss_seg.eip,
ldt_sel_offset - eip_offset, &ctxt->exception);
if (ret != X86EMUL_CONTINUE)
return ret;
ret = ops->read_std(ctxt, new_tss_base, &tss_seg, sizeof tss_seg,
&ctxt->exception);
if (ret != X86EMUL_CONTINUE)
return ret;
if (old_tss_sel != 0xffff) {
tss_seg.prev_task_link = old_tss_sel;
ret = ops->write_std(ctxt, new_tss_base,
&tss_seg.prev_task_link,
sizeof tss_seg.prev_task_link,
&ctxt->exception);
if (ret != X86EMUL_CONTINUE)
return ret;
}
return load_state_from_tss32(ctxt, &tss_seg);
}
| 0 |
[
"CWE-284"
] |
linux
|
33ab91103b3415e12457e3104f0e4517ce12d0f3
| 311,844,335,550,516,800,000,000,000,000,000,000,000 | 42 |
KVM: x86: fix emulation of "MOV SS, null selector"
This is CVE-2017-2583. On Intel this causes a failed vmentry because
SS's type is neither 3 nor 7 (even though the manual says this check is
only done for usable SS, and the dmesg splat says that SS is unusable!).
On AMD it's worse: svm.c is confused and sets CPL to 0 in the vmcb.
The fix fabricates a data segment descriptor when SS is set to a null
selector, so that CPL and SS.DPL are set correctly in the VMCS/vmcb.
Furthermore, only allow setting SS to a NULL selector if SS.RPL < 3;
this in turn ensures CPL < 3 because RPL must be equal to CPL.
Thanks to Andy Lutomirski and Willy Tarreau for help in analyzing
the bug and deciphering the manuals.
Reported-by: Xiaohan Zhang <[email protected]>
Fixes: 79d5b4c3cd809c770d4bf9812635647016c56011
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
|
void clear_ref_exclusion(struct string_list **ref_excludes_p)
{
if (*ref_excludes_p) {
string_list_clear(*ref_excludes_p, 0);
free(*ref_excludes_p);
}
*ref_excludes_p = NULL;
}
| 0 |
[] |
git
|
a937b37e766479c8e780b17cce9c4b252fd97e40
| 90,631,315,985,076,640,000,000,000,000,000,000,000 | 8 |
revision: quit pruning diff more quickly when possible
When the revision traversal machinery is given a pathspec,
we must compute the parent-diff for each commit to determine
which ones are TREESAME. We set the QUICK diff flag to avoid
looking at more entries than we need; we really just care
whether there are any changes at all.
But there is one case where we want to know a bit more: if
--remove-empty is set, we care about finding cases where the
change consists only of added entries (in which case we may
prune the parent in try_to_simplify_commit()). To cover that
case, our file_add_remove() callback does not quit the diff
upon seeing an added entry; it keeps looking for other types
of entries.
But this means when --remove-empty is not set (and it is not
by default), we compute more of the diff than is necessary.
You can see this in a pathological case where a commit adds
a very large number of entries, and we limit based on a
broad pathspec. E.g.:
perl -e '
chomp(my $blob = `git hash-object -w --stdin </dev/null`);
for my $a (1..1000) {
for my $b (1..1000) {
print "100644 $blob\t$a/$b\n";
}
}
' | git update-index --index-info
git commit -qm add
git rev-list HEAD -- .
This case takes about 100ms now, but after this patch only
needs 6ms. That's not a huge improvement, but it's easy to
get and it protects us against even more pathological cases
(e.g., going from 1 million to 10 million files would take
ten times as long with the current code, but not increase at
all after this patch).
This is reported to minorly speed-up pathspec limiting in
real world repositories (like the 100-million-file Windows
repository), but probably won't make a noticeable difference
outside of pathological setups.
This patch actually covers the case without --remove-empty,
and the case where we see only deletions. See the in-code
comment for details.
Note that we have to add a new member to the diff_options
struct so that our callback can see the value of
revs->remove_empty_trees. This callback parameter could be
passed to the "add_remove" and "change" callbacks, but
there's not much point. They already receive the
diff_options struct, and doing it this way avoids having to
update the function signature of the other callbacks
(arguably the format_callback and output_prefix functions
could benefit from the same simplification).
Signed-off-by: Jeff King <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
|
static bool blkcg_policy_enabled(struct request_queue *q,
const struct blkcg_policy *pol)
{
return pol && test_bit(pol->plid, q->blkcg_pols);
}
| 0 |
[
"CWE-415"
] |
linux
|
9b54d816e00425c3a517514e0d677bb3cec49258
| 44,878,471,535,126,570,000,000,000,000,000,000,000 | 5 |
blkcg: fix double free of new_blkg in blkcg_init_queue
If blkg_create fails, new_blkg passed as an argument will
be freed by blkg_create, so there is no need to free it again.
Signed-off-by: Hou Tao <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
|
void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
{
int me;
int cpu = vcpu->cpu;
if (waitqueue_active(&vcpu->wq)) {
wake_up_interruptible(&vcpu->wq);
++vcpu->stat.halt_wakeup;
}
me = get_cpu();
if (cpu != me && (unsigned)cpu < nr_cpu_ids && cpu_online(cpu))
if (kvm_vcpu_exiting_guest_mode(vcpu) == IN_GUEST_MODE)
smp_send_reschedule(cpu);
put_cpu();
}
| 0 |
[] |
kvm
|
0769c5de24621141c953fbe1f943582d37cb4244
| 140,558,565,402,031,250,000,000,000,000,000,000,000 | 16 |
KVM: x86: extend "struct x86_emulate_ops" with "get_cpuid"
In order to be able to proceed checks on CPU-specific properties
within the emulator, function "get_cpuid" is introduced.
With "get_cpuid" it is possible to virtually call the guests
"cpuid"-opcode without changing the VM's context.
[mtosatti: cleanup/beautify code]
Signed-off-by: Stephan Baerwolf <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>
|
gs_main_init0(gs_main_instance * minst, FILE * in, FILE * out, FILE * err,
int max_lib_paths)
{
ref *array;
/* Do platform-dependent initialization. */
/* We have to do this as the very first thing, */
/* because it detects attempts to run 80N86 executables (N>0) */
/* on incompatible processors. */
gp_init();
/* Initialize the imager. */
/* Reset debugging flags */
#ifdef PACIFY_VALGRIND
VALGRIND_HG_DISABLE_CHECKING(gs_debug, 128);
#endif
memset(gs_debug, 0, 128);
gs_log_errors = 0; /* gs_debug['#'] = 0 */
gp_get_realtime(minst->base_time);
/* Initialize the file search paths. */
array = (ref *) gs_alloc_byte_array(minst->heap, max_lib_paths, sizeof(ref),
"lib_path array");
if (array == 0) {
gs_lib_finit(1, gs_error_VMerror, minst->heap);
return_error(gs_error_VMerror);
}
make_array(&minst->lib_path.container, avm_foreign, max_lib_paths,
array);
make_array(&minst->lib_path.list, avm_foreign | a_readonly, 0,
minst->lib_path.container.value.refs);
minst->lib_path.env = 0;
minst->lib_path.final = 0;
minst->lib_path.count = 0;
minst->user_errors = 1;
minst->init_done = 0;
return 0;
}
| 0 |
[] |
ghostpdl
|
241d91112771a6104de10b3948c3f350d6690c1d
| 209,209,728,966,871,040,000,000,000,000,000,000,000 | 40 |
Bug 699664: Ensure the correct is in place before cleanup
If the PS job replaces the device and leaves that graphics state in place, we
wouldn't cleanup the default device in the normal way, but rely on the garbage
collector.
This works (but isn't ideal), *except* when the job replaces the device with
the null device (using the nulldevice operator) - this means that
.uninstallpagedevice doesn't replace the existing device with the nulldevice
(since it is already installed), the device from the graphics ends up being
freed - and as it is the nulldevice, which we rely on, memory corruption
and a segfault can happen.
We avoid this by checking if the current device is the nulldevice, and if so,
restoring it away, before continuing with the device cleanup.
|
CudnnRnnSequenceTensorDescriptor(GpuExecutor* parent, int max_seq_length,
int batch_size, int data_size,
cudnnDataType_t data_type,
RNNDataDescriptor data_handle,
TensorDescriptor handle)
: max_seq_length_(max_seq_length),
batch_size_(batch_size),
data_size_(data_size),
data_type_(data_type),
handle_(std::move(handle)),
rnn_data_handle_(std::move(data_handle)),
handles_(max_seq_length, handle_.get()) {
}
| 0 |
[
"CWE-20"
] |
tensorflow
|
14755416e364f17fb1870882fa778c7fec7f16e3
| 132,984,855,902,276,270,000,000,000,000,000,000,000 | 13 |
Prevent CHECK-fail in LSTM/GRU with zero-length input.
PiperOrigin-RevId: 346239181
Change-Id: I5f233dbc076aab7bb4e31ba24f5abd4eaf99ea4f
|
void MirrorJob::TransferStarted(CopyJob *cp)
{
if(transfer_count==0)
root_mirror->transfer_start_ts=now;
JobStarted(cp);
}
| 0 |
[
"CWE-20",
"CWE-401"
] |
lftp
|
a27e07d90a4608ceaf928b1babb27d4d803e1992
| 332,981,066,786,158,100,000,000,000,000,000,000,000 | 6 |
mirror: prepend ./ to rm and chmod arguments to avoid URL recognition (fix #452)
|
resp_header_locate (const struct response *resp, const char *name, int start,
const char **begptr, const char **endptr)
{
int i;
const char **headers = resp->headers;
int name_len;
if (!headers || !headers[1])
return -1;
name_len = strlen (name);
if (start > 0)
i = start;
else
i = 1;
for (; headers[i + 1]; i++)
{
const char *b = headers[i];
const char *e = headers[i + 1];
if (e - b > name_len
&& b[name_len] == ':'
&& 0 == c_strncasecmp (b, name, name_len))
{
b += name_len + 1;
while (b < e && c_isspace (*b))
++b;
while (b < e && c_isspace (e[-1]))
--e;
*begptr = b;
*endptr = e;
return i;
}
}
return -1;
}
| 0 |
[
"CWE-119"
] |
wget
|
d892291fb8ace4c3b734ea5125770989c215df3f
| 52,771,426,453,750,260,000,000,000,000,000,000,000 | 36 |
Fix stack overflow in HTTP protocol handling (CVE-2017-13089)
* src/http.c (skip_short_body): Return error on negative chunk size
Reported-by: Antti Levomäki, Christian Jalio, Joonas Pihlaja from Forcepoint
Reported-by: Juhani Eronen from Finnish National Cyber Security Centre
|
int LibRaw::adjust_sizes_info_only(void)
{
CHECK_ORDER_LOW(LIBRAW_PROGRESS_IDENTIFY);
raw2image_start();
if (O.use_fuji_rotate)
{
if (IO.fuji_width)
{
// restore saved values
if(IO.fheight)
{
S.height = IO.fheight;
S.width = IO.fwidth;
S.iheight = (S.height + IO.shrink) >> IO.shrink;
S.iwidth = (S.width + IO.shrink) >> IO.shrink;
S.raw_height -= 2*S.top_margin;
IO.fheight = IO.fwidth = 0; // prevent repeated calls
}
// dcraw code
IO.fuji_width = (IO.fuji_width - 1 + IO.shrink) >> IO.shrink;
S.iwidth = (ushort)(IO.fuji_width / sqrt(0.5));
S.iheight = (ushort)( (S.iheight - IO.fuji_width) / sqrt(0.5));
}
else
{
if (S.pixel_aspect < 1) S.iheight = (ushort)( S.iheight / S.pixel_aspect + 0.5);
if (S.pixel_aspect > 1) S.iwidth = (ushort) (S.iwidth * S.pixel_aspect + 0.5);
}
}
SET_PROC_FLAG(LIBRAW_PROGRESS_FUJI_ROTATE);
if ( S.flip & 4)
{
unsigned short t = S.iheight;
S.iheight=S.iwidth;
S.iwidth = t;
SET_PROC_FLAG(LIBRAW_PROGRESS_FLIP);
}
return 0;
}
| 0 |
[
"CWE-399"
] |
LibRaw
|
c14ae36d28e80139b2f31b5d9d7623db3b597a3a
| 14,431,756,062,382,860,000,000,000,000,000,000,000 | 40 |
fixed error handling for broken full-color images
|
static int load_plugin_data(char *plugin_name, char *config_file)
{
FILE *file_ptr;
char path[FN_REFLEN];
char line[1024];
char *reason= 0;
char *res;
int i= -1;
if (opt_plugin_ini == 0)
{
fn_format(path, config_file, opt_plugin_dir, "", MYF(0));
opt_plugin_ini= my_strdup(path, MYF(MY_FAE));
}
if (!file_exists(opt_plugin_ini))
{
reason= (char *)"File does not exist.";
goto error;
}
file_ptr= fopen(opt_plugin_ini, "r");
if (file_ptr == NULL)
{
reason= (char *)"Cannot open file.";
goto error;
}
/* save name */
plugin_data.name= my_strdup(plugin_name, MYF(MY_WME));
/* Read plugin components */
while (i < 16)
{
res= fgets(line, sizeof(line), file_ptr);
/* strip /n */
if (line[strlen(line)-1] == '\n')
{
line[strlen(line)-1]= '\0';
}
if (res == NULL)
{
if (i < 1)
{
reason= (char *)"Bad format in plugin configuration file.";
fclose(file_ptr);
goto error;
}
break;
}
if ((line[0] == '#') || (line[0] == '\n')) // skip comment and blank lines
{
continue;
}
if (i == -1) // if first pass, read this line as so_name
{
/* Add proper file extension for soname */
strcat(line, FN_SOEXT);
/* save so_name */
plugin_data.so_name= my_strdup(line, MYF(MY_WME|MY_ZEROFILL));
i++;
}
else
{
if (strlen(line) > 0)
{
plugin_data.components[i]= my_strdup(line, MYF(MY_WME));
i++;
}
else
{
plugin_data.components[i]= NULL;
}
}
}
fclose(file_ptr);
return 0;
error:
fprintf(stderr, "ERROR: Cannot read plugin config file %s. %s\n",
plugin_name, reason);
return 1;
}
| 0 |
[
"CWE-200"
] |
mysql-server
|
0dbd5a8797ed4bd18e8b883988fb62177eb0f73f
| 190,762,632,003,308,850,000,000,000,000,000,000,000 | 83 |
Bug#21973610: BUFFER OVERFLOW ISSUES
Description : Incorrect usage of sprintf/strcpy caused
possible buffer overflow issues at various
places.
Solution : - Fixed mysql_plugin and mysqlshow
- Fixed regex library issues
Reviewed-By : Georgi Kodinov <[email protected]>
Reviewed-By : Venkata S Murthy Sidagam <[email protected]>
|
processValidate(struct module_qstate* qstate, struct val_qstate* vq,
struct val_env* ve, int id)
{
enum val_classification subtype;
int rcode;
if(!vq->key_entry) {
verbose(VERB_ALGO, "validate: no key entry, failed");
return val_error(qstate, id);
}
/* This is the default next state. */
vq->state = VAL_FINISHED_STATE;
/* Unsigned responses must be underneath a "null" key entry.*/
if(key_entry_isnull(vq->key_entry)) {
verbose(VERB_DETAIL, "Verified that %sresponse is INSECURE",
vq->signer_name?"":"unsigned ");
vq->chase_reply->security = sec_status_insecure;
val_mark_insecure(vq->chase_reply, vq->key_entry->name,
qstate->env->rrset_cache, qstate->env);
key_cache_insert(ve->kcache, vq->key_entry, qstate);
return 1;
}
if(key_entry_isbad(vq->key_entry)) {
log_nametypeclass(VERB_DETAIL, "Could not establish a chain "
"of trust to keys for", vq->key_entry->name,
LDNS_RR_TYPE_DNSKEY, vq->key_entry->key_class);
vq->chase_reply->security = sec_status_bogus;
update_reason_bogus(vq->chase_reply, LDNS_EDE_DNSKEY_MISSING);
errinf_ede(qstate, "while building chain of trust",
LDNS_EDE_DNSKEY_MISSING);
if(vq->restart_count >= ve->max_restart)
key_cache_insert(ve->kcache, vq->key_entry, qstate);
return 1;
}
/* signerName being null is the indicator that this response was
* unsigned */
if(vq->signer_name == NULL) {
log_query_info(VERB_ALGO, "processValidate: state has no "
"signer name", &vq->qchase);
verbose(VERB_DETAIL, "Could not establish validation of "
"INSECURE status of unsigned response.");
errinf_ede(qstate, "no signatures", LDNS_EDE_RRSIGS_MISSING);
errinf_origin(qstate, qstate->reply_origin);
vq->chase_reply->security = sec_status_bogus;
update_reason_bogus(vq->chase_reply, LDNS_EDE_RRSIGS_MISSING);
return 1;
}
subtype = val_classify_response(qstate->query_flags, &qstate->qinfo,
&vq->qchase, vq->orig_msg->rep, vq->rrset_skip);
if(subtype != VAL_CLASS_REFERRAL)
remove_spurious_authority(vq->chase_reply, vq->orig_msg->rep);
/* check signatures in the message;
* answer and authority must be valid, additional is only checked. */
if(!validate_msg_signatures(qstate, qstate->env, ve, &vq->qchase,
vq->chase_reply, vq->key_entry)) {
/* workaround bad recursor out there that truncates (even
* with EDNS4k) to 512 by removing RRSIG from auth section
* for positive replies*/
if((subtype == VAL_CLASS_POSITIVE || subtype == VAL_CLASS_ANY
|| subtype == VAL_CLASS_CNAME) &&
detect_wrongly_truncated(vq->orig_msg->rep)) {
/* truncate the message some more */
vq->orig_msg->rep->ns_numrrsets = 0;
vq->orig_msg->rep->ar_numrrsets = 0;
vq->orig_msg->rep->rrset_count =
vq->orig_msg->rep->an_numrrsets;
vq->chase_reply->ns_numrrsets = 0;
vq->chase_reply->ar_numrrsets = 0;
vq->chase_reply->rrset_count =
vq->chase_reply->an_numrrsets;
qstate->errinf = NULL;
}
else {
verbose(VERB_DETAIL, "Validate: message contains "
"bad rrsets");
return 1;
}
}
switch(subtype) {
case VAL_CLASS_POSITIVE:
verbose(VERB_ALGO, "Validating a positive response");
validate_positive_response(qstate->env, ve,
&vq->qchase, vq->chase_reply, vq->key_entry);
verbose(VERB_DETAIL, "validate(positive): %s",
sec_status_to_string(
vq->chase_reply->security));
break;
case VAL_CLASS_NODATA:
verbose(VERB_ALGO, "Validating a nodata response");
validate_nodata_response(qstate->env, ve,
&vq->qchase, vq->chase_reply, vq->key_entry);
verbose(VERB_DETAIL, "validate(nodata): %s",
sec_status_to_string(
vq->chase_reply->security));
break;
case VAL_CLASS_NAMEERROR:
rcode = (int)FLAGS_GET_RCODE(vq->orig_msg->rep->flags);
verbose(VERB_ALGO, "Validating a nxdomain response");
validate_nameerror_response(qstate->env, ve,
&vq->qchase, vq->chase_reply, vq->key_entry, &rcode);
verbose(VERB_DETAIL, "validate(nxdomain): %s",
sec_status_to_string(
vq->chase_reply->security));
FLAGS_SET_RCODE(vq->orig_msg->rep->flags, rcode);
FLAGS_SET_RCODE(vq->chase_reply->flags, rcode);
break;
case VAL_CLASS_CNAME:
verbose(VERB_ALGO, "Validating a cname response");
validate_cname_response(qstate->env, ve,
&vq->qchase, vq->chase_reply, vq->key_entry);
verbose(VERB_DETAIL, "validate(cname): %s",
sec_status_to_string(
vq->chase_reply->security));
break;
case VAL_CLASS_CNAMENOANSWER:
verbose(VERB_ALGO, "Validating a cname noanswer "
"response");
validate_cname_noanswer_response(qstate->env, ve,
&vq->qchase, vq->chase_reply, vq->key_entry);
verbose(VERB_DETAIL, "validate(cname_noanswer): %s",
sec_status_to_string(
vq->chase_reply->security));
break;
case VAL_CLASS_REFERRAL:
verbose(VERB_ALGO, "Validating a referral response");
validate_referral_response(vq->chase_reply);
verbose(VERB_DETAIL, "validate(referral): %s",
sec_status_to_string(
vq->chase_reply->security));
break;
case VAL_CLASS_ANY:
verbose(VERB_ALGO, "Validating a positive ANY "
"response");
validate_any_response(qstate->env, ve, &vq->qchase,
vq->chase_reply, vq->key_entry);
verbose(VERB_DETAIL, "validate(positive_any): %s",
sec_status_to_string(
vq->chase_reply->security));
break;
default:
log_err("validate: unhandled response subtype: %d",
subtype);
}
if(vq->chase_reply->security == sec_status_bogus) {
if(subtype == VAL_CLASS_POSITIVE)
errinf(qstate, "wildcard");
else errinf(qstate, val_classification_to_string(subtype));
errinf(qstate, "proof failed");
errinf_origin(qstate, qstate->reply_origin);
}
return 1;
}
| 0 |
[
"CWE-613",
"CWE-703"
] |
unbound
|
f6753a0f1018133df552347a199e0362fc1dac68
| 35,886,070,128,447,890,000,000,000,000,000,000,000 | 167 |
- Fix the novel ghost domain issues CVE-2022-30698 and CVE-2022-30699.
|
build_ecc_privkey_template (app_t app, int keyno,
const unsigned char *ecc_d, size_t ecc_d_len,
unsigned char **result, size_t *resultlen)
{
unsigned char privkey[2];
size_t privkey_len;
unsigned char exthdr[2+2+1];
size_t exthdr_len;
unsigned char suffix[2+1];
size_t suffix_len;
unsigned char *tp;
size_t datalen;
unsigned char *template;
size_t template_size;
(void)app;
*result = NULL;
*resultlen = 0;
/* Build the 7f48 cardholder private key template. */
datalen = 0;
tp = privkey;
tp += add_tlv (tp, 0x91, ecc_d_len); /* Tag 0x91??? */
datalen += ecc_d_len;
privkey_len = tp - privkey;
/* Build the extended header list without the private key template. */
tp = exthdr;
*tp++ = keyno ==0 ? 0xb6 : keyno == 1? 0xb8 : 0xa4;
*tp++ = 0;
tp += add_tlv (tp, 0x7f48, privkey_len);
exthdr_len = tp - exthdr;
/* Build the 5f48 suffix of the data. */
tp = suffix;
tp += add_tlv (tp, 0x5f48, datalen);
suffix_len = tp - suffix;
/* Now concatenate everything. */
template_size = (1 + 1 /* 0x4d and len. */
+ exthdr_len
+ privkey_len
+ suffix_len
+ datalen);
tp = template = xtrymalloc_secure (template_size);
if (!template)
return gpg_error_from_syserror ();
tp += add_tlv (tp, 0x4d, exthdr_len + privkey_len + suffix_len + datalen);
memcpy (tp, exthdr, exthdr_len);
tp += exthdr_len;
memcpy (tp, privkey, privkey_len);
tp += privkey_len;
memcpy (tp, suffix, suffix_len);
tp += suffix_len;
memcpy (tp, ecc_d, ecc_d_len);
tp += ecc_d_len;
assert (tp - template == template_size);
*result = template;
*resultlen = tp - template;
return 0;
}
| 0 |
[
"CWE-20"
] |
gnupg
|
2183683bd633818dd031b090b5530951de76f392
| 287,972,976,605,798,550,000,000,000,000,000,000,000 | 68 |
Use inline functions to convert buffer data to scalars.
* common/host2net.h (buf16_to_ulong, buf16_to_uint): New.
(buf16_to_ushort, buf16_to_u16): New.
(buf32_to_size_t, buf32_to_ulong, buf32_to_uint, buf32_to_u32): New.
--
Commit 91b826a38880fd8a989318585eb502582636ddd8 was not enough to
avoid all sign extension on shift problems. Hanno Böck found a case
with an invalid read due to this problem. To fix that once and for
all almost all uses of "<< 24" and "<< 8" are changed by this patch to
use an inline function from host2net.h.
Signed-off-by: Werner Koch <[email protected]>
|
JVM_InitializeSocketLibrary(void)
{
Trc_SC_InitializeSocketLibrary();
return 0;
}
| 0 |
[
"CWE-119"
] |
openj9
|
0971f22d88f42cf7332364ad7430e9bd8681c970
| 82,787,664,221,381,660,000,000,000,000,000,000,000 | 5 |
Clean up jio_snprintf and jio_vfprintf
Fixes https://bugs.eclipse.org/bugs/show_bug.cgi?id=543659
Signed-off-by: Peter Bain <[email protected]>
|
static void FVMenuUndo(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) {
FontView *fv = (FontView *) GDrawGetUserData(gw);
FVUndo((FontViewBase *) fv);
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
fontforge
|
626f751752875a0ddd74b9e217b6f4828713573c
| 55,138,525,358,659,800,000,000,000,000,000,000,000 | 4 |
Warn users before discarding their unsaved scripts (#3852)
* Warn users before discarding their unsaved scripts
This closes #3846.
|
void snd_seq_autoload_init(void)
{
atomic_dec(&snd_seq_in_init);
#ifdef CONFIG_SND_SEQUENCER_MODULE
/* initial autoload only when snd-seq is a module */
queue_autoload_drivers();
#endif
}
| 0 |
[
"CWE-416",
"CWE-401"
] |
linux
|
fc27fe7e8deef2f37cba3f2be2d52b6ca5eb9d57
| 160,878,693,596,248,840,000,000,000,000,000,000,000 | 8 |
ALSA: seq: Cancel pending autoload work at unbinding device
ALSA sequencer core has a mechanism to load the enumerated devices
automatically, and it's performed in an off-load work. This seems
causing some race when a sequencer is removed while the pending
autoload work is running. As syzkaller spotted, it may lead to some
use-after-free:
BUG: KASAN: use-after-free in snd_rawmidi_dev_seq_free+0x69/0x70
sound/core/rawmidi.c:1617
Write of size 8 at addr ffff88006c611d90 by task kworker/2:1/567
CPU: 2 PID: 567 Comm: kworker/2:1 Not tainted 4.13.0+ #29
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Workqueue: events autoload_drivers
Call Trace:
__dump_stack lib/dump_stack.c:16 [inline]
dump_stack+0x192/0x22c lib/dump_stack.c:52
print_address_description+0x78/0x280 mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report+0x230/0x340 mm/kasan/report.c:409
__asan_report_store8_noabort+0x1c/0x20 mm/kasan/report.c:435
snd_rawmidi_dev_seq_free+0x69/0x70 sound/core/rawmidi.c:1617
snd_seq_dev_release+0x4f/0x70 sound/core/seq_device.c:192
device_release+0x13f/0x210 drivers/base/core.c:814
kobject_cleanup lib/kobject.c:648 [inline]
kobject_release lib/kobject.c:677 [inline]
kref_put include/linux/kref.h:70 [inline]
kobject_put+0x145/0x240 lib/kobject.c:694
put_device+0x25/0x30 drivers/base/core.c:1799
klist_devices_put+0x36/0x40 drivers/base/bus.c:827
klist_next+0x264/0x4a0 lib/klist.c:403
next_device drivers/base/bus.c:270 [inline]
bus_for_each_dev+0x17e/0x210 drivers/base/bus.c:312
autoload_drivers+0x3b/0x50 sound/core/seq_device.c:117
process_one_work+0x9fb/0x1570 kernel/workqueue.c:2097
worker_thread+0x1e4/0x1350 kernel/workqueue.c:2231
kthread+0x324/0x3f0 kernel/kthread.c:231
ret_from_fork+0x25/0x30 arch/x86/entry/entry_64.S:425
The fix is simply to assure canceling the autoload work at removing
the device.
Reported-by: Andrey Konovalov <[email protected]>
Tested-by: Andrey Konovalov <[email protected]>
Cc: <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
|
feed_table_tag(struct table *tbl, char *line, struct table_mode *mode,
int width, struct parsed_tag *tag)
{
int cmd;
#ifdef ID_EXT
char *p;
#endif
struct table_cell *cell = &tbl->cell;
int colspan, rowspan;
int col, prev_col;
int i, j, k, v, v0, w, id;
Str tok, tmp, anchor;
table_attr align, valign;
cmd = tag->tagid;
if (mode->pre_mode & TBLM_PLAIN) {
if (mode->end_tag == cmd) {
mode->pre_mode &= ~TBLM_PLAIN;
mode->end_tag = 0;
feed_table_block_tag(tbl, line, mode, 0, cmd);
return TAG_ACTION_NONE;
}
return TAG_ACTION_PLAIN;
}
if (mode->pre_mode & TBLM_INTXTA) {
switch (cmd) {
CASE_TABLE_TAG:
case HTML_N_TEXTAREA:
table_close_textarea(tbl, mode, width);
if (cmd == HTML_N_TEXTAREA)
return TAG_ACTION_NONE;
break;
default:
return TAG_ACTION_FEED;
}
}
if (mode->pre_mode & TBLM_SCRIPT) {
if (mode->end_tag == cmd) {
mode->pre_mode &= ~TBLM_SCRIPT;
mode->end_tag = 0;
return TAG_ACTION_NONE;
}
return TAG_ACTION_PLAIN;
}
if (mode->pre_mode & TBLM_STYLE) {
if (mode->end_tag == cmd) {
mode->pre_mode &= ~TBLM_STYLE;
mode->end_tag = 0;
return TAG_ACTION_NONE;
}
return TAG_ACTION_PLAIN;
}
/* failsafe: a tag other than <option></option>and </select> in *
* <select> environment is regarded as the end of <select>. */
if (mode->pre_mode & TBLM_INSELECT) {
switch (cmd) {
CASE_TABLE_TAG:
case HTML_N_FORM:
case HTML_N_SELECT: /* mode->end_tag */
table_close_select(tbl, mode, width);
if (cmd == HTML_N_SELECT)
return TAG_ACTION_NONE;
break;
default:
return TAG_ACTION_FEED;
}
}
if (mode->caption) {
switch (cmd) {
CASE_TABLE_TAG:
case HTML_N_CAPTION:
mode->caption = 0;
if (cmd == HTML_N_CAPTION)
return TAG_ACTION_NONE;
break;
default:
return TAG_ACTION_FEED;
}
}
if (mode->pre_mode & TBLM_PRE) {
switch (cmd) {
case HTML_NOBR:
case HTML_N_NOBR:
case HTML_PRE_INT:
case HTML_N_PRE_INT:
return TAG_ACTION_NONE;
}
}
switch (cmd) {
case HTML_TABLE:
check_rowcol(tbl, mode);
return TAG_ACTION_TABLE;
case HTML_N_TABLE:
if (tbl->suspended_data)
check_rowcol(tbl, mode);
return TAG_ACTION_N_TABLE;
case HTML_TR:
if (tbl->col >= 0 && tbl->tabcontentssize > 0)
setwidth(tbl, mode);
tbl->col = -1;
tbl->row++;
tbl->flag |= TBL_IN_ROW;
tbl->flag &= ~TBL_IN_COL;
align = 0;
valign = 0;
if (parsedtag_get_value(tag, ATTR_ALIGN, &i)) {
switch (i) {
case ALIGN_LEFT:
align = (HTT_LEFT | HTT_TRSET);
break;
case ALIGN_RIGHT:
align = (HTT_RIGHT | HTT_TRSET);
break;
case ALIGN_CENTER:
align = (HTT_CENTER | HTT_TRSET);
break;
}
}
if (parsedtag_get_value(tag, ATTR_VALIGN, &i)) {
switch (i) {
case VALIGN_TOP:
valign = (HTT_TOP | HTT_VTRSET);
break;
case VALIGN_MIDDLE:
valign = (HTT_MIDDLE | HTT_VTRSET);
break;
case VALIGN_BOTTOM:
valign = (HTT_BOTTOM | HTT_VTRSET);
break;
}
}
#ifdef ID_EXT
if (parsedtag_get_value(tag, ATTR_ID, &p)) {
check_row(tbl, tbl->row);
tbl->tridvalue[tbl->row] = Strnew_charp(p);
}
#endif /* ID_EXT */
tbl->trattr = align | valign;
break;
case HTML_TH:
case HTML_TD:
prev_col = tbl->col;
if (tbl->col >= 0 && tbl->tabcontentssize > 0)
setwidth(tbl, mode);
if (tbl->row == -1) {
/* for broken HTML... */
tbl->row = -1;
tbl->col = -1;
tbl->maxrow = tbl->row;
}
if (tbl->col == -1) {
if (!(tbl->flag & TBL_IN_ROW)) {
tbl->row++;
tbl->flag |= TBL_IN_ROW;
}
if (tbl->row > tbl->maxrow)
tbl->maxrow = tbl->row;
}
tbl->col++;
check_row(tbl, tbl->row);
while (tbl->col < MAXCOL && tbl->tabattr[tbl->row][tbl->col]) {
tbl->col++;
}
if (tbl->col > MAXCOL - 1) {
tbl->col = prev_col;
return TAG_ACTION_NONE;
}
if (tbl->col > tbl->maxcol) {
tbl->maxcol = tbl->col;
}
colspan = rowspan = 1;
if (tbl->trattr & HTT_TRSET)
align = (tbl->trattr & HTT_ALIGN);
else if (cmd == HTML_TH)
align = HTT_CENTER;
else
align = HTT_LEFT;
if (tbl->trattr & HTT_VTRSET)
valign = (tbl->trattr & HTT_VALIGN);
else
valign = HTT_MIDDLE;
if (parsedtag_get_value(tag, ATTR_ROWSPAN, &rowspan)) {
if(rowspan > ATTR_ROWSPAN_MAX) {
rowspan = ATTR_ROWSPAN_MAX;
}
if ((tbl->row + rowspan) >= tbl->max_rowsize)
check_row(tbl, tbl->row + rowspan);
}
if (rowspan < 1)
rowspan = 1;
if (parsedtag_get_value(tag, ATTR_COLSPAN, &colspan)) {
if ((tbl->col + colspan) >= MAXCOL) {
/* Can't expand column */
colspan = MAXCOL - tbl->col;
}
}
if (colspan < 1)
colspan = 1;
if (parsedtag_get_value(tag, ATTR_ALIGN, &i)) {
switch (i) {
case ALIGN_LEFT:
align = HTT_LEFT;
break;
case ALIGN_RIGHT:
align = HTT_RIGHT;
break;
case ALIGN_CENTER:
align = HTT_CENTER;
break;
}
}
if (parsedtag_get_value(tag, ATTR_VALIGN, &i)) {
switch (i) {
case VALIGN_TOP:
valign = HTT_TOP;
break;
case VALIGN_MIDDLE:
valign = HTT_MIDDLE;
break;
case VALIGN_BOTTOM:
valign = HTT_BOTTOM;
break;
}
}
#ifdef NOWRAP
if (parsedtag_exists(tag, ATTR_NOWRAP))
tbl->tabattr[tbl->row][tbl->col] |= HTT_NOWRAP;
#endif /* NOWRAP */
v = 0;
if (parsedtag_get_value(tag, ATTR_WIDTH, &v)) {
#ifdef TABLE_EXPAND
if (v > 0) {
if (tbl->real_width > 0)
v = -(v * 100) / (tbl->real_width * pixel_per_char);
else
v = (int)(v / pixel_per_char);
}
#else
v = RELATIVE_WIDTH(v);
#endif /* not TABLE_EXPAND */
}
#ifdef ID_EXT
if (parsedtag_get_value(tag, ATTR_ID, &p))
tbl->tabidvalue[tbl->row][tbl->col] = Strnew_charp(p);
#endif /* ID_EXT */
#ifdef NOWRAP
if (v != 0) {
/* NOWRAP and WIDTH= conflicts each other */
tbl->tabattr[tbl->row][tbl->col] &= ~HTT_NOWRAP;
}
#endif /* NOWRAP */
tbl->tabattr[tbl->row][tbl->col] &= ~(HTT_ALIGN | HTT_VALIGN);
tbl->tabattr[tbl->row][tbl->col] |= (align | valign);
if (colspan > 1) {
col = tbl->col;
cell->icell = cell->maxcell + 1;
k = bsearch_2short(colspan, cell->colspan, col, cell->col, MAXCOL,
cell->index, cell->icell);
if (k <= cell->maxcell) {
i = cell->index[k];
if (cell->col[i] == col && cell->colspan[i] == colspan)
cell->icell = i;
}
if (cell->icell > cell->maxcell && cell->icell < MAXCELL) {
cell->maxcell++;
cell->col[cell->maxcell] = col;
cell->colspan[cell->maxcell] = colspan;
cell->width[cell->maxcell] = 0;
cell->minimum_width[cell->maxcell] = 0;
cell->fixed_width[cell->maxcell] = 0;
if (cell->maxcell > k) {
int ii;
for (ii = cell->maxcell; ii > k; ii--)
cell->index[ii] = cell->index[ii - 1];
}
cell->index[k] = cell->maxcell;
}
if (cell->icell > cell->maxcell)
cell->icell = -1;
}
if (v != 0) {
if (colspan == 1) {
v0 = tbl->fixed_width[tbl->col];
if (v0 == 0 || (v0 > 0 && v > v0) || (v0 < 0 && v < v0)) {
#ifdef FEED_TABLE_DEBUG
fprintf(stderr, "width(%d) = %d\n", tbl->col, v);
#endif /* TABLE_DEBUG */
tbl->fixed_width[tbl->col] = v;
}
}
else if (cell->icell >= 0) {
v0 = cell->fixed_width[cell->icell];
if (v0 == 0 || (v0 > 0 && v > v0) || (v0 < 0 && v < v0))
cell->fixed_width[cell->icell] = v;
}
}
for (i = 0; i < rowspan; i++) {
check_row(tbl, tbl->row + i);
for (j = 0; j < colspan; j++) {
#if 0
tbl->tabattr[tbl->row + i][tbl->col + j] &= ~(HTT_X | HTT_Y);
#endif
if (!(tbl->tabattr[tbl->row + i][tbl->col + j] &
(HTT_X | HTT_Y))) {
tbl->tabattr[tbl->row + i][tbl->col + j] |=
((i > 0) ? HTT_Y : 0) | ((j > 0) ? HTT_X : 0);
}
if (tbl->col + j > tbl->maxcol) {
tbl->maxcol = tbl->col + j;
}
}
if (tbl->row + i > tbl->maxrow) {
tbl->maxrow = tbl->row + i;
}
}
begin_cell(tbl, mode);
break;
case HTML_N_TR:
setwidth(tbl, mode);
tbl->col = -1;
tbl->flag &= ~(TBL_IN_ROW | TBL_IN_COL);
return TAG_ACTION_NONE;
case HTML_N_TH:
case HTML_N_TD:
setwidth(tbl, mode);
tbl->flag &= ~TBL_IN_COL;
#ifdef FEED_TABLE_DEBUG
{
TextListItem *it;
int i = tbl->col, j = tbl->row;
fprintf(stderr, "(a) row,col: %d, %d\n", j, i);
if (tbl->tabdata[j] && tbl->tabdata[j][i]) {
for (it = ((TextList *)tbl->tabdata[j][i])->first;
it; it = it->next)
fprintf(stderr, " [%s] \n", it->ptr);
}
}
#endif
return TAG_ACTION_NONE;
case HTML_P:
case HTML_BR:
case HTML_CENTER:
case HTML_N_CENTER:
case HTML_DIV:
case HTML_N_DIV:
if (!(tbl->flag & TBL_IN_ROW))
break;
case HTML_DT:
case HTML_DD:
case HTML_H:
case HTML_N_H:
case HTML_LI:
case HTML_PRE:
case HTML_N_PRE:
case HTML_HR:
case HTML_LISTING:
case HTML_XMP:
case HTML_PLAINTEXT:
case HTML_PRE_PLAIN:
case HTML_N_PRE_PLAIN:
feed_table_block_tag(tbl, line, mode, 0, cmd);
switch (cmd) {
case HTML_PRE:
case HTML_PRE_PLAIN:
mode->pre_mode |= TBLM_PRE;
break;
case HTML_N_PRE:
case HTML_N_PRE_PLAIN:
mode->pre_mode &= ~TBLM_PRE;
break;
case HTML_LISTING:
mode->pre_mode |= TBLM_PLAIN;
mode->end_tag = HTML_N_LISTING;
break;
case HTML_XMP:
mode->pre_mode |= TBLM_PLAIN;
mode->end_tag = HTML_N_XMP;
break;
case HTML_PLAINTEXT:
mode->pre_mode |= TBLM_PLAIN;
mode->end_tag = MAX_HTMLTAG;
break;
}
break;
case HTML_DL:
case HTML_BLQ:
case HTML_OL:
case HTML_UL:
feed_table_block_tag(tbl, line, mode, 1, cmd);
break;
case HTML_N_DL:
case HTML_N_BLQ:
case HTML_N_OL:
case HTML_N_UL:
feed_table_block_tag(tbl, line, mode, -1, cmd);
break;
case HTML_NOBR:
case HTML_WBR:
if (!(tbl->flag & TBL_IN_ROW))
break;
case HTML_PRE_INT:
feed_table_inline_tag(tbl, line, mode, -1);
switch (cmd) {
case HTML_NOBR:
mode->nobr_level++;
if (mode->pre_mode & TBLM_NOBR)
return TAG_ACTION_NONE;
mode->pre_mode |= TBLM_NOBR;
break;
case HTML_PRE_INT:
if (mode->pre_mode & TBLM_PRE_INT)
return TAG_ACTION_NONE;
mode->pre_mode |= TBLM_PRE_INT;
tbl->linfo.prev_spaces = 0;
break;
}
mode->nobr_offset = -1;
if (tbl->linfo.length > 0) {
check_minimum0(tbl, tbl->linfo.length);
tbl->linfo.length = 0;
}
break;
case HTML_N_NOBR:
if (!(tbl->flag & TBL_IN_ROW))
break;
feed_table_inline_tag(tbl, line, mode, -1);
if (mode->nobr_level > 0)
mode->nobr_level--;
if (mode->nobr_level == 0)
mode->pre_mode &= ~TBLM_NOBR;
break;
case HTML_N_PRE_INT:
feed_table_inline_tag(tbl, line, mode, -1);
mode->pre_mode &= ~TBLM_PRE_INT;
break;
case HTML_IMG:
check_rowcol(tbl, mode);
w = tbl->fixed_width[tbl->col];
if (w < 0) {
if (tbl->total_width > 0)
w = -tbl->total_width * w / 100;
else if (width > 0)
w = -width * w / 100;
else
w = 0;
}
else if (w == 0) {
if (tbl->total_width > 0)
w = tbl->total_width;
else if (width > 0)
w = width;
}
tok = process_img(tag, w);
feed_table1(tbl, tok, mode, width);
break;
case HTML_FORM:
feed_table_block_tag(tbl, "", mode, 0, cmd);
tmp = process_form(tag);
if (tmp)
feed_table1(tbl, tmp, mode, width);
break;
case HTML_N_FORM:
feed_table_block_tag(tbl, "", mode, 0, cmd);
process_n_form();
break;
case HTML_INPUT:
tmp = process_input(tag);
feed_table1(tbl, tmp, mode, width);
break;
case HTML_BUTTON:
tmp = process_button(tag);
feed_table1(tbl, tmp, mode, width);
break;
case HTML_N_BUTTON:
tmp = process_n_button();
feed_table1(tbl, tmp, mode, width);
break;
case HTML_SELECT:
tmp = process_select(tag);
if (tmp)
feed_table1(tbl, tmp, mode, width);
mode->pre_mode |= TBLM_INSELECT;
mode->end_tag = HTML_N_SELECT;
break;
case HTML_N_SELECT:
case HTML_OPTION:
/* nothing */
break;
case HTML_TEXTAREA:
w = 0;
check_rowcol(tbl, mode);
if (tbl->col + 1 <= tbl->maxcol &&
tbl->tabattr[tbl->row][tbl->col + 1] & HTT_X) {
if (cell->icell >= 0 && cell->fixed_width[cell->icell] > 0)
w = cell->fixed_width[cell->icell];
}
else {
if (tbl->fixed_width[tbl->col] > 0)
w = tbl->fixed_width[tbl->col];
}
tmp = process_textarea(tag, w);
if (tmp)
feed_table1(tbl, tmp, mode, width);
mode->pre_mode |= TBLM_INTXTA;
mode->end_tag = HTML_N_TEXTAREA;
break;
case HTML_A:
table_close_anchor0(tbl, mode);
anchor = NULL;
i = 0;
parsedtag_get_value(tag, ATTR_HREF, &anchor);
parsedtag_get_value(tag, ATTR_HSEQ, &i);
if (anchor) {
check_rowcol(tbl, mode);
if (i == 0) {
Str tmp = process_anchor(tag, line);
if (displayLinkNumber)
{
Str t = getLinkNumberStr(-1);
feed_table_inline_tag(tbl, NULL, mode, t->length);
Strcat(tmp, t);
}
pushdata(tbl, tbl->row, tbl->col, tmp->ptr);
}
else
pushdata(tbl, tbl->row, tbl->col, line);
if (i >= 0) {
mode->pre_mode |= TBLM_ANCHOR;
mode->anchor_offset = tbl->tabcontentssize;
}
}
else
suspend_or_pushdata(tbl, line);
break;
case HTML_DEL:
switch (displayInsDel) {
case DISPLAY_INS_DEL_SIMPLE:
mode->pre_mode |= TBLM_DEL;
break;
case DISPLAY_INS_DEL_NORMAL:
feed_table_inline_tag(tbl, line, mode, 5); /* [DEL: */
break;
case DISPLAY_INS_DEL_FONTIFY:
feed_table_inline_tag(tbl, line, mode, -1);
break;
}
break;
case HTML_N_DEL:
switch (displayInsDel) {
case DISPLAY_INS_DEL_SIMPLE:
mode->pre_mode &= ~TBLM_DEL;
break;
case DISPLAY_INS_DEL_NORMAL:
feed_table_inline_tag(tbl, line, mode, 5); /* :DEL] */
break;
case DISPLAY_INS_DEL_FONTIFY:
feed_table_inline_tag(tbl, line, mode, -1);
break;
}
break;
case HTML_S:
switch (displayInsDel) {
case DISPLAY_INS_DEL_SIMPLE:
mode->pre_mode |= TBLM_S;
break;
case DISPLAY_INS_DEL_NORMAL:
feed_table_inline_tag(tbl, line, mode, 3); /* [S: */
break;
case DISPLAY_INS_DEL_FONTIFY:
feed_table_inline_tag(tbl, line, mode, -1);
break;
}
break;
case HTML_N_S:
switch (displayInsDel) {
case DISPLAY_INS_DEL_SIMPLE:
mode->pre_mode &= ~TBLM_S;
break;
case DISPLAY_INS_DEL_NORMAL:
feed_table_inline_tag(tbl, line, mode, 3); /* :S] */
break;
case DISPLAY_INS_DEL_FONTIFY:
feed_table_inline_tag(tbl, line, mode, -1);
break;
}
break;
case HTML_INS:
case HTML_N_INS:
switch (displayInsDel) {
case DISPLAY_INS_DEL_SIMPLE:
break;
case DISPLAY_INS_DEL_NORMAL:
feed_table_inline_tag(tbl, line, mode, 5); /* [INS:, :INS] */
break;
case DISPLAY_INS_DEL_FONTIFY:
feed_table_inline_tag(tbl, line, mode, -1);
break;
}
break;
case HTML_SUP:
case HTML_SUB:
case HTML_N_SUB:
if (!(mode->pre_mode & (TBLM_DEL | TBLM_S)))
feed_table_inline_tag(tbl, line, mode, 1); /* ^, [, ] */
break;
case HTML_N_SUP:
break;
case HTML_TABLE_ALT:
id = -1;
parsedtag_get_value(tag, ATTR_TID, &id);
if (id >= 0 && id < tbl->ntable) {
struct table *tbl1 = tbl->tables[id].ptr;
feed_table_block_tag(tbl, line, mode, 0, cmd);
addcontentssize(tbl, maximum_table_width(tbl1));
check_minimum0(tbl, tbl1->sloppy_width);
#ifdef TABLE_EXPAND
w = tbl1->total_width;
v = 0;
colspan = table_colspan(tbl, tbl->row, tbl->col);
if (colspan > 1) {
if (cell->icell >= 0)
v = cell->fixed_width[cell->icell];
}
else
v = tbl->fixed_width[tbl->col];
if (v < 0 && tbl->real_width > 0 && tbl1->real_width > 0)
w = -(tbl1->real_width * 100) / tbl->real_width;
else
w = tbl1->real_width;
if (w > 0)
check_minimum0(tbl, w);
else if (w < 0 && v < w) {
if (colspan > 1) {
if (cell->icell >= 0)
cell->fixed_width[cell->icell] = w;
}
else
tbl->fixed_width[tbl->col] = w;
}
#endif
setwidth0(tbl, mode);
clearcontentssize(tbl, mode);
}
break;
case HTML_CAPTION:
mode->caption = 1;
break;
case HTML_N_CAPTION:
case HTML_THEAD:
case HTML_N_THEAD:
case HTML_TBODY:
case HTML_N_TBODY:
case HTML_TFOOT:
case HTML_N_TFOOT:
case HTML_COLGROUP:
case HTML_N_COLGROUP:
case HTML_COL:
break;
case HTML_SCRIPT:
mode->pre_mode |= TBLM_SCRIPT;
mode->end_tag = HTML_N_SCRIPT;
break;
case HTML_STYLE:
mode->pre_mode |= TBLM_STYLE;
mode->end_tag = HTML_N_STYLE;
break;
case HTML_N_A:
table_close_anchor0(tbl, mode);
case HTML_FONT:
case HTML_N_FONT:
case HTML_NOP:
suspend_or_pushdata(tbl, line);
break;
case HTML_INTERNAL:
case HTML_N_INTERNAL:
case HTML_FORM_INT:
case HTML_N_FORM_INT:
case HTML_INPUT_ALT:
case HTML_N_INPUT_ALT:
case HTML_SELECT_INT:
case HTML_N_SELECT_INT:
case HTML_OPTION_INT:
case HTML_TEXTAREA_INT:
case HTML_N_TEXTAREA_INT:
case HTML_IMG_ALT:
case HTML_SYMBOL:
case HTML_N_SYMBOL:
default:
/* unknown tag: put into table */
return TAG_ACTION_FEED;
}
return TAG_ACTION_NONE;
}
| 0 |
[
"CWE-399",
"CWE-835"
] |
w3m
|
8354763b90490d4105695df52674d0fcef823e92
| 72,789,509,777,522,440,000,000,000,000,000,000,000 | 697 |
Prevent negative indent value in feed_table_block_tag()
Bug-Debian: https://github.com/tats/w3m/issues/88
|
PS_SERIALIZER_DECODE_FUNC(wddx)
{
zval *retval;
zval **ent;
char *key;
uint key_length;
char tmp[128];
ulong idx;
int hash_type;
int ret;
if (vallen == 0) {
return SUCCESS;
}
MAKE_STD_ZVAL(retval);
if ((ret = php_wddx_deserialize_ex((char *)val, vallen, retval)) == SUCCESS) {
for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(retval));
zend_hash_get_current_data(Z_ARRVAL_P(retval), (void **) &ent) == SUCCESS;
zend_hash_move_forward(Z_ARRVAL_P(retval))) {
hash_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(retval), &key, &key_length, &idx, 0, NULL);
switch (hash_type) {
case HASH_KEY_IS_LONG:
key_length = slprintf(tmp, sizeof(tmp), "%ld", idx) + 1;
key = tmp;
/* fallthru */
case HASH_KEY_IS_STRING:
php_set_session_var(key, key_length-1, *ent, NULL TSRMLS_CC);
PS_ADD_VAR(key);
}
}
}
zval_ptr_dtor(&retval);
return ret;
}
| 1 |
[] |
php-src
|
1785d2b805f64eaaacf98c14c9e13107bf085ab1
| 303,752,914,649,427,200,000,000,000,000,000,000,000 | 40 |
Fixed bug #70741: Session WDDX Packet Deserialization Type Confusion Vulnerability
|
SYSCALL_DEFINE2(old_getrlimit, unsigned int, resource,
struct rlimit __user *, rlim)
{
struct rlimit x;
if (resource >= RLIM_NLIMITS)
return -EINVAL;
task_lock(current->group_leader);
x = current->signal->rlim[resource];
task_unlock(current->group_leader);
if (x.rlim_cur > 0x7FFFFFFF)
x.rlim_cur = 0x7FFFFFFF;
if (x.rlim_max > 0x7FFFFFFF)
x.rlim_max = 0x7FFFFFFF;
return copy_to_user(rlim, &x, sizeof(x))?-EFAULT:0;
}
| 0 |
[
"CWE-264"
] |
linux
|
259e5e6c75a910f3b5e656151dc602f53f9d7548
| 57,554,079,417,031,360,000,000,000,000,000,000,000 | 16 |
Add PR_{GET,SET}_NO_NEW_PRIVS to prevent execve from granting privs
With this change, calling
prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)
disables privilege granting operations at execve-time. For example, a
process will not be able to execute a setuid binary to change their uid
or gid if this bit is set. The same is true for file capabilities.
Additionally, LSM_UNSAFE_NO_NEW_PRIVS is defined to ensure that
LSMs respect the requested behavior.
To determine if the NO_NEW_PRIVS bit is set, a task may call
prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0);
It returns 1 if set and 0 if it is not set. If any of the arguments are
non-zero, it will return -1 and set errno to -EINVAL.
(PR_SET_NO_NEW_PRIVS behaves similarly.)
This functionality is desired for the proposed seccomp filter patch
series. By using PR_SET_NO_NEW_PRIVS, it allows a task to modify the
system call behavior for itself and its child tasks without being
able to impact the behavior of a more privileged task.
Another potential use is making certain privileged operations
unprivileged. For example, chroot may be considered "safe" if it cannot
affect privileged tasks.
Note, this patch causes execve to fail when PR_SET_NO_NEW_PRIVS is
set and AppArmor is in use. It is fixed in a subsequent patch.
Signed-off-by: Andy Lutomirski <[email protected]>
Signed-off-by: Will Drewry <[email protected]>
Acked-by: Eric Paris <[email protected]>
Acked-by: Kees Cook <[email protected]>
v18: updated change desc
v17: using new define values as per 3.4
Signed-off-by: James Morris <[email protected]>
|
static int smack_task_getsid(struct task_struct *p)
{
return smk_curacc_on_task(p, MAY_READ, __func__);
}
| 0 |
[
"CWE-416"
] |
linux
|
a3727a8bac0a9e77c70820655fd8715523ba3db7
| 52,291,036,313,141,245,000,000,000,000,000,000,000 | 4 |
selinux,smack: fix subjective/objective credential use mixups
Jann Horn reported a problem with commit eb1231f73c4d ("selinux:
clarify task subjective and objective credentials") where some LSM
hooks were attempting to access the subjective credentials of a task
other than the current task. Generally speaking, it is not safe to
access another task's subjective credentials and doing so can cause
a number of problems.
Further, while looking into the problem, I realized that Smack was
suffering from a similar problem brought about by a similar commit
1fb057dcde11 ("smack: differentiate between subjective and objective
task credentials").
This patch addresses this problem by restoring the use of the task's
objective credentials in those cases where the task is other than the
current executing task. Not only does this resolve the problem
reported by Jann, it is arguably the correct thing to do in these
cases.
Cc: [email protected]
Fixes: eb1231f73c4d ("selinux: clarify task subjective and objective credentials")
Fixes: 1fb057dcde11 ("smack: differentiate between subjective and objective task credentials")
Reported-by: Jann Horn <[email protected]>
Acked-by: Eric W. Biederman <[email protected]>
Acked-by: Casey Schaufler <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
|
bool PostgreSqlStorage::updateSchemaVersion(int newVersion)
{
QSqlQuery query(logDb());
query.prepare("UPDATE coreinfo SET value = :version WHERE key = 'schemaversion'");
query.bindValue(":version", newVersion);
query.exec();
bool success = true;
if (query.lastError().isValid()) {
qCritical() << "PostgreSqlStorage::updateSchemaVersion(int): Updating schema version failed!";
success = false;
}
return success;
}
| 0 |
[
"CWE-89"
] |
quassel
|
aa1008be162cb27da938cce93ba533f54d228869
| 88,538,203,297,098,280,000,000,000,000,000,000,000 | 14 |
Fixing security vulnerability with Qt 4.8.5+ and PostgreSQL.
Properly detects whether Qt performs slash escaping in SQL queries or
not, and then configures PostgreSQL accordingly. This bug was a
introduced due to a bugfix in Qt 4.8.5 disables slash escaping when
binding queries: https://bugreports.qt-project.org/browse/QTBUG-30076
Thanks to brot and Tucos.
[Fixes #1244]
|
std::unique_ptr<IteratorBase> MakeIteratorInternal(
const string& prefix) const override {
return absl::make_unique<Iterator>(typename Iterator::Params{
this, strings::StrCat(prefix, "::SparseTensorSlice")});
}
| 0 |
[
"CWE-476"
] |
tensorflow
|
02cc160e29d20631de3859c6653184e3f876b9d7
| 171,565,643,510,404,130,000,000,000,000,000,000,000 | 5 |
Prevent nullptr deref in SparseTensorSliceDataset
The arguments must determine a valid sparse tensor. This means that when indices are empty then the values must be empty too (and the reverse).
Also added test, by modifying existing test with empty sparse tensor to now run with an invalid sparse tensor input.
PiperOrigin-RevId: 388562757
Change-Id: Id8b54cd7c2316025b4f9a77292c8fb5344d17609
|
/* use same locking rules as GIFHWADDR ioctl's */
static ssize_t address_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct net_device *ndev = to_net_dev(dev);
ssize_t ret = -EINVAL;
read_lock(&dev_base_lock);
if (dev_isalive(ndev))
ret = sysfs_format_mac(buf, ndev->dev_addr, ndev->addr_len);
read_unlock(&dev_base_lock);
return ret;
| 0 |
[
"CWE-401"
] |
linux
|
895a5e96dbd6386c8e78e5b78e067dcc67b7f0ab
| 108,968,938,426,382,470,000,000,000,000,000,000,000 | 12 |
net-sysfs: Fix mem leak in netdev_register_kobject
syzkaller report this:
BUG: memory leak
unreferenced object 0xffff88837a71a500 (size 256):
comm "syz-executor.2", pid 9770, jiffies 4297825125 (age 17.843s)
hex dump (first 32 bytes):
00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00 .....N..........
ff ff ff ff ff ff ff ff 20 c0 ef 86 ff ff ff ff ........ .......
backtrace:
[<00000000db12624b>] netdev_register_kobject+0x124/0x2e0 net/core/net-sysfs.c:1751
[<00000000dc49a994>] register_netdevice+0xcc1/0x1270 net/core/dev.c:8516
[<00000000e5f3fea0>] tun_set_iff drivers/net/tun.c:2649 [inline]
[<00000000e5f3fea0>] __tun_chr_ioctl+0x2218/0x3d20 drivers/net/tun.c:2883
[<000000001b8ac127>] vfs_ioctl fs/ioctl.c:46 [inline]
[<000000001b8ac127>] do_vfs_ioctl+0x1a5/0x10e0 fs/ioctl.c:690
[<0000000079b269f8>] ksys_ioctl+0x89/0xa0 fs/ioctl.c:705
[<00000000de649beb>] __do_sys_ioctl fs/ioctl.c:712 [inline]
[<00000000de649beb>] __se_sys_ioctl fs/ioctl.c:710 [inline]
[<00000000de649beb>] __x64_sys_ioctl+0x74/0xb0 fs/ioctl.c:710
[<000000007ebded1e>] do_syscall_64+0xc8/0x580 arch/x86/entry/common.c:290
[<00000000db315d36>] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[<00000000115be9bb>] 0xffffffffffffffff
It should call kset_unregister to free 'dev->queues_kset'
in error path of register_queue_kobjects, otherwise will cause a mem leak.
Reported-by: Hulk Robot <[email protected]>
Fixes: 1d24eb4815d1 ("xps: Transmit Packet Steering")
Signed-off-by: YueHaibing <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
ex_open(exarg_T *eap)
{
regmatch_T regmatch;
char_u *p;
#ifdef FEAT_EVAL
if (not_in_vim9(eap) == FAIL)
return;
#endif
curwin->w_cursor.lnum = eap->line2;
beginline(BL_SOL | BL_FIX);
if (*eap->arg == '/')
{
// ":open /pattern/": put cursor in column found with pattern
++eap->arg;
p = skip_regexp(eap->arg, '/', magic_isset());
*p = NUL;
regmatch.regprog = vim_regcomp(eap->arg, magic_isset() ? RE_MAGIC : 0);
if (regmatch.regprog != NULL)
{
// make a copy of the line, when searching for a mark it might be
// flushed
char_u *line = vim_strsave(ml_get_curline());
regmatch.rm_ic = p_ic;
if (vim_regexec(®match, line, (colnr_T)0))
curwin->w_cursor.col = (colnr_T)(regmatch.startp[0] - line);
else
emsg(_(e_no_match));
vim_regfree(regmatch.regprog);
vim_free(line);
}
// Move to the NUL, ignore any other arguments.
eap->arg += STRLEN(eap->arg);
}
check_cursor();
eap->cmdidx = CMD_visual;
do_exedit(eap, NULL);
}
| 0 |
[
"CWE-125"
] |
vim
|
d3a117814d6acbf0dca3eff1a7626843b9b3734a
| 250,659,570,608,126,730,000,000,000,000,000,000,000 | 40 |
patch 8.2.4009: reading one byte beyond the end of the line
Problem: Reading one byte beyond the end of the line.
Solution: Check for NUL byte first.
|
**/
const CImg<T>& save_pnm(const char *const filename, const unsigned int bytes_per_pixel=0) const {
return _save_pnm(0,filename,bytes_per_pixel);
| 0 |
[
"CWE-125"
] |
CImg
|
10af1e8c1ad2a58a0a3342a856bae63e8f257abb
| 54,014,247,487,468,380,000,000,000,000,000,000,000 | 3 |
Fix other issues in 'CImg<T>::load_bmp()'.
|
static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
{
struct vcpu_vmx *vmx = to_vmx(vcpu);
vmx_vcpu_load_vmcs(vcpu, cpu, NULL);
vmx_vcpu_pi_load(vcpu, cpu);
vmx->host_debugctlmsr = get_debugctlmsr();
}
| 0 |
[
"CWE-787"
] |
linux
|
04c4f2ee3f68c9a4bf1653d15f1a9a435ae33f7a
| 64,035,601,274,984,050,000,000,000,000,000,000,000 | 10 |
KVM: VMX: Don't use vcpu->run->internal.ndata as an array index
__vmx_handle_exit() uses vcpu->run->internal.ndata as an index for
an array access. Since vcpu->run is (can be) mapped to a user address
space with a writer permission, the 'ndata' could be updated by the
user process at anytime (the user process can set it to outside the
bounds of the array).
So, it is not safe that __vmx_handle_exit() uses the 'ndata' that way.
Fixes: 1aa561b1a4c0 ("kvm: x86: Add "last CPU" to some KVM_EXIT information")
Signed-off-by: Reiji Watanabe <[email protected]>
Reviewed-by: Jim Mattson <[email protected]>
Message-Id: <[email protected]>
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
|
NOEXPORT void log_raw(SERVICE_OPTIONS *opt,
int level, char *stamp, char *id, char *text) {
char *line;
/* NOTE: opt->log_level may have changed since s_log().
* It is important to use the new value and not the old one. */
/* build the line and log it to syslog/file if configured */
switch(log_mode) {
case LOG_MODE_CONFIGURED:
line=str_printf("%s %s: %s", stamp, id, text);
if(level<=opt->log_level) {
#if !defined(USE_WIN32) && !defined(__vms)
if(global_options.option.log_syslog)
syslog(level, "%s: %s", id, text);
#endif /* USE_WIN32, __vms */
if(outfile)
file_putline(outfile, line);
}
break;
case LOG_MODE_ERROR:
/* don't log the id or the time stamp */
if(level>=0 && level<=7) /* just in case */
line=str_printf("[%c] %s", "***!:. "[level], text);
else
line=str_printf("[?] %s", text);
break;
default: /* LOG_MODE_INFO */
/* don't log the level, the id or the time stamp */
line=str_dup(text);
}
/* free the memory */
str_free(stamp);
str_free(id);
str_free(text);
/* log the line to the UI (GUI, stderr, etc.) */
if(log_mode==LOG_MODE_ERROR ||
(log_mode==LOG_MODE_INFO && level<LOG_DEBUG) ||
#if defined(USE_WIN32) || defined(USE_JNI)
level<=opt->log_level
#else
(level<=opt->log_level &&
opt->option.log_stderr)
#endif
)
ui_new_log(line);
str_free(line);
}
| 0 |
[
"CWE-295"
] |
stunnel
|
ebad9ddc4efb2635f37174c9d800d06206f1edf9
| 5,198,076,609,423,865,600,000,000,000,000,000,000 | 51 |
stunnel-5.57
|
struct blkg_rwstat blkg_rwstat_recursive_sum(struct blkcg_gq *blkg,
struct blkcg_policy *pol, int off)
{
struct blkcg_gq *pos_blkg;
struct cgroup_subsys_state *pos_css;
struct blkg_rwstat sum = { };
int i;
lockdep_assert_held(blkg->q->queue_lock);
rcu_read_lock();
blkg_for_each_descendant_pre(pos_blkg, pos_css, blkg) {
struct blkg_rwstat *rwstat;
if (!pos_blkg->online)
continue;
if (pol)
rwstat = (void *)blkg_to_pd(pos_blkg, pol) + off;
else
rwstat = (void *)pos_blkg + off;
for (i = 0; i < BLKG_RWSTAT_NR; i++)
atomic64_add(atomic64_read(&rwstat->aux_cnt[i]) +
percpu_counter_sum_positive(&rwstat->cpu_cnt[i]),
&sum.aux_cnt[i]);
}
rcu_read_unlock();
return sum;
}
| 0 |
[
"CWE-415"
] |
linux
|
9b54d816e00425c3a517514e0d677bb3cec49258
| 186,650,313,365,916,830,000,000,000,000,000,000,000 | 31 |
blkcg: fix double free of new_blkg in blkcg_init_queue
If blkg_create fails, new_blkg passed as an argument will
be freed by blkg_create, so there is no need to free it again.
Signed-off-by: Hou Tao <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
|
static const char *cache_id(const char *id)
{
static char clean[SHORT_STRING];
strfcpy (clean, id, sizeof(clean));
mutt_sanitize_filename (clean, 1);
return clean;
}
| 0 |
[
"CWE-119"
] |
mutt
|
6aed28b40a0410ec47d40c8c7296d8d10bae7576
| 302,134,844,118,637,420,000,000,000,000,000,000,000 | 9 |
Sanitize POP bcache paths.
Protect against bcache directory path traversal for UID values.
Thanks for Jeriko One for the bug report and patch, which this commit
is based upon.
|
static int write_reuc_extension(git_index *index, git_filebuf *file)
{
git_buf reuc_buf = GIT_BUF_INIT;
git_vector *out = &index->reuc;
git_index_reuc_entry *reuc;
struct index_extension extension;
size_t i;
int error = 0;
git_vector_foreach(out, i, reuc) {
if ((error = create_reuc_extension_data(&reuc_buf, reuc)) < 0)
goto done;
}
memset(&extension, 0x0, sizeof(struct index_extension));
memcpy(&extension.signature, INDEX_EXT_UNMERGED_SIG, 4);
extension.extension_size = (uint32_t)reuc_buf.size;
error = write_extension(file, &extension, &reuc_buf);
git_buf_free(&reuc_buf);
done:
return error;
}
| 0 |
[
"CWE-415",
"CWE-190"
] |
libgit2
|
3db1af1f370295ad5355b8f64b865a2a357bcac0
| 264,885,587,593,283,680,000,000,000,000,000,000,000 | 25 |
index: error out on unreasonable prefix-compressed path lengths
When computing the complete path length from the encoded
prefix-compressed path, we end up just allocating the complete path
without ever checking what the encoded path length actually is. This can
easily lead to a denial of service by just encoding an unreasonable long
path name inside of the index. Git already enforces a maximum path
length of 4096 bytes. As we also have that enforcement ready in some
places, just make sure that the resulting path is smaller than
GIT_PATH_MAX.
Reported-by: Krishna Ram Prakash R <[email protected]>
Reported-by: Vivek Parikh <[email protected]>
|
void *kthread_probe_data(struct task_struct *task)
{
struct kthread *kthread = to_kthread(task);
void *data = NULL;
probe_kernel_read(&data, &kthread->data, sizeof(data));
return data;
}
| 0 |
[
"CWE-200"
] |
tip
|
dfb4357da6ddbdf57d583ba64361c9d792b0e0b1
| 290,485,855,884,760,130,000,000,000,000,000,000,000 | 8 |
time: Remove CONFIG_TIMER_STATS
Currently CONFIG_TIMER_STATS exposes process information across namespaces:
kernel/time/timer_list.c print_timer():
SEQ_printf(m, ", %s/%d", tmp, timer->start_pid);
/proc/timer_list:
#11: <0000000000000000>, hrtimer_wakeup, S:01, do_nanosleep, cron/2570
Given that the tracer can give the same information, this patch entirely
removes CONFIG_TIMER_STATS.
Suggested-by: Thomas Gleixner <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
Acked-by: John Stultz <[email protected]>
Cc: Nicolas Pitre <[email protected]>
Cc: [email protected]
Cc: Lai Jiangshan <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Xing Gao <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Jessica Frazelle <[email protected]>
Cc: [email protected]
Cc: Nicolas Iooss <[email protected]>
Cc: "Paul E. McKenney" <[email protected]>
Cc: Petr Mladek <[email protected]>
Cc: Richard Cochran <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: Josh Poimboeuf <[email protected]>
Cc: Dmitry Vyukov <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Olof Johansson <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
Cc: Arjan van de Ven <[email protected]>
Link: http://lkml.kernel.org/r/20170208192659.GA32582@beast
Signed-off-by: Thomas Gleixner <[email protected]>
|
void DataWriterImpl::InnerDataWriterListener::on_offered_incompatible_qos(
RTPSWriter* /*writer*/,
fastdds::dds::PolicyMask qos)
{
data_writer_->update_offered_incompatible_qos(qos);
DataWriterListener* listener = data_writer_->get_listener_for(StatusMask::offered_incompatible_qos());
if (listener != nullptr)
{
OfferedIncompatibleQosStatus callback_status;
if (data_writer_->get_offered_incompatible_qos_status(callback_status) == ReturnCode_t::RETCODE_OK)
{
listener->on_offered_incompatible_qos(data_writer_->user_datawriter_, callback_status);
}
}
}
| 0 |
[
"CWE-284"
] |
Fast-DDS
|
d2aeab37eb4fad4376b68ea4dfbbf285a2926384
| 334,333,787,023,019,560,000,000,000,000,000,000,000 | 15 |
check remote permissions (#1387)
* Refs 5346. Blackbox test
Signed-off-by: Iker Luengo <[email protected]>
* Refs 5346. one-way string compare
Signed-off-by: Iker Luengo <[email protected]>
* Refs 5346. Do not add partition separator on last partition
Signed-off-by: Iker Luengo <[email protected]>
* Refs 5346. Uncrustify
Signed-off-by: Iker Luengo <[email protected]>
* Refs 5346. Uncrustify
Signed-off-by: Iker Luengo <[email protected]>
* Refs 3680. Access control unit testing
It only covers Partition and Topic permissions
Signed-off-by: Iker Luengo <[email protected]>
* Refs #3680. Fix partition check on Permissions plugin.
Signed-off-by: Iker Luengo <[email protected]>
* Refs 3680. Uncrustify
Signed-off-by: Iker Luengo <[email protected]>
* Refs 3680. Fix tests on mac
Signed-off-by: Iker Luengo <[email protected]>
* Refs 3680. Fix windows tests
Signed-off-by: Iker Luengo <[email protected]>
* Refs 3680. Avoid memory leak on test
Signed-off-by: Iker Luengo <[email protected]>
* Refs 3680. Proxy data mocks should not return temporary objects
Signed-off-by: Iker Luengo <[email protected]>
* refs 3680. uncrustify
Signed-off-by: Iker Luengo <[email protected]>
Co-authored-by: Miguel Company <[email protected]>
|
static int sb_permission(struct super_block *sb, struct inode *inode, int mask)
{
if (unlikely(mask & MAY_WRITE)) {
umode_t mode = inode->i_mode;
/* Nobody gets write access to a read-only fs. */
if (sb_rdonly(sb) && (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
return -EROFS;
}
return 0;
}
| 0 |
[
"CWE-416",
"CWE-284"
] |
linux
|
d0cb50185ae942b03c4327be322055d622dc79f6
| 98,542,976,747,902,060,000,000,000,000,000,000,000 | 11 |
do_last(): fetch directory ->i_mode and ->i_uid before it's too late
may_create_in_sticky() call is done when we already have dropped the
reference to dir.
Fixes: 30aba6656f61e (namei: allow restricted O_CREAT of FIFOs and regular files)
Signed-off-by: Al Viro <[email protected]>
|
static void __cdecl kill_server(int sig_ptr)
#define RETURN_FROM_KILL_SERVER return
#endif
{
DBUG_ENTER("kill_server");
#ifndef EMBEDDED_LIBRARY
int sig=(int) (long) sig_ptr; // This is passed a int
// if there is a signal during the kill in progress, ignore the other
if (kill_in_progress) // Safety
{
DBUG_LEAVE;
RETURN_FROM_KILL_SERVER;
}
kill_in_progress=TRUE;
abort_loop=1; // This should be set
if (sig != 0) // 0 is not a valid signal number
my_sigset(sig, SIG_IGN); /* purify inspected */
if (sig == MYSQL_KILL_SIGNAL || sig == 0)
sql_print_information(ER_DEFAULT(ER_NORMAL_SHUTDOWN),my_progname);
else
sql_print_error(ER_DEFAULT(ER_GOT_SIGNAL),my_progname,sig); /* purecov: inspected */
#if defined(HAVE_SMEM) && defined(__WIN__)
/*
Send event to smem_event_connect_request for aborting
*/
if (opt_enable_shared_memory)
{
if (!SetEvent(smem_event_connect_request))
{
DBUG_PRINT("error",
("Got error: %ld from SetEvent of smem_event_connect_request",
GetLastError()));
}
}
#endif
close_connections();
if (sig != MYSQL_KILL_SIGNAL &&
sig != 0)
unireg_abort(1); /* purecov: inspected */
else
unireg_end();
/* purecov: begin deadcode */
DBUG_LEAVE; // Must match DBUG_ENTER()
my_thread_end();
pthread_exit(0);
/* purecov: end */
RETURN_FROM_KILL_SERVER; // Avoid compiler warnings
#else /* EMBEDDED_LIBRARY*/
DBUG_LEAVE;
RETURN_FROM_KILL_SERVER;
#endif /* EMBEDDED_LIBRARY */
}
| 0 |
[
"CWE-264"
] |
mysql-server
|
48bd8b16fe382be302c6f0b45931be5aa6f29a0e
| 326,025,408,511,822,000,000,000,000,000,000,000,000 | 59 |
Bug#24388753: PRIVILEGE ESCALATION USING MYSQLD_SAFE
[This is the 5.5/5.6 version of the bugfix].
The problem was that it was possible to write log files ending
in .ini/.cnf that later could be parsed as an options file.
This made it possible for users to specify startup options
without the permissions to do so.
This patch fixes the problem by disallowing general query log
and slow query log to be written to files ending in .ini and .cnf.
|
XML_SetBase(XML_Parser parser, const XML_Char *p)
{
if (p) {
p = poolCopyString(&_dtd->pool, p);
if (!p)
return XML_STATUS_ERROR;
curBase = p;
}
else
curBase = NULL;
return XML_STATUS_OK;
}
| 0 |
[
"CWE-119"
] |
libexpat
|
ba0f9c3b40c264b8dd392e02a7a060a8fa54f032
| 256,601,382,850,077,180,000,000,000,000,000,000,000 | 12 |
CVE-2015-1283 Sanity check size calculations. r=peterv, a=abillings
https://sourceforge.net/p/expat/bugs/528/
|
void AuthorizationManager::addAuthorizedPrincipal(Principal* principal) {
// Log out any already-logged-in user on the same database as "principal".
logoutDatabase(principal->getName().getDB().toString()); // See SERVER-8144.
_authenticatedPrincipals.add(principal);
if (!principal->isImplicitPrivilegeAcquisitionEnabled())
return;
const std::string dbname = principal->getName().getDB().toString();
if (dbname == StringData("local", StringData::LiteralTag()) &&
principal->getName().getUser() == internalSecurity.user) {
// Grant full access to internal user
ActionSet allActions;
allActions.addAllActions();
acquirePrivilege(Privilege(PrivilegeSet::WILDCARD_RESOURCE, allActions),
principal->getName());
return;
}
_acquirePrivilegesForPrincipalFromDatabase(ADMIN_DBNAME, principal->getName());
principal->markDatabaseAsProbed(ADMIN_DBNAME);
_acquirePrivilegesForPrincipalFromDatabase(dbname, principal->getName());
principal->markDatabaseAsProbed(dbname);
}
| 0 |
[
"CWE-264"
] |
mongo
|
23344f8b7506df694f66999693ee3c00dfd6afae
| 51,989,897,068,632,400,000,000,000,000,000,000,000 | 26 |
SERVER-9983 Do not needlessly lock when looking up privileges for the __system@local user.
Uncorrected, this can cause replica set heartbeats to stall behind operations
that hold the read lock for a long time.
|
TEST_P(Http2IntegrationTest, GoAway) {
config_helper_.addFilter(ConfigHelper::defaultHealthCheckFilter());
initialize();
codec_client_ = makeHttpConnection(lookupPort("http"));
auto encoder_decoder = codec_client_->startRequest(Http::TestRequestHeaderMapImpl{
{":method", "GET"}, {":path", "/healthcheck"}, {":scheme", "http"}, {":authority", "host"}});
request_encoder_ = &encoder_decoder.first;
auto response = std::move(encoder_decoder.second);
codec_client_->goAway();
codec_client_->sendData(*request_encoder_, 0, true);
response->waitForEndStream();
codec_client_->close();
EXPECT_TRUE(response->complete());
EXPECT_EQ("200", response->headers().getStatusValue());
}
| 0 |
[
"CWE-400"
] |
envoy
|
0e49a495826ea9e29134c1bd54fdeb31a034f40c
| 53,363,151,657,000,625,000,000,000,000,000,000,000 | 17 |
http/2: add stats and stream flush timeout (#139)
This commit adds a new stream flush timeout to guard against a
remote server that does not open window once an entire stream has
been buffered for flushing. Additional stats have also been added
to better understand the codecs view of active streams as well as
amount of data buffered.
Signed-off-by: Matt Klein <[email protected]>
|
static int do_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
{
struct ifinfomsg *ifm = NLMSG_DATA(nlh);
struct rtattr **ida = arg;
struct net_device *dev;
int err, send_addr_notify = 0;
if (ifm->ifi_index >= 0)
dev = dev_get_by_index(ifm->ifi_index);
else if (ida[IFLA_IFNAME - 1]) {
char ifname[IFNAMSIZ];
if (rtattr_strlcpy(ifname, ida[IFLA_IFNAME - 1],
IFNAMSIZ) >= IFNAMSIZ)
return -EINVAL;
dev = dev_get_by_name(ifname);
} else
return -EINVAL;
if (!dev)
return -ENODEV;
err = -EINVAL;
if (ifm->ifi_flags)
dev_change_flags(dev, ifm->ifi_flags);
if (ida[IFLA_MAP - 1]) {
struct rtnl_link_ifmap *u_map;
struct ifmap k_map;
if (!dev->set_config) {
err = -EOPNOTSUPP;
goto out;
}
if (!netif_device_present(dev)) {
err = -ENODEV;
goto out;
}
if (ida[IFLA_MAP - 1]->rta_len != RTA_LENGTH(sizeof(*u_map)))
goto out;
u_map = RTA_DATA(ida[IFLA_MAP - 1]);
k_map.mem_start = (unsigned long) u_map->mem_start;
k_map.mem_end = (unsigned long) u_map->mem_end;
k_map.base_addr = (unsigned short) u_map->base_addr;
k_map.irq = (unsigned char) u_map->irq;
k_map.dma = (unsigned char) u_map->dma;
k_map.port = (unsigned char) u_map->port;
err = dev->set_config(dev, &k_map);
if (err)
goto out;
}
if (ida[IFLA_ADDRESS - 1]) {
if (!dev->set_mac_address) {
err = -EOPNOTSUPP;
goto out;
}
if (!netif_device_present(dev)) {
err = -ENODEV;
goto out;
}
if (ida[IFLA_ADDRESS - 1]->rta_len != RTA_LENGTH(dev->addr_len))
goto out;
err = dev->set_mac_address(dev, RTA_DATA(ida[IFLA_ADDRESS - 1]));
if (err)
goto out;
send_addr_notify = 1;
}
if (ida[IFLA_BROADCAST - 1]) {
if (ida[IFLA_BROADCAST - 1]->rta_len != RTA_LENGTH(dev->addr_len))
goto out;
memcpy(dev->broadcast, RTA_DATA(ida[IFLA_BROADCAST - 1]),
dev->addr_len);
send_addr_notify = 1;
}
if (ida[IFLA_MTU - 1]) {
if (ida[IFLA_MTU - 1]->rta_len != RTA_LENGTH(sizeof(u32)))
goto out;
err = dev_set_mtu(dev, *((u32 *) RTA_DATA(ida[IFLA_MTU - 1])));
if (err)
goto out;
}
if (ida[IFLA_TXQLEN - 1]) {
if (ida[IFLA_TXQLEN - 1]->rta_len != RTA_LENGTH(sizeof(u32)))
goto out;
dev->tx_queue_len = *((u32 *) RTA_DATA(ida[IFLA_TXQLEN - 1]));
}
if (ida[IFLA_WEIGHT - 1]) {
if (ida[IFLA_WEIGHT - 1]->rta_len != RTA_LENGTH(sizeof(u32)))
goto out;
dev->weight = *((u32 *) RTA_DATA(ida[IFLA_WEIGHT - 1]));
}
if (ifm->ifi_index >= 0 && ida[IFLA_IFNAME - 1]) {
char ifname[IFNAMSIZ];
if (rtattr_strlcpy(ifname, ida[IFLA_IFNAME - 1],
IFNAMSIZ) >= IFNAMSIZ)
goto out;
err = dev_change_name(dev, ifname);
if (err)
goto out;
}
err = 0;
out:
if (send_addr_notify)
call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
dev_put(dev);
return err;
}
| 0 |
[
"CWE-200"
] |
linux-2.6
|
9ef1d4c7c7aca1cd436612b6ca785b726ffb8ed8
| 101,526,516,298,844,730,000,000,000,000,000,000,000 | 129 |
[NETLINK]: Missing initializations in dumped data
Mostly missing initialization of padding fields of 1 or 2 bytes length,
two instances of uninitialized nlmsgerr->msg of 16 bytes length.
Signed-off-by: Patrick McHardy <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
port::StatusOr<DeviceMemory<uint8>> AllocateCudnnConvolutionForwardWorkspace(
Stream* stream, const CudnnHandle& cudnn,
const CudnnTensorDescriptor& input_nd, const CudnnFilterDescriptor& filter,
const CudnnConvolutionDescriptor& conv,
const CudnnTensorDescriptor& output_nd,
const dnn::AlgorithmDesc& algorithm_desc,
ScratchAllocator* scratch_allocator) {
if (IsTensorMathOpSet(conv) != algorithm_desc.tensor_ops_enabled()) {
return port::Status(
port::error::INTERNAL,
"Mismatch between cudnn conv and algorithm descriptors.");
}
// Query the size of the workspace and allocate it.
size_t size_in_bytes;
RETURN_IF_CUDNN_ERROR(cudnnGetConvolutionForwardWorkspaceSize(
cudnn.handle(),
/*xDesc=*/input_nd.handle(),
/*wDesc=*/filter.handle(), /*convDesc=*/conv.handle(),
/*yDesc=*/output_nd.handle(), /*algo=*/ToConvForwardAlgo(algorithm_desc),
/*sizeInBytes=*/&size_in_bytes));
int64 size_in_bytes_int64 = size_in_bytes;
if (TF_PREDICT_FALSE(size_in_bytes_int64 < 0)) {
return port::Status(
port::error::INTERNAL,
"cudnnGetConvolutionForwardWorkspaceSize() returned "
"negative sizeInBytes value. This could be a cudnn bug.");
}
if (size_in_bytes_int64 == 0) {
return DeviceMemory<uint8>();
}
if (TF_PREDICT_FALSE(!scratch_allocator)) {
return port::Status(port::error::INVALID_ARGUMENT,
"No scratch allocator provided");
}
return scratch_allocator->AllocateBytes(size_in_bytes);
}
| 0 |
[
"CWE-20"
] |
tensorflow
|
14755416e364f17fb1870882fa778c7fec7f16e3
| 41,193,248,060,121,140,000,000,000,000,000,000,000 | 42 |
Prevent CHECK-fail in LSTM/GRU with zero-length input.
PiperOrigin-RevId: 346239181
Change-Id: I5f233dbc076aab7bb4e31ba24f5abd4eaf99ea4f
|
void controller::save_feed(std::shared_ptr<rss_feed> feed, unsigned int pos) {
if (!feed->is_empty()) {
LOG(level::DEBUG, "controller::save_feed: feed is nonempty, saving");
rsscache->externalize_rssfeed(feed, ign.matches_resetunread(feed->rssurl()));
LOG(level::DEBUG, "controller::save_feed: after externalize_rssfeed");
bool ignore_disp = (cfg.get_configvalue("ignore-mode") == "display");
feed = rsscache->internalize_rssfeed(feed->rssurl(), ignore_disp ? &ign : nullptr);
LOG(level::DEBUG, "controller::save_feed: after internalize_rssfeed");
feed->set_tags(urlcfg->get_tags(feed->rssurl()));
{
unsigned int order = feeds[pos]->get_order();
std::lock_guard<std::mutex> itemlock(feeds[pos]->item_mutex);
feeds[pos]->clear_items();
feed->set_order(order);
}
feeds[pos] = feed;
v->notify_itemlist_change(feeds[pos]);
} else {
LOG(level::DEBUG, "controller::save_feed: feed is empty, not saving");
}
}
| 0 |
[
"CWE-943",
"CWE-787"
] |
newsbeuter
|
96e9506ae9e252c548665152d1b8968297128307
| 50,248,045,861,635,945,000,000,000,000,000,000,000 | 22 |
Sanitize inputs to bookmark-cmd (#591)
Newsbeuter didn't properly shell-escape the arguments passed to
bookmarking command, which allows a remote attacker to perform remote
code execution by crafting an RSS item whose title and/or URL contain
something interpretable by the shell (most notably subshell
invocations.)
This has been reported by Jeriko One <[email protected]>, complete with
PoC and a patch.
This vulnerability was assigned CVE-2017-12904.
|
pci_pirq_prt_entry(int bus, int slot, int pin, int pirq_pin, int ioapic_irq,
void *arg)
{
char *name;
name = lpc_pirq_name(pirq_pin);
if (name == NULL)
return;
dsdt_line(" Package ()");
dsdt_line(" {");
dsdt_line(" 0x%X,", slot << 16 | 0xffff);
dsdt_line(" 0x%02X,", pin - 1);
dsdt_line(" %s,", name);
dsdt_line(" 0x00");
dsdt_line(" },");
free(name);
}
| 0 |
[
"CWE-617",
"CWE-703"
] |
acrn-hypervisor
|
6199e653418eda58cd698d8769820904453e2535
| 218,315,822,353,214,700,000,000,000,000,000,000,000 | 17 |
dm: validate the input in 'pci_emul_mem_handler()'
checking the inputs explicitly instead of using Assert.
Tracked-On: #4003
Signed-off-by: Yonghua Huang <[email protected]>
Reviewed-by: Shuo Liu <[email protected]>
Acked-by: Yu Wang <[email protected]>
|
static int acquire_home(const ExecContext *c, uid_t uid, const char** home, char **buf) {
int r;
assert(c);
assert(home);
assert(buf);
/* If WorkingDirectory=~ is set, try to acquire a usable home directory. */
if (*home)
return 0;
if (!c->working_directory_home)
return 0;
r = get_home_dir(buf);
if (r < 0)
return r;
*home = *buf;
return 1;
}
| 0 |
[
"CWE-269"
] |
systemd
|
f69567cbe26d09eac9d387c0be0fc32c65a83ada
| 137,838,744,628,262,370,000,000,000,000,000,000,000 | 22 |
core: expose SUID/SGID restriction as new unit setting RestrictSUIDSGID=
|
static int handle_xsetbv(struct kvm_vcpu *vcpu)
{
u64 new_bv = kvm_read_edx_eax(vcpu);
u32 index = kvm_rcx_read(vcpu);
int err = kvm_set_xcr(vcpu, index, new_bv);
return kvm_complete_insn_gp(vcpu, err);
}
| 0 |
[
"CWE-787"
] |
linux
|
04c4f2ee3f68c9a4bf1653d15f1a9a435ae33f7a
| 131,891,135,943,346,400,000,000,000,000,000,000,000 | 8 |
KVM: VMX: Don't use vcpu->run->internal.ndata as an array index
__vmx_handle_exit() uses vcpu->run->internal.ndata as an index for
an array access. Since vcpu->run is (can be) mapped to a user address
space with a writer permission, the 'ndata' could be updated by the
user process at anytime (the user process can set it to outside the
bounds of the array).
So, it is not safe that __vmx_handle_exit() uses the 'ndata' that way.
Fixes: 1aa561b1a4c0 ("kvm: x86: Add "last CPU" to some KVM_EXIT information")
Signed-off-by: Reiji Watanabe <[email protected]>
Reviewed-by: Jim Mattson <[email protected]>
Message-Id: <[email protected]>
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
|
int net_send(int s, int command, void *arg, int len)
{
struct net_hdr *pnh;
char *pktbuf;
size_t pktlen;
pktlen = sizeof(struct net_hdr) + len;
pktbuf = (char*)calloc(sizeof(char), pktlen);
if (pktbuf == NULL) {
perror("calloc");
goto net_send_error;
}
pnh = (struct net_hdr*)pktbuf;
pnh->nh_type = command;
pnh->nh_len = htonl(len);
memcpy(pktbuf + sizeof(struct net_hdr), arg, len);
for (;;) {
ssize_t rc = send(s, pktbuf, pktlen, 0);
if ((size_t)rc == pktlen)
break;
if (rc == EAGAIN || rc == EWOULDBLOCK || rc == EINTR)
continue;
if (rc == ECONNRESET)
printf("Connection reset while sending packet!\n");
goto net_send_error;
}
free(pktbuf);
return 0;
net_send_error:
free(pktbuf);
return -1;
}
| 0 |
[
"CWE-20",
"CWE-787"
] |
aircrack-ng
|
88702a3ce4c28a973bf69023cd0312f412f6193e
| 208,658,545,235,280,780,000,000,000,000,000,000,000 | 42 |
OSdep: Fixed segmentation fault that happens with a malicious server sending a negative length (Closes #16 on GitHub).
git-svn-id: http://svn.aircrack-ng.org/trunk@2419 28c6078b-6c39-48e3-add9-af49d547ecab
|
QPDF::addPage(QPDFObjectHandle newpage, bool first)
{
if (first)
{
insertPage(newpage, 0);
}
else
{
insertPage(
newpage,
getRoot().getKey("/Pages").getKey("/Count").getIntValueAsInt());
}
}
| 0 |
[
"CWE-787"
] |
qpdf
|
d71f05ca07eb5c7cfa4d6d23e5c1f2a800f52e8e
| 105,315,133,333,608,270,000,000,000,000,000,000,000 | 13 |
Fix sign and conversion warnings (major)
This makes all integer type conversions that have potential data loss
explicit with calls that do range checks and raise an exception. After
this commit, qpdf builds with no warnings when -Wsign-conversion
-Wconversion is used with gcc or clang or when -W3 -Wd4800 is used
with MSVC. This significantly reduces the likelihood of potential
crashes from bogus integer values.
There are some parts of the code that take int when they should take
size_t or an offset. Such places would make qpdf not support files
with more than 2^31 of something that usually wouldn't be so large. In
the event that such a file shows up and is valid, at least qpdf would
raise an error in the right spot so the issue could be legitimately
addressed rather than failing in some weird way because of a silent
overflow condition.
|
write_char (unsigned char * data, int offset, char value)
{ data [offset] = value ;
} /* write_char */
| 0 |
[
"CWE-119",
"CWE-787"
] |
libsndfile
|
dbe14f00030af5d3577f4cabbf9861db59e9c378
| 166,218,310,965,201,400,000,000,000,000,000,000,000 | 3 |
src/sd2.c : Fix two potential buffer read overflows.
Closes: https://github.com/erikd/libsndfile/issues/93
|
static inline void audit_free_rule(struct audit_entry *e)
{
int i;
/* some rules don't have associated watches */
if (e->rule.watch)
audit_put_watch(e->rule.watch);
if (e->rule.fields)
for (i = 0; i < e->rule.field_count; i++) {
struct audit_field *f = &e->rule.fields[i];
kfree(f->lsm_str);
security_audit_rule_free(f->lsm_rule);
}
kfree(e->rule.fields);
kfree(e->rule.filterkey);
kfree(e);
}
| 0 |
[
"CWE-362"
] |
linux-2.6
|
8f7b0ba1c853919b85b54774775f567f30006107
| 38,378,573,385,406,790,000,000,000,000,000,000,000 | 17 |
Fix inotify watch removal/umount races
Inotify watch removals suck violently.
To kick the watch out we need (in this order) inode->inotify_mutex and
ih->mutex. That's fine if we have a hold on inode; however, for all
other cases we need to make damn sure we don't race with umount. We can
*NOT* just grab a reference to a watch - inotify_unmount_inodes() will
happily sail past it and we'll end with reference to inode potentially
outliving its superblock.
Ideally we just want to grab an active reference to superblock if we
can; that will make sure we won't go into inotify_umount_inodes() until
we are done. Cleanup is just deactivate_super().
However, that leaves a messy case - what if we *are* racing with
umount() and active references to superblock can't be acquired anymore?
We can bump ->s_count, grab ->s_umount, which will almost certainly wait
until the superblock is shut down and the watch in question is pining
for fjords. That's fine, but there is a problem - we might have hit the
window between ->s_active getting to 0 / ->s_count - below S_BIAS (i.e.
the moment when superblock is past the point of no return and is heading
for shutdown) and the moment when deactivate_super() acquires
->s_umount.
We could just do drop_super() yield() and retry, but that's rather
antisocial and this stuff is luser-triggerable. OTOH, having grabbed
->s_umount and having found that we'd got there first (i.e. that
->s_root is non-NULL) we know that we won't race with
inotify_umount_inodes().
So we could grab a reference to watch and do the rest as above, just
with drop_super() instead of deactivate_super(), right? Wrong. We had
to drop ih->mutex before we could grab ->s_umount. So the watch
could've been gone already.
That still can be dealt with - we need to save watch->wd, do idr_find()
and compare its result with our pointer. If they match, we either have
the damn thing still alive or we'd lost not one but two races at once,
the watch had been killed and a new one got created with the same ->wd
at the same address. That couldn't have happened in inotify_destroy(),
but inotify_rm_wd() could run into that. Still, "new one got created"
is not a problem - we have every right to kill it or leave it alone,
whatever's more convenient.
So we can use idr_find(...) == watch && watch->inode->i_sb == sb as
"grab it and kill it" check. If it's been our original watch, we are
fine, if it's a newcomer - nevermind, just pretend that we'd won the
race and kill the fscker anyway; we are safe since we know that its
superblock won't be going away.
And yes, this is far beyond mere "not very pretty"; so's the entire
concept of inotify to start with.
Signed-off-by: Al Viro <[email protected]>
Acked-by: Greg KH <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
com_tee(String *buffer MY_ATTRIBUTE((unused)),
char *line MY_ATTRIBUTE((unused)))
{
char file_name[FN_REFLEN], *end, *param;
while (my_isspace(charset_info,*line))
line++;
if (!(param = strchr(line, ' '))) // if outfile wasn't given, use the default
{
if (!strlen(outfile))
{
printf("No previous outfile available, you must give a filename!\n");
return 0;
}
else if (opt_outfile)
{
tee_fprintf(stdout, "Currently logging to file '%s'\n", outfile);
return 0;
}
else
param = outfile; //resume using the old outfile
}
/* eliminate the spaces before the parameters */
while (my_isspace(charset_info,*param))
param++;
end= strmake(file_name, param, sizeof(file_name) - 1);
/* remove end space from command line */
while (end > file_name && (my_isspace(charset_info,end[-1]) ||
my_iscntrl(charset_info,end[-1])))
end--;
end[0]= 0;
if (end == file_name)
{
printf("No outfile specified!\n");
return 0;
}
init_tee(file_name);
return 0;
}
| 0 |
[
"CWE-319"
] |
mysql-server
|
0002e1380d5f8c113b6bce91f2cf3f75136fd7c7
| 115,184,068,249,301,900,000,000,000,000,000,000,000 | 40 |
BUG#25575605: SETTING --SSL-MODE=REQUIRED SENDS CREDENTIALS BEFORE VERIFYING SSL CONNECTION
MYSQL_OPT_SSL_MODE option introduced.
It is set in case of --ssl-mode=REQUIRED and permits only SSL connection.
(cherry picked from commit f91b941842d240b8a62645e507f5554e8be76aec)
|
Item_time_literal(THD *thd, MYSQL_TIME *ltime, uint dec_arg):
Item_temporal_literal(thd, ltime, dec_arg)
{
max_length= MIN_TIME_WIDTH + (decimals ? decimals + 1 : 0);
fixed= 1;
}
| 0 |
[
"CWE-617"
] |
server
|
2e7891080667c59ac80f788eef4d59d447595772
| 109,292,535,260,091,570,000,000,000,000,000,000,000 | 6 |
MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view
This bug could manifest itself after pushing a where condition over a
mergeable derived table / view / CTE DT into a grouping view / derived
table / CTE V whose item list contained set functions with constant
arguments such as MIN(2), SUM(1) etc. In such cases the field references
used in the condition pushed into the view V that correspond set functions
are wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation
of the virtual method const_item() for the class Item_direct_view_ref the
wrapped set functions with constant arguments could be erroneously taken
for constant items. This could lead to a wrong result set returned by the
main select query in 10.2. In 10.4 where a possibility of pushing condition
from HAVING into WHERE had been added this could cause a crash.
Approved by Sergey Petrunya <[email protected]>
|
static int crypto_dump_report_done(struct netlink_callback *cb)
{
return 0;
}
| 0 |
[
"CWE-264"
] |
net
|
90f62cf30a78721641e08737bda787552428061e
| 159,770,386,055,633,140,000,000,000,000,000,000,000 | 4 |
net: Use netlink_ns_capable to verify the permisions of netlink messages
It is possible by passing a netlink socket to a more privileged
executable and then to fool that executable into writing to the socket
data that happens to be valid netlink message to do something that
privileged executable did not intend to do.
To keep this from happening replace bare capable and ns_capable calls
with netlink_capable, netlink_net_calls and netlink_ns_capable calls.
Which act the same as the previous calls except they verify that the
opener of the socket had the desired permissions as well.
Reported-by: Andy Lutomirski <[email protected]>
Signed-off-by: "Eric W. Biederman" <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
static JSValue js_sys_get_ntp(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst *argv)
{
u32 sec, frac;
gf_net_get_ntp(&sec, &frac);
JSValue ret = JS_NewObject(ctx);
if (JS_IsException(ret)) return ret;
JS_SetPropertyStr(ctx, ret, "n", JS_NewInt64(ctx, sec));
JS_SetPropertyStr(ctx, ret, "d", JS_NewInt64(ctx, frac));
return ret;
}
| 0 |
[
"CWE-787"
] |
gpac
|
ea1eca00fd92fa17f0e25ac25652622924a9a6a0
| 12,787,842,778,257,015,000,000,000,000,000,000,000 | 10 |
fixed #2138
|
krb5_decode_krbsecretkey(krb5_context context, krb5_db_entry *entries,
struct berval **bvalues,
krb5_tl_data *userinfo_tl_data, krb5_kvno *mkvno)
{
char *user=NULL;
int i=0, j=0, noofkeys=0;
krb5_key_data *key_data=NULL, *tmp;
krb5_error_code st=0;
if ((st=krb5_unparse_name(context, entries->princ, &user)) != 0)
goto cleanup;
for (i=0; bvalues[i] != NULL; ++i) {
krb5_int16 n_kd;
krb5_key_data *kd;
krb5_data in;
if (bvalues[i]->bv_len == 0)
continue;
in.length = bvalues[i]->bv_len;
in.data = bvalues[i]->bv_val;
st = asn1_decode_sequence_of_keys (&in,
&kd,
&n_kd,
mkvno);
if (st != 0) {
const char *msg = error_message(st);
st = -1; /* Something more appropriate ? */
k5_setmsg(context, st,
_("unable to decode stored principal key data (%s)"),
msg);
goto cleanup;
}
noofkeys += n_kd;
tmp = key_data;
/* Allocate an extra key data to avoid allocating zero bytes. */
key_data = realloc(key_data, (noofkeys + 1) * sizeof (krb5_key_data));
if (key_data == NULL) {
key_data = tmp;
st = ENOMEM;
goto cleanup;
}
for (j = 0; j < n_kd; j++)
key_data[noofkeys - n_kd + j] = kd[j];
free (kd);
}
entries->n_key_data = noofkeys;
entries->key_data = key_data;
cleanup:
free (user);
return st;
}
| 0 |
[
"CWE-703"
] |
krb5
|
04038bf3633c4b909b5ded3072dc88c8c419bf16
| 71,437,499,450,383,995,000,000,000,000,000,000,000 | 56 |
Support keyless principals in LDAP [CVE-2014-5354]
Operations like "kadmin -q 'addprinc -nokey foo'" or
"kadmin -q 'purgekeys -all foo'" result in principal entries with
no keys present, so krb5_encode_krbsecretkey() would just return
NULL, which then got unconditionally dereferenced in
krb5_add_ber_mem_ldap_mod().
Apply some fixes to krb5_encode_krbsecretkey() to handle zero-key
principals better, correct the test for an allocation failure, and
slightly restructure the cleanup handler to be shorter and more
appropriate for the usage. Once it no longer short-circuits when
n_key_data is zero, it will produce an array of length two with both
entries NULL, which is treated as an empty list by the LDAP library,
the correct behavior for a keyless principal.
However, attributes with empty values are only handled by the LDAP
library for Modify operations, not Add operations (which only get
a sequence of Attribute, with no operation field). Therefore, only
add an empty krbprincipalkey to the modlist when we will be performing a
Modify, and not when we will be performing an Add, which is conditional
on the (misspelled) create_standalone_prinicipal boolean.
CVE-2014-5354:
In MIT krb5, when kadmind is configured to use LDAP for the KDC
database, an authenticated remote attacker can cause a NULL
dereference by inserting into the database a principal entry which
contains no long-term keys.
In order for the LDAP KDC backend to translate a principal entry
from the database abstraction layer into the form expected by the
LDAP schema, the principal's keys are encoded into a
NULL-terminated array of length-value entries to be stored in the
LDAP database. However, the subroutine which produced this array
did not correctly handle the case where no keys were present,
returning NULL instead of an empty array, and the array was
unconditionally dereferenced while adding to the list of LDAP
operations to perform.
Versions of MIT krb5 prior to 1.12 did not expose a way for
principal entries to have no long-term key material, and
therefore are not vulnerable.
CVSSv2 Vector: AV:N/AC:M/Au:S/C:N/I:N/A:P/E:H/RL:OF/RC:C
ticket: 8041 (new)
tags: pullup
target_version: 1.13.1
subject: kadmind with ldap backend crashes when putting keyless entries
|
bool operator<(const ChainLink& other) const {
if (port_origin < other.port_origin) {
return true;
} else if (port_origin > other.port_origin) {
return false;
} else {
return node->name() < other.node->name();
}
}
| 0 |
[
"CWE-476"
] |
tensorflow
|
e6340f0665d53716ef3197ada88936c2a5f7a2d3
| 107,037,709,313,387,420,000,000,000,000,000,000,000 | 9 |
Handle a special grappler case resulting in crash.
It might happen that a malformed input could be used to trick Grappler into trying to optimize a node with no inputs. This, in turn, would produce a null pointer dereference and a segfault.
PiperOrigin-RevId: 369242852
Change-Id: I2e5cbe7aec243d34a6d60220ac8ac9b16f136f6b
|
TPML_CCA_Unmarshal(TPML_CCA *target, BYTE **buffer, INT32 *size)
{
TPM_RC rc = TPM_RC_SUCCESS;
UINT32 i;
if (rc == TPM_RC_SUCCESS) {
rc = UINT32_Unmarshal(&target->count, buffer, size);
}
if (rc == TPM_RC_SUCCESS) {
if (target->count > MAX_CAP_CC) {
rc = TPM_RC_SIZE;
target->count = 0; // libtpms added
}
}
for (i = 0 ; (rc == TPM_RC_SUCCESS) && (i < target->count) ; i++) {
rc = TPMA_CC_Unmarshal(&target->commandAttributes[i], buffer, size);
}
return rc;
}
| 0 |
[
"CWE-787"
] |
libtpms
|
5cc98a62dc6f204dcf5b87c2ee83ac742a6a319b
| 89,411,030,707,020,950,000,000,000,000,000,000,000 | 19 |
tpm2: Restore original value if unmarshalled value was illegal
Restore the original value of the memory location where data from
a stream was unmarshalled and the unmarshalled value was found to
be illegal. The goal is to not keep illegal values in memory.
Signed-off-by: Stefan Berger <[email protected]>
|
ServerKeyExchange::~ServerKeyExchange()
{
ysDelete(server_key_);
}
| 0 |
[] |
mysql-server
|
b9768521bdeb1a8069c7b871f4536792b65fd79b
| 117,575,542,827,793,920,000,000,000,000,000,000,000 | 4 |
Updated yassl to yassl-2.3.8
(cherry picked from commit 7f9941eab55ed672bfcccd382dafbdbcfdc75aaa)
|
fr_window_is_batch_mode (FrWindow *window)
{
return window->priv->batch_mode;
}
| 0 |
[
"CWE-22"
] |
file-roller
|
b147281293a8307808475e102a14857055f81631
| 328,335,412,983,057,380,000,000,000,000,000,000,000 | 4 |
libarchive: sanitize filenames before extracting
|
static void gen_helper_fp_arith_STN_ST0(int op, int opreg)
{
TCGv_i32 tmp = tcg_const_i32(opreg);
switch (op) {
case 0:
gen_helper_fadd_STN_ST0(cpu_env, tmp);
break;
case 1:
gen_helper_fmul_STN_ST0(cpu_env, tmp);
break;
case 4:
gen_helper_fsubr_STN_ST0(cpu_env, tmp);
break;
case 5:
gen_helper_fsub_STN_ST0(cpu_env, tmp);
break;
case 6:
gen_helper_fdivr_STN_ST0(cpu_env, tmp);
break;
case 7:
gen_helper_fdiv_STN_ST0(cpu_env, tmp);
break;
}
}
| 0 |
[
"CWE-94"
] |
qemu
|
30663fd26c0307e414622c7a8607fbc04f92ec14
| 280,857,786,641,397,100,000,000,000,000,000,000,000 | 24 |
tcg/i386: Check the size of instruction being translated
This fixes the bug: 'user-to-root privesc inside VM via bad translation
caching' reported by Jann Horn here:
https://bugs.chromium.org/p/project-zero/issues/detail?id=1122
Reviewed-by: Richard Henderson <[email protected]>
CC: Peter Maydell <[email protected]>
CC: Paolo Bonzini <[email protected]>
Reported-by: Jann Horn <[email protected]>
Signed-off-by: Pranith Kumar <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
|
parse_noargs_dec_ttl(const struct ofpact_parse_params *pp)
{
struct ofpact_cnt_ids *ids;
uint16_t id = 0;
ofpact_put_DEC_TTL(pp->ofpacts);
ofpbuf_put(pp->ofpacts, &id, sizeof id);
ids = pp->ofpacts->header;
ids->n_controllers++;
ofpact_finish_DEC_TTL(pp->ofpacts, &ids);
}
| 0 |
[
"CWE-416"
] |
ovs
|
77cccc74deede443e8b9102299efc869a52b65b2
| 255,320,333,385,340,530,000,000,000,000,000,000,000 | 11 |
ofp-actions: Fix use-after-free while decoding RAW_ENCAP.
While decoding RAW_ENCAP action, decode_ed_prop() might re-allocate
ofpbuf if there is no enough space left. However, function
'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'
structure leading to write-after-free and incorrect decoding.
==3549105==ERROR: AddressSanitizer: heap-use-after-free on address
0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408
WRITE of size 2 at 0x60600000011a thread T0
#0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20
#1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16
#2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21
#3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13
#4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12
#5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17
#6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13
#7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16
#8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21
#9 0x65a28c in ofp_print lib/ofp-print.c:1288:28
#10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9
#11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17
#12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5
#13 0x5391ae in main utilities/ovs-ofctl.c:179:9
#14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)
#15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)
Fix that by getting a new pointer before using.
Credit to OSS-Fuzz.
Fuzzer regression test will fail only with AddressSanitizer enabled.
Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851
Fixes: f839892a206a ("OF support and translation of generic encap and decap")
Acked-by: William Tu <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
|
sec_reset_state(void)
{
g_server_rdp_version = 0;
g_sec_encrypt_use_count = 0;
g_sec_decrypt_use_count = 0;
g_licence_issued = 0;
g_licence_error_result = 0;
mcs_reset_state();
}
| 0 |
[
"CWE-787"
] |
rdesktop
|
766ebcf6f23ccfe8323ac10242ae6e127d4505d2
| 129,402,795,321,605,310,000,000,000,000,000,000,000 | 9 |
Malicious RDP server security fixes
This commit includes fixes for a set of 21 vulnerabilities in
rdesktop when a malicious RDP server is used.
All vulnerabilities was identified and reported by Eyal Itkin.
* Add rdp_protocol_error function that is used in several fixes
* Refactor of process_bitmap_updates
* Fix possible integer overflow in s_check_rem() on 32bit arch
* Fix memory corruption in process_bitmap_data - CVE-2018-8794
* Fix remote code execution in process_bitmap_data - CVE-2018-8795
* Fix remote code execution in process_plane - CVE-2018-8797
* Fix Denial of Service in mcs_recv_connect_response - CVE-2018-20175
* Fix Denial of Service in mcs_parse_domain_params - CVE-2018-20175
* Fix Denial of Service in sec_parse_crypt_info - CVE-2018-20176
* Fix Denial of Service in sec_recv - CVE-2018-20176
* Fix minor information leak in rdpdr_process - CVE-2018-8791
* Fix Denial of Service in cssp_read_tsrequest - CVE-2018-8792
* Fix remote code execution in cssp_read_tsrequest - CVE-2018-8793
* Fix Denial of Service in process_bitmap_data - CVE-2018-8796
* Fix minor information leak in rdpsnd_process_ping - CVE-2018-8798
* Fix Denial of Service in process_secondary_order - CVE-2018-8799
* Fix remote code execution in in ui_clip_handle_data - CVE-2018-8800
* Fix major information leak in ui_clip_handle_data - CVE-2018-20174
* Fix memory corruption in rdp_in_unistr - CVE-2018-20177
* Fix Denial of Service in process_demand_active - CVE-2018-20178
* Fix remote code execution in lspci_process - CVE-2018-20179
* Fix remote code execution in rdpsnddbg_process - CVE-2018-20180
* Fix remote code execution in seamless_process - CVE-2018-20181
* Fix remote code execution in seamless_process_line - CVE-2018-20182
|
static int l2tp_ip6_getname(struct socket *sock, struct sockaddr *uaddr,
int *uaddr_len, int peer)
{
struct sockaddr_l2tpip6 *lsa = (struct sockaddr_l2tpip6 *)uaddr;
struct sock *sk = sock->sk;
struct ipv6_pinfo *np = inet6_sk(sk);
struct l2tp_ip6_sock *lsk = l2tp_ip6_sk(sk);
lsa->l2tp_family = AF_INET6;
lsa->l2tp_flowinfo = 0;
lsa->l2tp_scope_id = 0;
if (peer) {
if (!lsk->peer_conn_id)
return -ENOTCONN;
lsa->l2tp_conn_id = lsk->peer_conn_id;
lsa->l2tp_addr = np->daddr;
if (np->sndflow)
lsa->l2tp_flowinfo = np->flow_label;
} else {
if (ipv6_addr_any(&np->rcv_saddr))
lsa->l2tp_addr = np->saddr;
else
lsa->l2tp_addr = np->rcv_saddr;
lsa->l2tp_conn_id = lsk->conn_id;
}
if (ipv6_addr_type(&lsa->l2tp_addr) & IPV6_ADDR_LINKLOCAL)
lsa->l2tp_scope_id = sk->sk_bound_dev_if;
*uaddr_len = sizeof(*lsa);
return 0;
}
| 1 |
[
"CWE-200"
] |
linux
|
04d4fbca1017c11381e7d82acea21dd741e748bc
| 338,954,264,610,063,400,000,000,000,000,000,000,000 | 31 |
l2tp: fix info leak via getsockname()
The L2TP code for IPv6 fails to initialize the l2tp_unused member of
struct sockaddr_l2tpip6 and that for leaks two bytes kernel stack via
the getsockname() syscall. Initialize l2tp_unused with 0 to avoid the
info leak.
Signed-off-by: Mathias Krause <[email protected]>
Cc: James Chapman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
{
zval *id;
xmlDoc *docp = NULL, *newdoc;
dom_object *intern;
dom_doc_propsptr doc_prop;
char *source;
int source_len, refcount, ret;
long options = 0;
htmlParserCtxtPtr ctxt;
id = getThis();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &source, &source_len, &options) == FAILURE) {
return;
}
if (!source_len) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty string supplied as input");
RETURN_FALSE;
}
if (mode == DOM_LOAD_FILE) {
ctxt = htmlCreateFileParserCtxt(source, NULL);
} else {
source_len = xmlStrlen(source);
ctxt = htmlCreateMemoryParserCtxt(source, source_len);
}
if (!ctxt) {
RETURN_FALSE;
}
if (options) {
htmlCtxtUseOptions(ctxt, options);
}
ctxt->vctxt.error = php_libxml_ctx_error;
ctxt->vctxt.warning = php_libxml_ctx_warning;
if (ctxt->sax != NULL) {
ctxt->sax->error = php_libxml_ctx_error;
ctxt->sax->warning = php_libxml_ctx_warning;
}
htmlParseDocument(ctxt);
newdoc = ctxt->myDoc;
htmlFreeParserCtxt(ctxt);
if (!newdoc)
RETURN_FALSE;
if (id != NULL && instanceof_function(Z_OBJCE_P(id), dom_document_class_entry TSRMLS_CC)) {
intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
if (intern != NULL) {
docp = (xmlDocPtr) dom_object_get_node(intern);
doc_prop = NULL;
if (docp != NULL) {
php_libxml_decrement_node_ptr((php_libxml_node_object *) intern TSRMLS_CC);
doc_prop = intern->document->doc_props;
intern->document->doc_props = NULL;
refcount = php_libxml_decrement_doc_ref((php_libxml_node_object *)intern TSRMLS_CC);
if (refcount != 0) {
docp->_private = NULL;
}
}
intern->document = NULL;
if (php_libxml_increment_doc_ref((php_libxml_node_object *)intern, newdoc TSRMLS_CC) == -1) {
RETURN_FALSE;
}
intern->document->doc_props = doc_prop;
}
php_libxml_increment_node_ptr((php_libxml_node_object *)intern, (xmlNodePtr)newdoc, (void *)intern TSRMLS_CC);
RETURN_TRUE;
} else {
DOM_RET_OBJ((xmlNodePtr) newdoc, &ret, NULL);
}
}
| 1 |
[
"CWE-20"
] |
php-src
|
f7d7befae8bcc2db0093f8adaa9f72eeb7ad891e
| 99,973,663,694,588,360,000,000,000,000,000,000,000 | 78 |
Fix #69719 - more checks for nulls in paths
|
static void diffcore_apply_filter(const char *filter)
{
int i;
struct diff_queue_struct *q = &diff_queued_diff;
struct diff_queue_struct outq;
outq.queue = NULL;
outq.nr = outq.alloc = 0;
if (!filter)
return;
if (strchr(filter, DIFF_STATUS_FILTER_AON)) {
int found;
for (i = found = 0; !found && i < q->nr; i++) {
struct diff_filepair *p = q->queue[i];
if (((p->status == DIFF_STATUS_MODIFIED) &&
((p->score &&
strchr(filter, DIFF_STATUS_FILTER_BROKEN)) ||
(!p->score &&
strchr(filter, DIFF_STATUS_MODIFIED)))) ||
((p->status != DIFF_STATUS_MODIFIED) &&
strchr(filter, p->status)))
found++;
}
if (found)
return;
/* otherwise we will clear the whole queue
* by copying the empty outq at the end of this
* function, but first clear the current entries
* in the queue.
*/
for (i = 0; i < q->nr; i++)
diff_free_filepair(q->queue[i]);
}
else {
/* Only the matching ones */
for (i = 0; i < q->nr; i++) {
struct diff_filepair *p = q->queue[i];
if (((p->status == DIFF_STATUS_MODIFIED) &&
((p->score &&
strchr(filter, DIFF_STATUS_FILTER_BROKEN)) ||
(!p->score &&
strchr(filter, DIFF_STATUS_MODIFIED)))) ||
((p->status != DIFF_STATUS_MODIFIED) &&
strchr(filter, p->status)))
diff_q(&outq, p);
else
diff_free_filepair(p);
}
}
free(q->queue);
*q = outq;
}
| 0 |
[
"CWE-119"
] |
git
|
fd55a19eb1d49ae54008d932a65f79cd6fda45c9
| 215,181,579,421,023,100,000,000,000,000,000,000,000 | 55 |
Fix buffer overflow in git diff
If PATH_MAX on your system is smaller than a path stored, it may cause
buffer overflow and stack corruption in diff_addremove() and diff_change()
functions when running git-diff
Signed-off-by: Dmitry Potapov <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
|
crypto_time()
{
l_fp tstamp; /* NTP time */
L_CLR(&tstamp);
if (sys_leap != LEAP_NOTINSYNC)
get_systime(&tstamp);
return (tstamp.l_ui);
}
| 0 |
[
"CWE-20"
] |
ntp
|
c4cd4aaf418f57f7225708a93bf48afb2bc9c1da
| 289,043,895,028,774,270,000,000,000,000,000,000,000 | 9 |
CVE-2014-9297
|
static int atusb_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{
struct usb_device *usb_dev = interface_to_usbdev(interface);
struct ieee802154_hw *hw;
struct atusb *atusb = NULL;
int ret = -ENOMEM;
hw = ieee802154_alloc_hw(sizeof(struct atusb), &atusb_ops);
if (!hw)
return -ENOMEM;
atusb = hw->priv;
atusb->hw = hw;
atusb->usb_dev = usb_get_dev(usb_dev);
usb_set_intfdata(interface, atusb);
atusb->shutdown = 0;
atusb->err = 0;
INIT_DELAYED_WORK(&atusb->work, atusb_work_urbs);
init_usb_anchor(&atusb->idle_urbs);
init_usb_anchor(&atusb->rx_urbs);
if (atusb_alloc_urbs(atusb, ATUSB_NUM_RX_URBS))
goto fail;
atusb->tx_dr.bRequestType = ATUSB_REQ_TO_DEV;
atusb->tx_dr.bRequest = ATUSB_TX;
atusb->tx_dr.wValue = cpu_to_le16(0);
atusb->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!atusb->tx_urb)
goto fail;
hw->parent = &usb_dev->dev;
atusb_command(atusb, ATUSB_RF_RESET, 0);
atusb_get_and_conf_chip(atusb);
atusb_get_and_show_revision(atusb);
atusb_get_and_show_build(atusb);
atusb_set_extended_addr(atusb);
if ((atusb->fw_ver_maj == 0 && atusb->fw_ver_min >= 3) || atusb->fw_ver_maj > 0)
hw->flags |= IEEE802154_HW_FRAME_RETRIES;
ret = atusb_get_and_clear_error(atusb);
if (ret) {
dev_err(&atusb->usb_dev->dev,
"%s: initialization failed, error = %d\n",
__func__, ret);
goto fail;
}
ret = ieee802154_register_hw(hw);
if (ret)
goto fail;
/* If we just powered on, we're now in P_ON and need to enter TRX_OFF
* explicitly. Any resets after that will send us straight to TRX_OFF,
* making the command below redundant.
*/
atusb_write_reg(atusb, RG_TRX_STATE, STATE_FORCE_TRX_OFF);
msleep(1); /* reset => TRX_OFF, tTR13 = 37 us */
#if 0
/* Calculating the maximum time available to empty the frame buffer
* on reception:
*
* According to [1], the inter-frame gap is
* R * 20 * 16 us + 128 us
* where R is a random number from 0 to 7. Furthermore, we have 20 bit
* times (80 us at 250 kbps) of SHR of the next frame before the
* transceiver begins storing data in the frame buffer.
*
* This yields a minimum time of 208 us between the last data of a
* frame and the first data of the next frame. This time is further
* reduced by interrupt latency in the atusb firmware.
*
* atusb currently needs about 500 us to retrieve a maximum-sized
* frame. We therefore have to allow reception of a new frame to begin
* while we retrieve the previous frame.
*
* [1] "JN-AN-1035 Calculating data rates in an IEEE 802.15.4-based
* network", Jennic 2006.
* http://www.jennic.com/download_file.php?supportFile=JN-AN-1035%20Calculating%20802-15-4%20Data%20Rates-1v0.pdf
*/
atusb_write_subreg(atusb, SR_RX_SAFE_MODE, 1);
#endif
atusb_write_reg(atusb, RG_IRQ_MASK, 0xff);
ret = atusb_get_and_clear_error(atusb);
if (!ret)
return 0;
dev_err(&atusb->usb_dev->dev,
"%s: setup failed, error = %d\n",
__func__, ret);
ieee802154_unregister_hw(hw);
fail:
atusb_free_urbs(atusb);
usb_kill_urb(atusb->tx_urb);
usb_free_urb(atusb->tx_urb);
usb_put_dev(usb_dev);
ieee802154_free_hw(hw);
return ret;
}
| 0 |
[
"CWE-416"
] |
linux
|
7fd25e6fc035f4b04b75bca6d7e8daa069603a76
| 175,451,486,861,548,550,000,000,000,000,000,000,000 | 108 |
ieee802154: atusb: fix use-after-free at disconnect
The disconnect callback was accessing the hardware-descriptor private
data after having having freed it.
Fixes: 7490b008d123 ("ieee802154: add support for atusb transceiver")
Cc: stable <[email protected]> # 4.2
Cc: Alexander Aring <[email protected]>
Reported-by: [email protected]
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Stefan Schmidt <[email protected]>
|
respip_data_answer(const struct resp_addr* raddr, enum respip_action action,
uint16_t qtype, const struct reply_info* rep,
size_t rrset_id, struct reply_info** new_repp, int tag,
struct config_strlist** tag_datas, size_t tag_datas_size,
char* const* tagname, int num_tags,
struct ub_packed_rrset_key** redirect_rrsetp, struct regional* region)
{
struct ub_packed_rrset_key* rp = raddr->data;
struct reply_info* new_rep;
*redirect_rrsetp = NULL;
if(action == respip_redirect && tag != -1 &&
(size_t)tag<tag_datas_size && tag_datas[tag]) {
struct query_info dataqinfo;
struct ub_packed_rrset_key r;
/* Extract parameters of the original answer rrset that can be
* rewritten below, in the form of query_info. Note that these
* can be different from the info of the original query if the
* rrset is a CNAME target.*/
memset(&dataqinfo, 0, sizeof(dataqinfo));
dataqinfo.qname = rep->rrsets[rrset_id]->rk.dname;
dataqinfo.qname_len = rep->rrsets[rrset_id]->rk.dname_len;
dataqinfo.qtype = ntohs(rep->rrsets[rrset_id]->rk.type);
dataqinfo.qclass = ntohs(rep->rrsets[rrset_id]->rk.rrset_class);
memset(&r, 0, sizeof(r));
if(local_data_find_tag_datas(&dataqinfo, tag_datas[tag], &r,
region)) {
verbose(VERB_ALGO,
"response-ip redirect with tag data [%d] %s",
tag, (tag<num_tags?tagname[tag]:"null"));
/* use copy_rrset() to 'normalize' memory layout */
rp = copy_rrset(&r, region);
if(!rp)
return -1;
}
}
if(!rp)
return 0;
/* If we are using response-ip-data, we need to make a copy of rrset
* to replace the rrset's dname. Note that, unlike local data, we
* rename the dname for other actions than redirect. This is because
* response-ip-data isn't associated to any specific name. */
if(rp == raddr->data) {
rp = copy_rrset(rp, region);
if(!rp)
return -1;
rp->rk.dname = rep->rrsets[rrset_id]->rk.dname;
rp->rk.dname_len = rep->rrsets[rrset_id]->rk.dname_len;
}
/* Build a new reply with redirect rrset. We keep any preceding CNAMEs
* and replace the address rrset that triggers the action. If it's
* type ANY query, however, no other answer records should be kept
* (note that it can't be a CNAME chain in this case due to
* sanitizing). */
if(qtype == LDNS_RR_TYPE_ANY)
rrset_id = 0;
new_rep = make_new_reply_info(rep, region, rrset_id + 1, rrset_id);
if(!new_rep)
return -1;
rp->rk.flags |= PACKED_RRSET_FIXEDTTL; /* avoid adjusting TTL */
new_rep->rrsets[rrset_id] = rp;
*redirect_rrsetp = rp;
*new_repp = new_rep;
return 1;
}
| 0 |
[
"CWE-190"
] |
unbound
|
02080f6b180232f43b77f403d0c038e9360a460f
| 121,578,486,203,141,360,000,000,000,000,000,000,000 | 70 |
- Fix Integer Overflows in Size Calculations,
reported by X41 D-Sec.
|
QPDFObjectHandle::getUTF8Value()
{
assertString();
return dynamic_cast<QPDF_String*>(obj.getPointer())->getUTF8Val();
}
| 0 |
[
"CWE-835"
] |
qpdf
|
afe0242b263a9e1a8d51dd81e42ab6de2e5127eb
| 105,653,446,074,658,140,000,000,000,000,000,000,000 | 5 |
Handle object ID 0 (fixes #99)
This is CVE-2017-9208.
The QPDF library uses object ID 0 internally as a sentinel to
represent a direct object, but prior to this fix, was not blocking
handling of 0 0 obj or 0 0 R as a special case. Creating an object in
the file with 0 0 obj could cause various infinite loops. The PDF spec
doesn't allow for object 0. Having qpdf handle object 0 might be a
better fix, but changing all the places in the code that assumes objid
== 0 means direct would be risky.
|
static int selinux_sb_statfs(struct dentry *dentry)
{
const struct cred *cred = current_cred();
struct common_audit_data ad;
COMMON_AUDIT_DATA_INIT(&ad, FS);
ad.u.fs.path.dentry = dentry->d_sb->s_root;
return superblock_has_perm(cred, dentry->d_sb, FILESYSTEM__GETATTR, &ad);
}
| 0 |
[] |
linux-2.6
|
ee18d64c1f632043a02e6f5ba5e045bb26a5465f
| 249,845,519,287,043,000,000,000,000,000,000,000,000 | 9 |
KEYS: Add a keyctl to install a process's session keyring on its parent [try #6]
Add a keyctl to install a process's session keyring onto its parent. This
replaces the parent's session keyring. Because the COW credential code does
not permit one process to change another process's credentials directly, the
change is deferred until userspace next starts executing again. Normally this
will be after a wait*() syscall.
To support this, three new security hooks have been provided:
cred_alloc_blank() to allocate unset security creds, cred_transfer() to fill in
the blank security creds and key_session_to_parent() - which asks the LSM if
the process may replace its parent's session keyring.
The replacement may only happen if the process has the same ownership details
as its parent, and the process has LINK permission on the session keyring, and
the session keyring is owned by the process, and the LSM permits it.
Note that this requires alteration to each architecture's notify_resume path.
This has been done for all arches barring blackfin, m68k* and xtensa, all of
which need assembly alteration to support TIF_NOTIFY_RESUME. This allows the
replacement to be performed at the point the parent process resumes userspace
execution.
This allows the userspace AFS pioctl emulation to fully emulate newpag() and
the VIOCSETTOK and VIOCSETTOK2 pioctls, all of which require the ability to
alter the parent process's PAG membership. However, since kAFS doesn't use
PAGs per se, but rather dumps the keys into the session keyring, the session
keyring of the parent must be replaced if, for example, VIOCSETTOK is passed
the newpag flag.
This can be tested with the following program:
#include <stdio.h>
#include <stdlib.h>
#include <keyutils.h>
#define KEYCTL_SESSION_TO_PARENT 18
#define OSERROR(X, S) do { if ((long)(X) == -1) { perror(S); exit(1); } } while(0)
int main(int argc, char **argv)
{
key_serial_t keyring, key;
long ret;
keyring = keyctl_join_session_keyring(argv[1]);
OSERROR(keyring, "keyctl_join_session_keyring");
key = add_key("user", "a", "b", 1, keyring);
OSERROR(key, "add_key");
ret = keyctl(KEYCTL_SESSION_TO_PARENT);
OSERROR(ret, "KEYCTL_SESSION_TO_PARENT");
return 0;
}
Compiled and linked with -lkeyutils, you should see something like:
[dhowells@andromeda ~]$ keyctl show
Session Keyring
-3 --alswrv 4043 4043 keyring: _ses
355907932 --alswrv 4043 -1 \_ keyring: _uid.4043
[dhowells@andromeda ~]$ /tmp/newpag
[dhowells@andromeda ~]$ keyctl show
Session Keyring
-3 --alswrv 4043 4043 keyring: _ses
1055658746 --alswrv 4043 4043 \_ user: a
[dhowells@andromeda ~]$ /tmp/newpag hello
[dhowells@andromeda ~]$ keyctl show
Session Keyring
-3 --alswrv 4043 4043 keyring: hello
340417692 --alswrv 4043 4043 \_ user: a
Where the test program creates a new session keyring, sticks a user key named
'a' into it and then installs it on its parent.
Signed-off-by: David Howells <[email protected]>
Signed-off-by: James Morris <[email protected]>
|
void SSL_free(SSL *s)
{
int i;
if(s == NULL)
return;
i=CRYPTO_add(&s->references,-1,CRYPTO_LOCK_SSL);
#ifdef REF_PRINT
REF_PRINT("SSL",s);
#endif
if (i > 0) return;
#ifdef REF_CHECK
if (i < 0)
{
fprintf(stderr,"SSL_free, bad reference count\n");
abort(); /* ok */
}
#endif
if (s->param)
X509_VERIFY_PARAM_free(s->param);
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data);
if (s->bbio != NULL)
{
/* If the buffering BIO is in place, pop it off */
if (s->bbio == s->wbio)
{
s->wbio=BIO_pop(s->wbio);
}
BIO_free(s->bbio);
s->bbio=NULL;
}
if (s->rbio != NULL)
BIO_free_all(s->rbio);
if ((s->wbio != NULL) && (s->wbio != s->rbio))
BIO_free_all(s->wbio);
if (s->init_buf != NULL) BUF_MEM_free(s->init_buf);
/* add extra stuff */
if (s->cipher_list != NULL) sk_SSL_CIPHER_free(s->cipher_list);
if (s->cipher_list_by_id != NULL) sk_SSL_CIPHER_free(s->cipher_list_by_id);
/* Make the next call work :-) */
if (s->session != NULL)
{
ssl_clear_bad_session(s);
SSL_SESSION_free(s->session);
}
ssl_clear_cipher_ctx(s);
if (s->cert != NULL) ssl_cert_free(s->cert);
/* Free up if allocated */
#ifndef OPENSSL_NO_TLSEXT
if (s->tlsext_hostname)
OPENSSL_free(s->tlsext_hostname);
if (s->initial_ctx) SSL_CTX_free(s->initial_ctx);
if (s->tlsext_ocsp_exts)
sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts,
X509_EXTENSION_free);
if (s->tlsext_ocsp_ids)
sk_OCSP_RESPID_pop_free(s->tlsext_ocsp_ids, OCSP_RESPID_free);
if (s->tlsext_ocsp_resp)
OPENSSL_free(s->tlsext_ocsp_resp);
#endif
if (s->client_CA != NULL)
sk_X509_NAME_pop_free(s->client_CA,X509_NAME_free);
if (s->method != NULL) s->method->ssl_free(s);
if (s->ctx) SSL_CTX_free(s->ctx);
#ifndef OPENSSL_NO_KRB5
if (s->kssl_ctx != NULL)
kssl_ctx_free(s->kssl_ctx);
#endif /* OPENSSL_NO_KRB5 */
OPENSSL_free(s);
}
| 0 |
[
"CWE-310"
] |
openssl
|
c6a876473cbff0fd323c8abcaace98ee2d21863d
| 334,944,954,761,796,530,000,000,000,000,000,000,000 | 84 |
Support TLS_FALLBACK_SCSV.
Reviewed-by: Stephen Henson <[email protected]>
|
static int ndpi_search_tls_udp(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow) {
struct ndpi_packet_struct *packet = &flow->packet;
// u_int8_t handshake_type;
u_int32_t handshake_len;
u_int16_t p_len;
const u_int8_t *p;
#ifdef DEBUG_TLS
printf("[TLS] %s()\n", __FUNCTION__);
#endif
/* Consider only specific SSL packets (handshake) */
if((packet->payload_packet_len < 17)
|| (packet->payload[0] != 0x16)
|| (packet->payload[1] != 0xfe) /* We ignore old DTLS versions */
|| ((packet->payload[2] != 0xff) && (packet->payload[2] != 0xfd))
|| ((ntohs(*((u_int16_t*)&packet->payload[11]))+13) != packet->payload_packet_len)
) {
no_dtls:
#ifdef DEBUG_TLS
printf("[TLS] No DTLS found\n");
#endif
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
return(0); /* Giveup */
}
// handshake_type = packet->payload[13];
handshake_len = (packet->payload[14] << 16) + (packet->payload[15] << 8) + packet->payload[16];
if((handshake_len+25) != packet->payload_packet_len)
goto no_dtls;
/* Overwriting packet payload */
p = packet->payload, p_len = packet->payload_packet_len; /* Backup */
packet->payload = &packet->payload[13], packet->payload_packet_len -= 13;
processTLSBlock(ndpi_struct, flow);
packet->payload = p, packet->payload_packet_len = p_len; /* Restore */
ndpi_int_tls_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_TLS);
return(1); /* Keep working */
}
| 0 |
[
"CWE-190",
"CWE-787"
] |
nDPI
|
23594f036536468072198a57c59b6e9d63caf6ce
| 305,859,140,123,398,500,000,000,000,000,000,000,000 | 47 |
Fixed stack overflow caused by missing length check
Signed-off-by: Toni Uhlig <[email protected]>
|
ofputil_encode_flow_removed(const struct ofputil_flow_removed *fr,
enum ofputil_protocol protocol)
{
struct ofpbuf *msg;
enum ofp_flow_removed_reason reason = fr->reason;
if (reason == OFPRR_METER_DELETE && !(protocol & OFPUTIL_P_OF14_UP)) {
reason = OFPRR_DELETE;
}
switch (protocol) {
case OFPUTIL_P_OF11_STD:
case OFPUTIL_P_OF12_OXM:
case OFPUTIL_P_OF13_OXM:
case OFPUTIL_P_OF14_OXM:
case OFPUTIL_P_OF15_OXM:
case OFPUTIL_P_OF16_OXM: {
struct ofp12_flow_removed *ofr;
msg = ofpraw_alloc_xid(OFPRAW_OFPT11_FLOW_REMOVED,
ofputil_protocol_to_ofp_version(protocol),
htonl(0),
ofputil_match_typical_len(protocol));
ofr = ofpbuf_put_zeros(msg, sizeof *ofr);
ofr->cookie = fr->cookie;
ofr->priority = htons(fr->priority);
ofr->reason = reason;
ofr->table_id = fr->table_id;
ofr->duration_sec = htonl(fr->duration_sec);
ofr->duration_nsec = htonl(fr->duration_nsec);
ofr->idle_timeout = htons(fr->idle_timeout);
ofr->hard_timeout = htons(fr->hard_timeout);
ofr->packet_count = htonll(fr->packet_count);
ofr->byte_count = htonll(fr->byte_count);
ofputil_put_ofp11_match(msg, &fr->match, protocol);
break;
}
case OFPUTIL_P_OF10_STD:
case OFPUTIL_P_OF10_STD_TID: {
struct ofp10_flow_removed *ofr;
msg = ofpraw_alloc_xid(OFPRAW_OFPT10_FLOW_REMOVED, OFP10_VERSION,
htonl(0), 0);
ofr = ofpbuf_put_zeros(msg, sizeof *ofr);
ofputil_match_to_ofp10_match(&fr->match, &ofr->match);
ofr->cookie = fr->cookie;
ofr->priority = htons(fr->priority);
ofr->reason = reason;
ofr->duration_sec = htonl(fr->duration_sec);
ofr->duration_nsec = htonl(fr->duration_nsec);
ofr->idle_timeout = htons(fr->idle_timeout);
ofr->packet_count = htonll(unknown_to_zero(fr->packet_count));
ofr->byte_count = htonll(unknown_to_zero(fr->byte_count));
break;
}
case OFPUTIL_P_OF10_NXM:
case OFPUTIL_P_OF10_NXM_TID: {
struct nx_flow_removed *nfr;
int match_len;
msg = ofpraw_alloc_xid(OFPRAW_NXT_FLOW_REMOVED, OFP10_VERSION,
htonl(0), NXM_TYPICAL_LEN);
ofpbuf_put_zeros(msg, sizeof *nfr);
match_len = nx_put_match(msg, &fr->match, 0, 0);
nfr = msg->msg;
nfr->cookie = fr->cookie;
nfr->priority = htons(fr->priority);
nfr->reason = reason;
nfr->table_id = fr->table_id + 1;
nfr->duration_sec = htonl(fr->duration_sec);
nfr->duration_nsec = htonl(fr->duration_nsec);
nfr->idle_timeout = htons(fr->idle_timeout);
nfr->match_len = htons(match_len);
nfr->packet_count = htonll(fr->packet_count);
nfr->byte_count = htonll(fr->byte_count);
break;
}
default:
OVS_NOT_REACHED();
}
return msg;
}
| 0 |
[
"CWE-772"
] |
ovs
|
77ad4225d125030420d897c873e4734ac708c66b
| 98,298,714,299,983,950,000,000,000,000,000,000,000 | 87 |
ofp-util: Fix memory leaks on error cases in ofputil_decode_group_mod().
Found by libFuzzer.
Reported-by: Bhargava Shastry <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Justin Pettit <[email protected]>
|
static enum test_return test_binary_add(void) {
return test_binary_add_impl("test_binary_add", PROTOCOL_BINARY_CMD_ADD);
}
| 0 |
[
"CWE-20"
] |
memcached
|
75cc83685e103bc8ba380a57468c8f04413033f9
| 41,828,033,313,576,064,000,000,000,000,000,000,000 | 3 |
Issue 102: Piping null to the server will crash it
|
void js_stacktrace(js_State *J)
{
int n;
printf("stack trace:\n");
for (n = J->tracetop; n >= 0; --n) {
const char *name = J->trace[n].name;
const char *file = J->trace[n].file;
int line = J->trace[n].line;
if (line > 0) {
if (name[0])
printf("\tat %s (%s:%d)\n", name, file, line);
else
printf("\tat %s:%d\n", file, line);
} else
printf("\tat %s (%s)\n", name, file);
}
}
| 0 |
[
"CWE-476"
] |
mujs
|
77ab465f1c394bb77f00966cd950650f3f53cb24
| 106,043,019,057,721,200,000,000,000,000,000,000,000 | 17 |
Fix 697401: Error when dropping extra arguments to lightweight functions.
|
static uint64_t sm501_i2c_read(void *opaque, hwaddr addr, unsigned size)
{
SM501State *s = (SM501State *)opaque;
uint8_t ret = 0;
switch (addr) {
case SM501_I2C_BYTE_COUNT:
ret = s->i2c_byte_count;
break;
case SM501_I2C_STATUS:
ret = s->i2c_status;
break;
case SM501_I2C_SLAVE_ADDRESS:
ret = s->i2c_addr;
break;
case SM501_I2C_DATA ... SM501_I2C_DATA + 15:
ret = s->i2c_data[addr - SM501_I2C_DATA];
break;
default:
qemu_log_mask(LOG_UNIMP, "sm501 i2c : not implemented register read."
" addr=0x%" HWADDR_PRIx "\n", addr);
}
SM501_DPRINTF("sm501 i2c regs : read addr=%" HWADDR_PRIx " val=%x\n",
addr, ret);
return ret;
}
| 0 |
[
"CWE-190"
] |
qemu
|
b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4
| 172,224,119,457,966,450,000,000,000,000,000,000,000 | 27 |
sm501: Replace hand written implementation with pixman where possible
Besides being faster this should also prevent malicious guests to
abuse 2D engine to overwrite data or cause a crash.
Signed-off-by: BALATON Zoltan <[email protected]>
Message-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu
Signed-off-by: Gerd Hoffmann <[email protected]>
|
packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
{
struct sock *sk = sock->sk;
struct packet_sock *po = pkt_sk(sk);
int ret;
if (level != SOL_PACKET)
return -ENOPROTOOPT;
switch (optname) {
case PACKET_ADD_MEMBERSHIP:
case PACKET_DROP_MEMBERSHIP:
{
struct packet_mreq_max mreq;
int len = optlen;
memset(&mreq, 0, sizeof(mreq));
if (len < sizeof(struct packet_mreq))
return -EINVAL;
if (len > sizeof(mreq))
len = sizeof(mreq);
if (copy_from_user(&mreq, optval, len))
return -EFAULT;
if (len < (mreq.mr_alen + offsetof(struct packet_mreq, mr_address)))
return -EINVAL;
if (optname == PACKET_ADD_MEMBERSHIP)
ret = packet_mc_add(sk, &mreq);
else
ret = packet_mc_drop(sk, &mreq);
return ret;
}
case PACKET_RX_RING:
case PACKET_TX_RING:
{
union tpacket_req_u req_u;
int len;
switch (po->tp_version) {
case TPACKET_V1:
case TPACKET_V2:
len = sizeof(req_u.req);
break;
case TPACKET_V3:
default:
len = sizeof(req_u.req3);
break;
}
if (optlen < len)
return -EINVAL;
if (pkt_sk(sk)->has_vnet_hdr)
return -EINVAL;
if (copy_from_user(&req_u.req, optval, len))
return -EFAULT;
return packet_set_ring(sk, &req_u, 0,
optname == PACKET_TX_RING);
}
case PACKET_COPY_THRESH:
{
int val;
if (optlen != sizeof(val))
return -EINVAL;
if (copy_from_user(&val, optval, sizeof(val)))
return -EFAULT;
pkt_sk(sk)->copy_thresh = val;
return 0;
}
case PACKET_VERSION:
{
int val;
if (optlen != sizeof(val))
return -EINVAL;
if (po->rx_ring.pg_vec || po->tx_ring.pg_vec)
return -EBUSY;
if (copy_from_user(&val, optval, sizeof(val)))
return -EFAULT;
switch (val) {
case TPACKET_V1:
case TPACKET_V2:
case TPACKET_V3:
po->tp_version = val;
return 0;
default:
return -EINVAL;
}
}
case PACKET_RESERVE:
{
unsigned int val;
if (optlen != sizeof(val))
return -EINVAL;
if (po->rx_ring.pg_vec || po->tx_ring.pg_vec)
return -EBUSY;
if (copy_from_user(&val, optval, sizeof(val)))
return -EFAULT;
po->tp_reserve = val;
return 0;
}
case PACKET_LOSS:
{
unsigned int val;
if (optlen != sizeof(val))
return -EINVAL;
if (po->rx_ring.pg_vec || po->tx_ring.pg_vec)
return -EBUSY;
if (copy_from_user(&val, optval, sizeof(val)))
return -EFAULT;
po->tp_loss = !!val;
return 0;
}
case PACKET_AUXDATA:
{
int val;
if (optlen < sizeof(val))
return -EINVAL;
if (copy_from_user(&val, optval, sizeof(val)))
return -EFAULT;
po->auxdata = !!val;
return 0;
}
case PACKET_ORIGDEV:
{
int val;
if (optlen < sizeof(val))
return -EINVAL;
if (copy_from_user(&val, optval, sizeof(val)))
return -EFAULT;
po->origdev = !!val;
return 0;
}
case PACKET_VNET_HDR:
{
int val;
if (sock->type != SOCK_RAW)
return -EINVAL;
if (po->rx_ring.pg_vec || po->tx_ring.pg_vec)
return -EBUSY;
if (optlen < sizeof(val))
return -EINVAL;
if (copy_from_user(&val, optval, sizeof(val)))
return -EFAULT;
po->has_vnet_hdr = !!val;
return 0;
}
case PACKET_TIMESTAMP:
{
int val;
if (optlen != sizeof(val))
return -EINVAL;
if (copy_from_user(&val, optval, sizeof(val)))
return -EFAULT;
po->tp_tstamp = val;
return 0;
}
case PACKET_FANOUT:
{
int val;
if (optlen != sizeof(val))
return -EINVAL;
if (copy_from_user(&val, optval, sizeof(val)))
return -EFAULT;
return fanout_add(sk, val & 0xffff, val >> 16);
}
case PACKET_TX_HAS_OFF:
{
unsigned int val;
if (optlen != sizeof(val))
return -EINVAL;
if (po->rx_ring.pg_vec || po->tx_ring.pg_vec)
return -EBUSY;
if (copy_from_user(&val, optval, sizeof(val)))
return -EFAULT;
po->tp_tx_has_off = !!val;
return 0;
}
default:
return -ENOPROTOOPT;
}
}
| 0 |
[
"CWE-20",
"CWE-269"
] |
linux
|
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
| 167,300,609,635,975,530,000,000,000,000,000,000,000 | 194 |
net: rework recvmsg handler msg_name and msg_namelen logic
This patch now always passes msg->msg_namelen as 0. recvmsg handlers must
set msg_namelen to the proper size <= sizeof(struct sockaddr_storage)
to return msg_name to the user.
This prevents numerous uninitialized memory leaks we had in the
recvmsg handlers and makes it harder for new code to accidentally leak
uninitialized memory.
Optimize for the case recvfrom is called with NULL as address. We don't
need to copy the address at all, so set it to NULL before invoking the
recvmsg handler. We can do so, because all the recvmsg handlers must
cope with the case a plain read() is called on them. read() also sets
msg_name to NULL.
Also document these changes in include/linux/net.h as suggested by David
Miller.
Changes since RFC:
Set msg->msg_name = NULL if user specified a NULL in msg_name but had a
non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't
affect sendto as it would bail out earlier while trying to copy-in the
address. It also more naturally reflects the logic by the callers of
verify_iovec.
With this change in place I could remove "
if (!uaddr || msg_sys->msg_namelen == 0)
msg->msg_name = NULL
".
This change does not alter the user visible error logic as we ignore
msg_namelen as long as msg_name is NULL.
Also remove two unnecessary curly brackets in ___sys_recvmsg and change
comments to netdev style.
Cc: David Miller <[email protected]>
Suggested-by: Eric Dumazet <[email protected]>
Signed-off-by: Hannes Frederic Sowa <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
GF_Descriptor *gf_odf_create_descriptor(u8 tag)
{
GF_Descriptor *desc;
switch (tag) {
case GF_ODF_IOD_TAG:
return gf_odf_new_iod();
case GF_ODF_OD_TAG:
return gf_odf_new_od();
case GF_ODF_ESD_TAG:
return gf_odf_new_esd();
case GF_ODF_DCD_TAG:
return gf_odf_new_dcd();
case GF_ODF_SLC_TAG:
//default : we create it without any predefinition...
return gf_odf_new_slc(0);
case GF_ODF_MUXINFO_TAG:
return gf_odf_new_muxinfo();
case GF_ODF_BIFS_CFG_TAG:
return gf_odf_new_bifs_cfg();
case GF_ODF_UI_CFG_TAG:
return gf_odf_new_ui_cfg();
case GF_ODF_TEXT_CFG_TAG:
return gf_odf_new_text_cfg();
case GF_ODF_TX3G_TAG:
return gf_odf_new_tx3g();
case GF_ODF_ELEM_MASK_TAG:
return gf_odf_New_ElemMask();
case GF_ODF_LASER_CFG_TAG:
return gf_odf_new_laser_cfg();
case GF_ODF_DSI_TAG:
desc = gf_odf_new_default();
if (!desc) return desc;
desc->tag = GF_ODF_DSI_TAG;
return desc;
case GF_ODF_AUX_VIDEO_DATA:
return gf_odf_new_auxvid();
case GF_ODF_SEGMENT_TAG:
return gf_odf_new_segment();
//File Format Specific
case GF_ODF_ISOM_IOD_TAG:
return gf_odf_new_isom_iod();
case GF_ODF_ISOM_OD_TAG:
return gf_odf_new_isom_od();
case GF_ODF_ESD_INC_TAG:
return gf_odf_new_esd_inc();
case GF_ODF_ESD_REF_TAG:
return gf_odf_new_esd_ref();
case GF_ODF_LANG_TAG:
return gf_odf_new_lang();
case GF_ODF_GPAC_LANG:
desc = gf_odf_new_lang();
if (desc) desc->tag = GF_ODF_GPAC_LANG;
return desc;
#ifndef GPAC_MINIMAL_ODF
case GF_ODF_MEDIATIME_TAG:
return gf_odf_new_mediatime();
case GF_ODF_CI_TAG:
return gf_odf_new_ci();
case GF_ODF_SCI_TAG:
return gf_odf_new_sup_cid();
case GF_ODF_IPI_PTR_TAG:
return gf_odf_new_ipi_ptr();
//special case for the file format
case GF_ODF_ISOM_IPI_PTR_TAG:
desc = gf_odf_new_ipi_ptr();
if (!desc) return desc;
desc->tag = GF_ODF_ISOM_IPI_PTR_TAG;
return desc;
case GF_ODF_IPMP_PTR_TAG:
return gf_odf_new_ipmp_ptr();
case GF_ODF_IPMP_TAG:
return gf_odf_new_ipmp();
case GF_ODF_QOS_TAG:
return gf_odf_new_qos();
case GF_ODF_REG_TAG:
return gf_odf_new_reg();
case GF_ODF_CC_TAG:
return gf_odf_new_cc();
case GF_ODF_KW_TAG:
return gf_odf_new_kw();
case GF_ODF_RATING_TAG:
return gf_odf_new_rating();
case GF_ODF_SHORT_TEXT_TAG:
return gf_odf_new_short_text();
case GF_ODF_TEXT_TAG:
return gf_odf_new_exp_text();
case GF_ODF_CC_NAME_TAG:
return gf_odf_new_cc_name();
case GF_ODF_CC_DATE_TAG:
return gf_odf_new_cc_date();
case GF_ODF_OCI_NAME_TAG:
return gf_odf_new_oci_name();
case GF_ODF_OCI_DATE_TAG:
return gf_odf_new_oci_date();
case GF_ODF_SMPTE_TAG:
return gf_odf_new_smpte_camera();
case GF_ODF_EXT_PL_TAG:
return gf_odf_new_pl_ext();
case GF_ODF_PL_IDX_TAG:
return gf_odf_new_pl_idx();
case GF_ODF_IPMP_TL_TAG:
return gf_odf_new_ipmp_tool_list();
case GF_ODF_IPMP_TOOL_TAG:
return gf_odf_new_ipmp_tool();
case 0:
case 0xFF:
return NULL;
#endif /*GPAC_MINIMAL_ODF*/
default:
//ISO Reserved
if ( (tag >= GF_ODF_ISO_RES_BEGIN_TAG) &&
(tag <= GF_ODF_ISO_RES_END_TAG) ) {
return NULL;
}
desc = gf_odf_new_default();
if (!desc) return desc;
desc->tag = tag;
return desc;
}
}
| 0 |
[
"CWE-787"
] |
gpac
|
4e56ad72ac1afb4e049a10f2d99e7512d7141f9d
| 140,533,877,177,069,740,000,000,000,000,000,000,000 | 129 |
fixed #2216
|
static int minor_to_rbd_dev_id(int minor)
{
return minor >> RBD_SINGLE_MAJOR_PART_SHIFT;
}
| 0 |
[
"CWE-863"
] |
linux
|
f44d04e696feaf13d192d942c4f14ad2e117065a
| 178,571,263,440,860,720,000,000,000,000,000,000,000 | 4 |
rbd: require global CAP_SYS_ADMIN for mapping and unmapping
It turns out that currently we rely only on sysfs attribute
permissions:
$ ll /sys/bus/rbd/{add*,remove*}
--w------- 1 root root 4096 Sep 3 20:37 /sys/bus/rbd/add
--w------- 1 root root 4096 Sep 3 20:37 /sys/bus/rbd/add_single_major
--w------- 1 root root 4096 Sep 3 20:37 /sys/bus/rbd/remove
--w------- 1 root root 4096 Sep 3 20:38 /sys/bus/rbd/remove_single_major
This means that images can be mapped and unmapped (i.e. block devices
can be created and deleted) by a UID 0 process even after it drops all
privileges or by any process with CAP_DAC_OVERRIDE in its user namespace
as long as UID 0 is mapped into that user namespace.
Be consistent with other virtual block devices (loop, nbd, dm, md, etc)
and require CAP_SYS_ADMIN in the initial user namespace for mapping and
unmapping, and also for dumping the configuration string and refreshing
the image header.
Cc: [email protected]
Signed-off-by: Ilya Dryomov <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
|
void inode_set_flags(struct inode *inode, unsigned int flags,
unsigned int mask)
{
unsigned int old_flags, new_flags;
WARN_ON_ONCE(flags & ~mask);
do {
old_flags = ACCESS_ONCE(inode->i_flags);
new_flags = (old_flags & ~mask) | flags;
} while (unlikely(cmpxchg(&inode->i_flags, old_flags,
new_flags) != old_flags));
}
| 0 |
[
"CWE-284",
"CWE-264"
] |
linux
|
23adbe12ef7d3d4195e80800ab36b37bee28cd03
| 86,109,859,611,400,030,000,000,000,000,000,000,000 | 12 |
fs,userns: Change inode_capable to capable_wrt_inode_uidgid
The kernel has no concept of capabilities with respect to inodes; inodes
exist independently of namespaces. For example, inode_capable(inode,
CAP_LINUX_IMMUTABLE) would be nonsense.
This patch changes inode_capable to check for uid and gid mappings and
renames it to capable_wrt_inode_uidgid, which should make it more
obvious what it does.
Fixes CVE-2014-4014.
Cc: Theodore Ts'o <[email protected]>
Cc: Serge Hallyn <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Dave Chinner <[email protected]>
Cc: [email protected]
Signed-off-by: Andy Lutomirski <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
static int iucv_sock_listen(struct socket *sock, int backlog)
{
struct sock *sk = sock->sk;
int err;
lock_sock(sk);
err = -EINVAL;
if (sk->sk_state != IUCV_BOUND)
goto done;
if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET)
goto done;
sk->sk_max_ack_backlog = backlog;
sk->sk_ack_backlog = 0;
sk->sk_state = IUCV_LISTEN;
err = 0;
done:
release_sock(sk);
return err;
}
| 0 |
[
"CWE-20",
"CWE-269"
] |
linux
|
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
| 175,673,771,140,349,450,000,000,000,000,000,000,000 | 23 |
net: rework recvmsg handler msg_name and msg_namelen logic
This patch now always passes msg->msg_namelen as 0. recvmsg handlers must
set msg_namelen to the proper size <= sizeof(struct sockaddr_storage)
to return msg_name to the user.
This prevents numerous uninitialized memory leaks we had in the
recvmsg handlers and makes it harder for new code to accidentally leak
uninitialized memory.
Optimize for the case recvfrom is called with NULL as address. We don't
need to copy the address at all, so set it to NULL before invoking the
recvmsg handler. We can do so, because all the recvmsg handlers must
cope with the case a plain read() is called on them. read() also sets
msg_name to NULL.
Also document these changes in include/linux/net.h as suggested by David
Miller.
Changes since RFC:
Set msg->msg_name = NULL if user specified a NULL in msg_name but had a
non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't
affect sendto as it would bail out earlier while trying to copy-in the
address. It also more naturally reflects the logic by the callers of
verify_iovec.
With this change in place I could remove "
if (!uaddr || msg_sys->msg_namelen == 0)
msg->msg_name = NULL
".
This change does not alter the user visible error logic as we ignore
msg_namelen as long as msg_name is NULL.
Also remove two unnecessary curly brackets in ___sys_recvmsg and change
comments to netdev style.
Cc: David Miller <[email protected]>
Suggested-by: Eric Dumazet <[email protected]>
Signed-off-by: Hannes Frederic Sowa <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
static int smack_dentry_create_files_as(struct dentry *dentry, int mode,
struct qstr *name,
const struct cred *old,
struct cred *new)
{
struct task_smack *otsp = smack_cred(old);
struct task_smack *ntsp = smack_cred(new);
struct inode_smack *isp;
int may;
/*
* Use the process credential unless all of
* the transmuting criteria are met
*/
ntsp->smk_task = otsp->smk_task;
/*
* the attribute of the containing directory
*/
isp = smack_inode(d_inode(dentry->d_parent));
if (isp->smk_flags & SMK_INODE_TRANSMUTE) {
rcu_read_lock();
may = smk_access_entry(otsp->smk_task->smk_known,
isp->smk_inode->smk_known,
&otsp->smk_task->smk_rules);
rcu_read_unlock();
/*
* If the directory is transmuting and the rule
* providing access is transmuting use the containing
* directory label instead of the process label.
*/
if (may > 0 && (may & MAY_TRANSMUTE))
ntsp->smk_task = isp->smk_inode;
}
return 0;
}
| 0 |
[
"CWE-416"
] |
linux
|
a3727a8bac0a9e77c70820655fd8715523ba3db7
| 142,391,490,194,361,100,000,000,000,000,000,000,000 | 38 |
selinux,smack: fix subjective/objective credential use mixups
Jann Horn reported a problem with commit eb1231f73c4d ("selinux:
clarify task subjective and objective credentials") where some LSM
hooks were attempting to access the subjective credentials of a task
other than the current task. Generally speaking, it is not safe to
access another task's subjective credentials and doing so can cause
a number of problems.
Further, while looking into the problem, I realized that Smack was
suffering from a similar problem brought about by a similar commit
1fb057dcde11 ("smack: differentiate between subjective and objective
task credentials").
This patch addresses this problem by restoring the use of the task's
objective credentials in those cases where the task is other than the
current executing task. Not only does this resolve the problem
reported by Jann, it is arguably the correct thing to do in these
cases.
Cc: [email protected]
Fixes: eb1231f73c4d ("selinux: clarify task subjective and objective credentials")
Fixes: 1fb057dcde11 ("smack: differentiate between subjective and objective task credentials")
Reported-by: Jann Horn <[email protected]>
Acked-by: Eric W. Biederman <[email protected]>
Acked-by: Casey Schaufler <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
|
WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info,
const int argc,const char **argv,ExceptionInfo *exception)
{
const char
*option;
GeometryInfo
geometry_info;
ssize_t
count;
register ssize_t
i;
/*
Initialize method variables.
*/
assert(image_info != (ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
if (argc < 0)
return(MagickTrue);
/*
Set the image settings.
*/
for (i=0; i < (ssize_t) argc; i++)
{
option=argv[i];
if (IsCommandOption(option) == MagickFalse)
continue;
count=ParseCommandOption(MagickCommandOptions,MagickFalse,option);
count=MagickMax(count,0L);
if ((i+count) >= (ssize_t) argc)
break;
switch (*(option+1))
{
case 'a':
{
if (LocaleCompare("adjoin",option+1) == 0)
{
image_info->adjoin=(*option == '-') ? MagickTrue : MagickFalse;
break;
}
if (LocaleCompare("antialias",option+1) == 0)
{
image_info->antialias=(*option == '-') ? MagickTrue : MagickFalse;
break;
}
if (LocaleCompare("authenticate",option+1) == 0)
{
if (*option == '+')
(void) DeleteImageOption(image_info,option+1);
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'b':
{
if (LocaleCompare("background",option+1) == 0)
{
if (*option == '+')
{
(void) DeleteImageOption(image_info,option+1);
(void) QueryColorCompliance(MogrifyBackgroundColor,
AllCompliance,&image_info->background_color,exception);
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
(void) QueryColorCompliance(argv[i+1],AllCompliance,
&image_info->background_color,exception);
break;
}
if (LocaleCompare("bias",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,"convolve:bias","0.0");
break;
}
(void) SetImageOption(image_info,"convolve:bias",argv[i+1]);
break;
}
if (LocaleCompare("black-point-compensation",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"false");
break;
}
(void) SetImageOption(image_info,option+1,"true");
break;
}
if (LocaleCompare("blue-primary",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"0.0");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("bordercolor",option+1) == 0)
{
if (*option == '+')
{
(void) DeleteImageOption(image_info,option+1);
(void) QueryColorCompliance(MogrifyBorderColor,AllCompliance,
&image_info->border_color,exception);
break;
}
(void) QueryColorCompliance(argv[i+1],AllCompliance,
&image_info->border_color,exception);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("box",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,"undercolor","none");
break;
}
(void) SetImageOption(image_info,"undercolor",argv[i+1]);
break;
}
break;
}
case 'c':
{
if (LocaleCompare("cache",option+1) == 0)
{
MagickSizeType
limit;
limit=MagickResourceInfinity;
if (LocaleCompare("unlimited",argv[i+1]) != 0)
limit=(MagickSizeType) SiPrefixToDoubleInterval(argv[i+1],
100.0);
(void) SetMagickResourceLimit(MemoryResource,limit);
(void) SetMagickResourceLimit(MapResource,2*limit);
break;
}
if (LocaleCompare("caption",option+1) == 0)
{
if (*option == '+')
{
(void) DeleteImageOption(image_info,option+1);
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("colorspace",option+1) == 0)
{
if (*option == '+')
{
image_info->colorspace=UndefinedColorspace;
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
image_info->colorspace=(ColorspaceType) ParseCommandOption(
MagickColorspaceOptions,MagickFalse,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("comment",option+1) == 0)
{
if (*option == '+')
{
(void) DeleteImageOption(image_info,option+1);
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("compose",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("compress",option+1) == 0)
{
if (*option == '+')
{
image_info->compression=UndefinedCompression;
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
image_info->compression=(CompressionType) ParseCommandOption(
MagickCompressOptions,MagickFalse,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'd':
{
if (LocaleCompare("debug",option+1) == 0)
{
if (*option == '+')
(void) SetLogEventMask("none");
else
(void) SetLogEventMask(argv[i+1]);
image_info->debug=IsEventLogging();
break;
}
if (LocaleCompare("define",option+1) == 0)
{
if (*option == '+')
{
if (LocaleNCompare(argv[i+1],"registry:",9) == 0)
(void) DeleteImageRegistry(argv[i+1]+9);
else
(void) DeleteImageOption(image_info,argv[i+1]);
break;
}
if (LocaleNCompare(argv[i+1],"registry:",9) == 0)
{
(void) DefineImageRegistry(StringRegistryType,argv[i+1]+9,
exception);
break;
}
(void) DefineImageOption(image_info,argv[i+1]);
break;
}
if (LocaleCompare("delay",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"0");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("density",option+1) == 0)
{
/*
Set image density.
*/
if (*option == '+')
{
if (image_info->density != (char *) NULL)
image_info->density=DestroyString(image_info->density);
(void) SetImageOption(image_info,option+1,"72");
break;
}
(void) CloneString(&image_info->density,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("depth",option+1) == 0)
{
if (*option == '+')
{
image_info->depth=MAGICKCORE_QUANTUM_DEPTH;
break;
}
image_info->depth=StringToUnsignedLong(argv[i+1]);
break;
}
if (LocaleCompare("direction",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("display",option+1) == 0)
{
if (*option == '+')
{
if (image_info->server_name != (char *) NULL)
image_info->server_name=DestroyString(
image_info->server_name);
break;
}
(void) CloneString(&image_info->server_name,argv[i+1]);
break;
}
if (LocaleCompare("dispose",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("dither",option+1) == 0)
{
if (*option == '+')
{
image_info->dither=MagickFalse;
(void) SetImageOption(image_info,option+1,"none");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
image_info->dither=MagickTrue;
break;
}
break;
}
case 'e':
{
if (LocaleCompare("encoding",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("endian",option+1) == 0)
{
if (*option == '+')
{
image_info->endian=UndefinedEndian;
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
image_info->endian=(EndianType) ParseCommandOption(
MagickEndianOptions,MagickFalse,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("extract",option+1) == 0)
{
/*
Set image extract geometry.
*/
if (*option == '+')
{
if (image_info->extract != (char *) NULL)
image_info->extract=DestroyString(image_info->extract);
break;
}
(void) CloneString(&image_info->extract,argv[i+1]);
break;
}
break;
}
case 'f':
{
if (LocaleCompare("family",option+1) == 0)
{
if (*option != '+')
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("fill",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"none");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("filter",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("font",option+1) == 0)
{
if (*option == '+')
{
if (image_info->font != (char *) NULL)
image_info->font=DestroyString(image_info->font);
break;
}
(void) CloneString(&image_info->font,argv[i+1]);
break;
}
if (LocaleCompare("format",option+1) == 0)
{
register const char
*q;
for (q=strchr(argv[i+1],'%'); q != (char *) NULL; q=strchr(q+1,'%'))
if (strchr("Agkrz@[#",*(q+1)) != (char *) NULL)
image_info->ping=MagickFalse;
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("fuzz",option+1) == 0)
{
if (*option == '+')
{
image_info->fuzz=0.0;
(void) SetImageOption(image_info,option+1,"0");
break;
}
image_info->fuzz=StringToDoubleInterval(argv[i+1],(double)
QuantumRange+1.0);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'g':
{
if (LocaleCompare("gravity",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("green-primary",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"0.0");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'i':
{
if (LocaleCompare("intensity",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("intent",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("interlace",option+1) == 0)
{
if (*option == '+')
{
image_info->interlace=UndefinedInterlace;
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
image_info->interlace=(InterlaceType) ParseCommandOption(
MagickInterlaceOptions,MagickFalse,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("interline-spacing",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("interpolate",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("interword-spacing",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'k':
{
if (LocaleCompare("kerning",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'l':
{
if (LocaleCompare("label",option+1) == 0)
{
if (*option == '+')
{
(void) DeleteImageOption(image_info,option+1);
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("limit",option+1) == 0)
{
MagickSizeType
limit;
ResourceType
type;
if (*option == '+')
break;
type=(ResourceType) ParseCommandOption(MagickResourceOptions,
MagickFalse,argv[i+1]);
limit=MagickResourceInfinity;
if (LocaleCompare("unlimited",argv[i+2]) != 0)
limit=(MagickSizeType) SiPrefixToDoubleInterval(argv[i+2],100.0);
(void) SetMagickResourceLimit(type,limit);
break;
}
if (LocaleCompare("list",option+1) == 0)
{
ssize_t
list;
/*
Display configuration list.
*/
list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i+1]);
switch (list)
{
case MagickCoderOptions:
{
(void) ListCoderInfo((FILE *) NULL,exception);
break;
}
case MagickColorOptions:
{
(void) ListColorInfo((FILE *) NULL,exception);
break;
}
case MagickConfigureOptions:
{
(void) ListConfigureInfo((FILE *) NULL,exception);
break;
}
case MagickDelegateOptions:
{
(void) ListDelegateInfo((FILE *) NULL,exception);
break;
}
case MagickFontOptions:
{
(void) ListTypeInfo((FILE *) NULL,exception);
break;
}
case MagickFormatOptions:
{
(void) ListMagickInfo((FILE *) NULL,exception);
break;
}
case MagickLocaleOptions:
{
(void) ListLocaleInfo((FILE *) NULL,exception);
break;
}
case MagickLogOptions:
{
(void) ListLogInfo((FILE *) NULL,exception);
break;
}
case MagickMagicOptions:
{
(void) ListMagicInfo((FILE *) NULL,exception);
break;
}
case MagickMimeOptions:
{
(void) ListMimeInfo((FILE *) NULL,exception);
break;
}
case MagickModuleOptions:
{
(void) ListModuleInfo((FILE *) NULL,exception);
break;
}
case MagickPolicyOptions:
{
(void) ListPolicyInfo((FILE *) NULL,exception);
break;
}
case MagickResourceOptions:
{
(void) ListMagickResourceInfo((FILE *) NULL,exception);
break;
}
case MagickThresholdOptions:
{
(void) ListThresholdMaps((FILE *) NULL,exception);
break;
}
default:
{
(void) ListCommandOptions((FILE *) NULL,(CommandOption) list,
exception);
break;
}
}
break;
}
if (LocaleCompare("log",option+1) == 0)
{
if (*option == '+')
break;
(void) SetLogFormat(argv[i+1]);
break;
}
if (LocaleCompare("loop",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"0");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'm':
{
if (LocaleCompare("matte",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"false");
break;
}
(void) SetImageOption(image_info,option+1,"true");
break;
}
if (LocaleCompare("mattecolor",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,argv[i+1]);
(void) QueryColorCompliance(MogrifyAlphaColor,AllCompliance,
&image_info->matte_color,exception);
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
(void) QueryColorCompliance(argv[i+1],AllCompliance,
&image_info->matte_color,exception);
break;
}
if (LocaleCompare("metric",option+1) == 0)
{
if (*option == '+')
(void) DeleteImageOption(image_info,option+1);
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("monitor",option+1) == 0)
{
(void) SetImageInfoProgressMonitor(image_info,MonitorProgress,
(void *) NULL);
break;
}
if (LocaleCompare("monochrome",option+1) == 0)
{
image_info->monochrome=(*option == '-') ? MagickTrue : MagickFalse;
break;
}
break;
}
case 'o':
{
if (LocaleCompare("orient",option+1) == 0)
{
if (*option == '+')
{
image_info->orientation=UndefinedOrientation;
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
image_info->orientation=(OrientationType) ParseCommandOption(
MagickOrientationOptions,MagickFalse,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
}
case 'p':
{
if (LocaleCompare("page",option+1) == 0)
{
char
*canonical_page,
page[MagickPathExtent];
const char
*image_option;
MagickStatusType
flags;
RectangleInfo
geometry;
if (*option == '+')
{
(void) DeleteImageOption(image_info,option+1);
(void) CloneString(&image_info->page,(char *) NULL);
break;
}
(void) memset(&geometry,0,sizeof(geometry));
image_option=GetImageOption(image_info,"page");
if (image_option != (const char *) NULL)
flags=ParseAbsoluteGeometry(image_option,&geometry);
canonical_page=GetPageGeometry(argv[i+1]);
flags=ParseAbsoluteGeometry(canonical_page,&geometry);
canonical_page=DestroyString(canonical_page);
(void) FormatLocaleString(page,MagickPathExtent,"%lux%lu",
(unsigned long) geometry.width,(unsigned long) geometry.height);
if (((flags & XValue) != 0) || ((flags & YValue) != 0))
(void) FormatLocaleString(page,MagickPathExtent,"%lux%lu%+ld%+ld",
(unsigned long) geometry.width,(unsigned long) geometry.height,
(long) geometry.x,(long) geometry.y);
(void) SetImageOption(image_info,option+1,page);
(void) CloneString(&image_info->page,page);
break;
}
if (LocaleCompare("ping",option+1) == 0)
{
image_info->ping=(*option == '-') ? MagickTrue : MagickFalse;
break;
}
if (LocaleCompare("pointsize",option+1) == 0)
{
if (*option == '+')
geometry_info.rho=0.0;
else
(void) ParseGeometry(argv[i+1],&geometry_info);
image_info->pointsize=geometry_info.rho;
break;
}
if (LocaleCompare("precision",option+1) == 0)
{
(void) SetMagickPrecision(StringToInteger(argv[i+1]));
break;
}
break;
}
case 'q':
{
if (LocaleCompare("quality",option+1) == 0)
{
/*
Set image compression quality.
*/
if (*option == '+')
{
image_info->quality=UndefinedCompressionQuality;
(void) SetImageOption(image_info,option+1,"0");
break;
}
image_info->quality=StringToUnsignedLong(argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("quiet",option+1) == 0)
{
static WarningHandler
warning_handler = (WarningHandler) NULL;
if (*option == '+')
{
/*
Restore error or warning messages.
*/
warning_handler=SetWarningHandler(warning_handler);
break;
}
/*
Suppress error or warning messages.
*/
warning_handler=SetWarningHandler((WarningHandler) NULL);
break;
}
break;
}
case 'r':
{
if (LocaleCompare("red-primary",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"0.0");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 's':
{
if (LocaleCompare("sampling-factor",option+1) == 0)
{
/*
Set image sampling factor.
*/
if (*option == '+')
{
if (image_info->sampling_factor != (char *) NULL)
image_info->sampling_factor=DestroyString(
image_info->sampling_factor);
break;
}
(void) CloneString(&image_info->sampling_factor,argv[i+1]);
break;
}
if (LocaleCompare("scene",option+1) == 0)
{
/*
Set image scene.
*/
if (*option == '+')
{
image_info->scene=0;
(void) SetImageOption(image_info,option+1,"0");
break;
}
image_info->scene=StringToUnsignedLong(argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("seed",option+1) == 0)
{
unsigned long
seed;
if (*option == '+')
{
seed=(unsigned long) time((time_t *) NULL);
SetRandomSecretKey(seed);
break;
}
seed=StringToUnsignedLong(argv[i+1]);
SetRandomSecretKey(seed);
break;
}
if (LocaleCompare("size",option+1) == 0)
{
if (*option == '+')
{
if (image_info->size != (char *) NULL)
image_info->size=DestroyString(image_info->size);
break;
}
(void) CloneString(&image_info->size,argv[i+1]);
break;
}
if (LocaleCompare("stroke",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"none");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("strokewidth",option+1) == 0)
{
if (*option == '+')
(void) SetImageOption(image_info,option+1,"0");
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("style",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"none");
break;
}
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("synchronize",option+1) == 0)
{
if (*option == '+')
{
image_info->synchronize=MagickFalse;
break;
}
image_info->synchronize=MagickTrue;
break;
}
break;
}
case 't':
{
if (LocaleCompare("taint",option+1) == 0)
{
if (*option == '+')
{
(void) SetImageOption(image_info,option+1,"false");
break;
}
(void) SetImageOption(image_info,option+1,"true");
break;
}
if (LocaleCompare("texture",option+1) == 0)
{
if (*option == '+')
{
if (image_info->texture != (char *) NULL)
image_info->texture=DestroyString(image_info->texture);
break;
}
(void) CloneString(&image_info->texture,argv[i+1]);
break;
}
if (LocaleCompare("tile-offset",option+1) == 0)
{
if (*option == '+')
(void) SetImageOption(image_info,option+1,"0");
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("transparent-color",option+1) == 0)
{
if (*option == '+')
{
(void) QueryColorCompliance("none",AllCompliance,
&image_info->transparent_color,exception);
(void) SetImageOption(image_info,option+1,"none");
break;
}
(void) QueryColorCompliance(argv[i+1],AllCompliance,
&image_info->transparent_color,exception);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("type",option+1) == 0)
{
if (*option == '+')
{
image_info->type=UndefinedType;
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
image_info->type=(ImageType) ParseCommandOption(MagickTypeOptions,
MagickFalse,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'u':
{
if (LocaleCompare("undercolor",option+1) == 0)
{
if (*option == '+')
(void) DeleteImageOption(image_info,option+1);
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("units",option+1) == 0)
{
if (*option == '+')
{
image_info->units=UndefinedResolution;
(void) SetImageOption(image_info,option+1,"undefined");
break;
}
image_info->units=(ResolutionType) ParseCommandOption(
MagickResolutionOptions,MagickFalse,argv[i+1]);
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'v':
{
if (LocaleCompare("verbose",option+1) == 0)
{
if (*option == '+')
{
image_info->verbose=MagickFalse;
break;
}
image_info->verbose=MagickTrue;
image_info->ping=MagickFalse;
break;
}
if (LocaleCompare("virtual-pixel",option+1) == 0)
{
if (*option == '+')
(void) SetImageOption(image_info,option+1,"undefined");
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
case 'w':
{
if (LocaleCompare("weight",option+1) == 0)
{
if (*option == '+')
(void) SetImageOption(image_info,option+1,"0");
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
if (LocaleCompare("white-point",option+1) == 0)
{
if (*option == '+')
(void) SetImageOption(image_info,option+1,"0.0");
else
(void) SetImageOption(image_info,option+1,argv[i+1]);
break;
}
break;
}
default:
break;
}
i+=count;
}
return(MagickTrue);
}
| 0 |
[
"CWE-399",
"CWE-401"
] |
ImageMagick
|
4a334bbf5584de37c6f5a47c380a531c8c4b140a
| 224,012,410,277,244,260,000,000,000,000,000,000,000 | 1,077 |
https://github.com/ImageMagick/ImageMagick/issues/1623
|
void qpdf_set_info_key(qpdf_data qpdf, char const* key, char const* value)
{
if ((key == 0) || (std::strlen(key) == 0) || (key[0] != '/'))
{
return;
}
QPDFObjectHandle value_object;
if (value)
{
QTC::TC("qpdf", "qpdf-c set_info_key to value");
value_object = QPDFObjectHandle::newString(value);
}
else
{
QTC::TC("qpdf", "qpdf-c set_info_key to null");
value_object = QPDFObjectHandle::newNull();
}
QPDFObjectHandle trailer = qpdf->qpdf->getTrailer();
if (! trailer.hasKey("/Info"))
{
QTC::TC("qpdf", "qpdf-c add info to trailer");
trailer.replaceKey(
"/Info",
qpdf->qpdf->makeIndirectObject(QPDFObjectHandle::newDictionary()));
}
else
{
QTC::TC("qpdf", "qpdf-c set-info-key use existing info");
}
QPDFObjectHandle info = trailer.getKey("/Info");
info.replaceOrRemoveKey(key, value_object);
}
| 0 |
[
"CWE-787"
] |
qpdf
|
d71f05ca07eb5c7cfa4d6d23e5c1f2a800f52e8e
| 216,568,224,140,647,640,000,000,000,000,000,000,000 | 34 |
Fix sign and conversion warnings (major)
This makes all integer type conversions that have potential data loss
explicit with calls that do range checks and raise an exception. After
this commit, qpdf builds with no warnings when -Wsign-conversion
-Wconversion is used with gcc or clang or when -W3 -Wd4800 is used
with MSVC. This significantly reduces the likelihood of potential
crashes from bogus integer values.
There are some parts of the code that take int when they should take
size_t or an offset. Such places would make qpdf not support files
with more than 2^31 of something that usually wouldn't be so large. In
the event that such a file shows up and is valid, at least qpdf would
raise an error in the right spot so the issue could be legitimately
addressed rather than failing in some weird way because of a silent
overflow condition.
|
Curl_ssl_connect_nonblocking(struct Curl_easy *data, struct connectdata *conn,
bool isproxy, int sockindex, bool *done)
{
CURLcode result;
#ifndef CURL_DISABLE_PROXY
if(conn->bits.proxy_ssl_connected[sockindex]) {
result = ssl_connect_init_proxy(conn, sockindex);
if(result)
return result;
}
#endif
if(!ssl_prefs_check(data))
return CURLE_SSL_CONNECT_ERROR;
/* mark this is being ssl requested from here on. */
conn->ssl[sockindex].use = TRUE;
result = Curl_ssl->connect_nonblocking(data, conn, sockindex, done);
if(result)
conn->ssl[sockindex].use = FALSE;
else if(*done && !isproxy)
Curl_pgrsTime(data, TIMER_APPCONNECT); /* SSL is connected */
return result;
}
| 0 |
[] |
curl
|
852aa5ad351ea53e5f01d2f44b5b4370c2bf5425
| 49,021,892,761,300,660,000,000,000,000,000,000,000 | 24 |
url: check sasl additional parameters for connection reuse.
Also move static function safecmp() as non-static Curl_safecmp() since
its purpose is needed at several places.
Bug: https://curl.se/docs/CVE-2022-22576.html
CVE-2022-22576
Closes #8746
|
sctp_disposition_t sctp_sf_t1_init_timer_expire(const struct sctp_endpoint *ep,
const struct sctp_association *asoc,
const sctp_subtype_t type,
void *arg,
sctp_cmd_seq_t *commands)
{
struct sctp_chunk *repl = NULL;
struct sctp_bind_addr *bp;
int attempts = asoc->init_err_counter + 1;
SCTP_DEBUG_PRINTK("Timer T1 expired (INIT).\n");
SCTP_INC_STATS(SCTP_MIB_T1_INIT_EXPIREDS);
if (attempts <= asoc->max_init_attempts) {
bp = (struct sctp_bind_addr *) &asoc->base.bind_addr;
repl = sctp_make_init(asoc, bp, GFP_ATOMIC, 0);
if (!repl)
return SCTP_DISPOSITION_NOMEM;
/* Choose transport for INIT. */
sctp_add_cmd_sf(commands, SCTP_CMD_INIT_CHOOSE_TRANSPORT,
SCTP_CHUNK(repl));
/* Issue a sideeffect to do the needed accounting. */
sctp_add_cmd_sf(commands, SCTP_CMD_INIT_RESTART,
SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT));
sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));
} else {
SCTP_DEBUG_PRINTK("Giving up on INIT, attempts: %d"
" max_init_attempts: %d\n",
attempts, asoc->max_init_attempts);
sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
SCTP_ERROR(ETIMEDOUT));
sctp_add_cmd_sf(commands, SCTP_CMD_INIT_FAILED,
SCTP_PERR(SCTP_ERROR_NO_ERROR));
return SCTP_DISPOSITION_DELETE_TCB;
}
return SCTP_DISPOSITION_CONSUME;
}
| 0 |
[
"CWE-20"
] |
linux-2.6
|
ba0166708ef4da7eeb61dd92bbba4d5a749d6561
| 326,290,411,239,296,170,000,000,000,000,000,000,000 | 41 |
sctp: Fix kernel panic while process protocol violation parameter
Since call to function sctp_sf_abort_violation() need paramter 'arg' with
'struct sctp_chunk' type, it will read the chunk type and chunk length from
the chunk_hdr member of chunk. But call to sctp_sf_violation_paramlen()
always with 'struct sctp_paramhdr' type's parameter, it will be passed to
sctp_sf_abort_violation(). This may cause kernel panic.
sctp_sf_violation_paramlen()
|-- sctp_sf_abort_violation()
|-- sctp_make_abort_violation()
This patch fixed this problem. This patch also fix two place which called
sctp_sf_violation_paramlen() with wrong paramter type.
Signed-off-by: Wei Yongjun <[email protected]>
Signed-off-by: Vlad Yasevich <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name)
{
cJSON *object_item = cJSON_CreateObject();
if (add_item_to_object(object, name, object_item, &global_hooks, false))
{
return object_item;
}
cJSON_Delete(object_item);
return NULL;
}
| 0 |
[
"CWE-754",
"CWE-787"
] |
cJSON
|
be749d7efa7c9021da746e685bd6dec79f9dd99b
| 278,727,155,436,378,200,000,000,000,000,000,000,000 | 11 |
Fix crash of cJSON_GetObjectItemCaseSensitive when calling it on arrays
|
static int fuse_ioctl_copy_user(struct page **pages, struct iovec *iov,
unsigned int nr_segs, size_t bytes, bool to_user)
{
struct iov_iter ii;
int page_idx = 0;
if (!bytes)
return 0;
iov_iter_init(&ii, iov, nr_segs, bytes, 0);
while (iov_iter_count(&ii)) {
struct page *page = pages[page_idx++];
size_t todo = min_t(size_t, PAGE_SIZE, iov_iter_count(&ii));
void *kaddr;
kaddr = kmap(page);
while (todo) {
char __user *uaddr = ii.iov->iov_base + ii.iov_offset;
size_t iov_len = ii.iov->iov_len - ii.iov_offset;
size_t copy = min(todo, iov_len);
size_t left;
if (!to_user)
left = copy_from_user(kaddr, uaddr, copy);
else
left = copy_to_user(uaddr, kaddr, copy);
if (unlikely(left))
return -EFAULT;
iov_iter_advance(&ii, copy);
todo -= copy;
kaddr += copy;
}
kunmap(page);
}
return 0;
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
linux
|
7572777eef78ebdee1ecb7c258c0ef94d35bad16
| 91,455,619,691,919,220,000,000,000,000,000,000,000 | 42 |
fuse: verify ioctl retries
Verify that the total length of the iovec returned in FUSE_IOCTL_RETRY
doesn't overflow iov_length().
Signed-off-by: Miklos Szeredi <[email protected]>
CC: Tejun Heo <[email protected]>
CC: <[email protected]> [2.6.31+]
|
static u32 esp4_get_mtu(struct xfrm_state *x, int mtu)
{
struct esp_data *esp = x->data;
u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4);
u32 align = max_t(u32, blksize, esp->padlen);
u32 rem;
mtu -= x->props.header_len + crypto_aead_authsize(esp->aead);
rem = mtu & (align - 1);
mtu &= ~(align - 1);
switch (x->props.mode) {
case XFRM_MODE_TUNNEL:
break;
default:
case XFRM_MODE_TRANSPORT:
/* The worst case */
mtu -= blksize - 4;
mtu += min_t(u32, blksize - 4, rem);
break;
case XFRM_MODE_BEET:
/* The worst case. */
mtu += min_t(u32, IPV4_BEET_PHMAXLEN, rem);
break;
}
return mtu - 2;
}
| 0 |
[
"CWE-16"
] |
linux-2.6
|
920fc941a9617f95ccb283037fe6f8a38d95bb69
| 202,193,602,287,432,030,000,000,000,000,000,000,000 | 28 |
[ESP]: Ensure IV is in linear part of the skb to avoid BUG() due to OOB access
ESP does not account for the IV size when calling pskb_may_pull() to
ensure everything it accesses directly is within the linear part of a
potential fragment. This results in a BUG() being triggered when the
both the IPv4 and IPv6 ESP stack is fed with an skb where the first
fragment ends between the end of the esp header and the end of the IV.
This bug was found by Dirk Nehring <[email protected]> .
Signed-off-by: Thomas Graf <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
static void rpc_async_release(struct work_struct *work)
{
rpc_free_task(container_of(work, struct rpc_task, u.tk_work));
}
| 0 |
[
"CWE-400",
"CWE-399",
"CWE-703"
] |
linux
|
0b760113a3a155269a3fba93a409c640031dd68f
| 62,775,408,681,394,990,000,000,000,000,000,000,000 | 4 |
NLM: Don't hang forever on NLM unlock requests
If the NLM daemon is killed on the NFS server, we can currently end up
hanging forever on an 'unlock' request, instead of aborting. Basically,
if the rpcbind request fails, or the server keeps returning garbage, we
really want to quit instead of retrying.
Tested-by: Vasily Averin <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Cc: [email protected]
|
static void GetNonpeakPixelList(PixelList *pixel_list,MagickPixelPacket *pixel)
{
register SkipList
*list;
register ssize_t
channel;
size_t
color,
next,
previous;
ssize_t
count;
unsigned short
channels[5];
/*
Finds the non peak value for each of the colors.
*/
for (channel=0; channel < 5; channel++)
{
list=pixel_list->lists+channel;
color=65536L;
next=list->nodes[color].next[0];
count=0;
do
{
previous=color;
color=next;
next=list->nodes[color].next[0];
count+=list->nodes[color].count;
} while (count <= (ssize_t) (pixel_list->length >> 1));
if ((previous == 65536UL) && (next != 65536UL))
color=next;
else
if ((previous != 65536UL) && (next == 65536UL))
color=previous;
channels[channel]=(unsigned short) color;
}
pixel->red=(MagickRealType) ScaleShortToQuantum(channels[0]);
pixel->green=(MagickRealType) ScaleShortToQuantum(channels[1]);
pixel->blue=(MagickRealType) ScaleShortToQuantum(channels[2]);
pixel->opacity=(MagickRealType) ScaleShortToQuantum(channels[3]);
pixel->index=(MagickRealType) ScaleShortToQuantum(channels[4]);
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
ImageMagick6
|
91e58d967a92250439ede038ccfb0913a81e59fe
| 131,739,247,615,415,720,000,000,000,000,000,000,000 | 48 |
https://github.com/ImageMagick/ImageMagick/issues/1615
|
static bool ad_entry_check_size(uint32_t eid,
size_t bufsize,
uint32_t off,
uint32_t got_len)
{
struct {
off_t expected_len;
bool fixed_size;
bool minimum_size;
} ad_checks[] = {
[ADEID_DFORK] = {-1, false, false}, /* not applicable */
[ADEID_RFORK] = {-1, false, false}, /* no limit */
[ADEID_NAME] = {ADEDLEN_NAME, false, false},
[ADEID_COMMENT] = {ADEDLEN_COMMENT, false, false},
[ADEID_ICONBW] = {ADEDLEN_ICONBW, true, false},
[ADEID_ICONCOL] = {ADEDLEN_ICONCOL, false, false},
[ADEID_FILEI] = {ADEDLEN_FILEI, true, false},
[ADEID_FILEDATESI] = {ADEDLEN_FILEDATESI, true, false},
[ADEID_FINDERI] = {ADEDLEN_FINDERI, false, true},
[ADEID_MACFILEI] = {ADEDLEN_MACFILEI, true, false},
[ADEID_PRODOSFILEI] = {ADEDLEN_PRODOSFILEI, true, false},
[ADEID_MSDOSFILEI] = {ADEDLEN_MSDOSFILEI, true, false},
[ADEID_SHORTNAME] = {ADEDLEN_SHORTNAME, false, false},
[ADEID_AFPFILEI] = {ADEDLEN_AFPFILEI, true, false},
[ADEID_DID] = {ADEDLEN_DID, true, false},
[ADEID_PRIVDEV] = {ADEDLEN_PRIVDEV, true, false},
[ADEID_PRIVINO] = {ADEDLEN_PRIVINO, true, false},
[ADEID_PRIVSYN] = {ADEDLEN_PRIVSYN, true, false},
[ADEID_PRIVID] = {ADEDLEN_PRIVID, true, false},
};
if (eid >= ADEID_MAX) {
return false;
}
if (got_len == 0) {
/* Entry present, but empty, allow */
return true;
}
if (ad_checks[eid].expected_len == 0) {
/*
* Shouldn't happen: implicitly initialized to zero because
* explicit initializer missing.
*/
return false;
}
if (ad_checks[eid].expected_len == -1) {
/* Unused or no limit */
return true;
}
if (ad_checks[eid].fixed_size) {
if (ad_checks[eid].expected_len != got_len) {
/* Wrong size fo fixed size entry. */
return false;
}
} else {
if (ad_checks[eid].minimum_size) {
if (got_len < ad_checks[eid].expected_len) {
/*
* Too small for variable sized entry with
* minimum size.
*/
return false;
}
} else {
if (got_len > ad_checks[eid].expected_len) {
/* Too big for variable sized entry. */
return false;
}
}
}
if (off + got_len < off) {
/* wrap around */
return false;
}
if (off + got_len > bufsize) {
/* overflow */
return false;
}
return true;
}
| 0 |
[
"CWE-787"
] |
samba
|
0e2b3fb982d1f53d111e10d9197ed2ec2e13712c
| 293,967,545,325,578,750,000,000,000,000,000,000,000 | 80 |
CVE-2021-44142: libadouble: harden parsing code
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14914
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
|
static void write_date(bytearray_t * bplist, double val)
{
uint8_t buff[9];
buff[0] = BPLIST_DATE | 3;
*(uint64_t*)(buff+1) = float_bswap64(*(uint64_t*)&val);
byte_array_append(bplist, buff, sizeof(buff));
}
| 0 |
[
"CWE-125"
] |
libplist
|
4765d9a60ca4248a8f89289271ac69cbffcc29bc
| 34,391,704,239,147,026,000,000,000,000,000,000,000 | 7 |
bplist: Fix possible out-of-bounds read in parse_array_node() with proper bounds checking
|
bool BrotliDecompressorImpl::process(Common::BrotliContext& ctx, Buffer::Instance& output_buffer) {
BrotliDecoderResult result;
result = BrotliDecoderDecompressStream(state_.get(), &ctx.avail_in_, &ctx.next_in_,
&ctx.avail_out_, &ctx.next_out_, nullptr);
if (result == BROTLI_DECODER_RESULT_ERROR) {
// TODO(rojkov): currently the Brotli library doesn't specify possible errors in its API. Add
// more detailed stats when they are documented.
stats_.brotli_error_.inc();
return false;
}
if (Runtime::runtimeFeatureEnabled(
"envoy.reloadable_features.enable_compression_bomb_protection") &&
(output_buffer.length() > ctx.max_output_size_)) {
stats_.brotli_error_.inc();
return false;
}
ctx.updateOutput(output_buffer);
return true;
}
| 0 |
[] |
envoy
|
cb4ef0b09200c720dfdb07e097092dd105450343
| 211,371,710,560,402,260,000,000,000,000,000,000,000 | 22 |
decompressors: stop decompressing upon excessive compression ratio (#733)
Signed-off-by: Dmitry Rozhkov <[email protected]>
Co-authored-by: Ryan Hamilton <[email protected]>
Signed-off-by: Matt Klein <[email protected]>
Signed-off-by: Pradeep Rao <[email protected]>
|
static void fib_replace_table(struct net *net, struct fib_table *old,
struct fib_table *new)
{
#ifdef CONFIG_IP_MULTIPLE_TABLES
switch (new->tb_id) {
case RT_TABLE_LOCAL:
rcu_assign_pointer(net->ipv4.fib_local, new);
break;
case RT_TABLE_MAIN:
rcu_assign_pointer(net->ipv4.fib_main, new);
break;
case RT_TABLE_DEFAULT:
rcu_assign_pointer(net->ipv4.fib_default, new);
break;
default:
break;
}
#endif
/* replace the old table in the hlist */
hlist_replace_rcu(&old->tb_hlist, &new->tb_hlist);
}
| 0 |
[
"CWE-399"
] |
net-next
|
fbd40ea0180a2d328c5adc61414dc8bab9335ce2
| 279,183,991,494,680,600,000,000,000,000,000,000,000 | 22 |
ipv4: Don't do expensive useless work during inetdev destroy.
When an inetdev is destroyed, every address assigned to the interface
is removed. And in this scenerio we do two pointless things which can
be very expensive if the number of assigned interfaces is large:
1) Address promotion. We are deleting all addresses, so there is no
point in doing this.
2) A full nf conntrack table purge for every address. We only need to
do this once, as is already caught by the existing
masq_dev_notifier so masq_inet_event() can skip this.
Reported-by: Solar Designer <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Tested-by: Cyrill Gorcunov <[email protected]>
|
static int tm_cgpr_get(struct task_struct *target,
const struct user_regset *regset,
unsigned int pos, unsigned int count,
void *kbuf, void __user *ubuf)
{
int ret;
if (!cpu_has_feature(CPU_FTR_TM))
return -ENODEV;
if (!MSR_TM_ACTIVE(target->thread.regs->msr))
return -ENODATA;
flush_tmregs_to_thread(target);
flush_fp_to_thread(target);
flush_altivec_to_thread(target);
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
&target->thread.ckpt_regs,
0, offsetof(struct pt_regs, msr));
if (!ret) {
unsigned long msr = get_user_ckpt_msr(target);
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &msr,
offsetof(struct pt_regs, msr),
offsetof(struct pt_regs, msr) +
sizeof(msr));
}
BUILD_BUG_ON(offsetof(struct pt_regs, orig_gpr3) !=
offsetof(struct pt_regs, msr) + sizeof(long));
if (!ret)
ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
&target->thread.ckpt_regs.orig_gpr3,
offsetof(struct pt_regs, orig_gpr3),
sizeof(struct pt_regs));
if (!ret)
ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
sizeof(struct pt_regs), -1);
return ret;
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
linux
|
c1fa0768a8713b135848f78fd43ffc208d8ded70
| 142,021,420,925,550,430,000,000,000,000,000,000,000 | 43 |
powerpc/tm: Flush TM only if CPU has TM feature
Commit cd63f3c ("powerpc/tm: Fix saving of TM SPRs in core dump")
added code to access TM SPRs in flush_tmregs_to_thread(). However
flush_tmregs_to_thread() does not check if TM feature is available on
CPU before trying to access TM SPRs in order to copy live state to
thread structures. flush_tmregs_to_thread() is indeed guarded by
CONFIG_PPC_TRANSACTIONAL_MEM but it might be the case that kernel
was compiled with CONFIG_PPC_TRANSACTIONAL_MEM enabled and ran on
a CPU without TM feature available, thus rendering the execution
of TM instructions that are treated by the CPU as illegal instructions.
The fix is just to add proper checking in flush_tmregs_to_thread()
if CPU has the TM feature before accessing any TM-specific resource,
returning immediately if TM is no available on the CPU. Adding
that checking in flush_tmregs_to_thread() instead of in places
where it is called, like in vsr_get() and vsr_set(), is better because
avoids the same problem cropping up elsewhere.
Cc: [email protected] # v4.13+
Fixes: cd63f3c ("powerpc/tm: Fix saving of TM SPRs in core dump")
Signed-off-by: Gustavo Romero <[email protected]>
Reviewed-by: Cyril Bur <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
|
ModuleExport void UnregisterWPGImage(void)
{
(void) UnregisterMagickInfo("WPG");
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
ImageMagick
|
fc43974d34318c834fbf78570ca1a3764ed8c7d7
| 82,599,541,584,416,010,000,000,000,000,000,000,000 | 4 |
Ensure image extent does not exceed maximum
|
m4_pushdef (struct obstack *obs, int argc, token_data **argv)
{
define_macro (argc, argv, SYMBOL_PUSHDEF);
}
| 0 |
[] |
m4
|
5345bb49077bfda9fabd048e563f9e7077fe335d
| 49,643,228,606,914,270,000,000,000,000,000,000,000 | 4 |
Minor security fix: Quote output of mkstemp.
* src/builtin.c (mkstemp_helper): Produce quoted output.
* doc/m4.texinfo (Mkstemp): Update the documentation and tests.
* NEWS: Document this change.
Signed-off-by: Eric Blake <[email protected]>
(cherry picked from commit bd9900d65eb9cd5add0f107e94b513fa267495ba)
|
_XimGetInputStyle(
XIMArg *arg,
XIMStyle *input_style)
{
register XIMArg *p;
for (p = arg; p && p->name; p++) {
if (!(strcmp(p->name, XNInputStyle))) {
*input_style = (XIMStyle)p->value;
return True;
}
}
return False;
}
| 0 |
[
"CWE-190"
] |
libx11
|
1a566c9e00e5f35c1f9e7f3d741a02e5170852b2
| 162,854,805,366,679,140,000,000,000,000,000,000,000 | 14 |
Zero out buffers in functions
It looks like uninitialized stack or heap memory can leak
out via padding bytes.
Signed-off-by: Matthieu Herrb <[email protected]>
Reviewed-by: Matthieu Herrb <[email protected]>
|
std_term_source(j_decompress_ptr cinfo)
{
/* No work necessary here */
(void) cinfo;
}
| 0 |
[
"CWE-369"
] |
libtiff
|
47f2fb61a3a64667bce1a8398a8fcb1b348ff122
| 187,114,566,039,931,480,000,000,000,000,000,000,000 | 5 |
* libtiff/tif_jpeg.c: avoid integer division by zero in
JPEGSetupEncode() when horizontal or vertical sampling is set to 0.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2653
|
yaffsfs_istat(TSK_FS_INFO *fs, TSK_FS_ISTAT_FLAG_ENUM flags, FILE * hFile, TSK_INUM_T inum,
TSK_DADDR_T numblock, int32_t sec_skew)
{
TSK_FS_META *fs_meta;
TSK_FS_FILE *fs_file;
YAFFSFS_INFO *yfs = (YAFFSFS_INFO *)fs;
char ls[12];
YAFFSFS_PRINT_ADDR print;
char timeBuf[128];
YaffsCacheObject * obj = NULL;
YaffsCacheVersion * version = NULL;
YaffsHeader * header = NULL;
yaffscache_version_find_by_inode(yfs, inum, &version, &obj);
if ((fs_file = tsk_fs_file_open_meta(fs, NULL, inum)) == NULL) {
return 1;
}
fs_meta = fs_file->meta;
tsk_fprintf(hFile, "inode: %" PRIuINUM "\n", inum);
tsk_fprintf(hFile, "%sAllocated\n",
(fs_meta->flags & TSK_FS_META_FLAG_ALLOC) ? "" : "Not ");
if (fs_meta->link)
tsk_fprintf(hFile, "symbolic link to: %s\n", fs_meta->link);
tsk_fprintf(hFile, "uid / gid: %" PRIuUID " / %" PRIuGID "\n",
fs_meta->uid, fs_meta->gid);
tsk_fs_meta_make_ls(fs_meta, ls, sizeof(ls));
tsk_fprintf(hFile, "mode: %s\n", ls);
tsk_fprintf(hFile, "size: %" PRIdOFF "\n", fs_meta->size);
tsk_fprintf(hFile, "num of links: %d\n", fs_meta->nlink);
if(version != NULL){
yaffsfs_read_header(yfs, &header, version->ycv_header_chunk->ycc_offset);
if(header != NULL){
tsk_fprintf(hFile, "Name: %s\n", header->name);
}
}
if (sec_skew != 0) {
tsk_fprintf(hFile, "\nAdjusted Inode Times:\n");
fs_meta->mtime -= sec_skew;
fs_meta->atime -= sec_skew;
fs_meta->ctime -= sec_skew;
tsk_fprintf(hFile, "Accessed:\t%s\n",
tsk_fs_time_to_str(fs_meta->atime, timeBuf));
tsk_fprintf(hFile, "File Modified:\t%s\n",
tsk_fs_time_to_str(fs_meta->mtime, timeBuf));
tsk_fprintf(hFile, "Inode Modified:\t%s\n",
tsk_fs_time_to_str(fs_meta->ctime, timeBuf));
fs_meta->mtime += sec_skew;
fs_meta->atime += sec_skew;
fs_meta->ctime += sec_skew;
tsk_fprintf(hFile, "\nOriginal Inode Times:\n");
}
else {
tsk_fprintf(hFile, "\nInode Times:\n");
}
tsk_fprintf(hFile, "Accessed:\t%s\n",
tsk_fs_time_to_str(fs_meta->atime, timeBuf));
tsk_fprintf(hFile, "File Modified:\t%s\n",
tsk_fs_time_to_str(fs_meta->mtime, timeBuf));
tsk_fprintf(hFile, "Inode Modified:\t%s\n",
tsk_fs_time_to_str(fs_meta->ctime, timeBuf));
if(version != NULL){
tsk_fprintf(hFile, "\nHeader Chunk:\n");
tsk_fprintf(hFile, "%" PRIuDADDR "\n", (version->ycv_header_chunk->ycc_offset / (yfs->page_size + yfs->spare_size)));
}
if (numblock > 0) {
TSK_OFF_T lower_size = numblock * fs->block_size;
fs_meta->size = (lower_size < fs_meta->size)?(lower_size):(fs_meta->size);
}
tsk_fprintf(hFile, "\nData Chunks:\n");
if (flags & TSK_FS_ISTAT_RUNLIST){
const TSK_FS_ATTR *fs_attr_default =
tsk_fs_file_attr_get_type(fs_file,
TSK_FS_ATTR_TYPE_DEFAULT, 0, 0);
if (fs_attr_default && (fs_attr_default->flags & TSK_FS_ATTR_NONRES)) {
if (tsk_fs_attr_print(fs_attr_default, hFile)) {
tsk_fprintf(hFile, "\nError creating run lists ");
tsk_error_print(hFile);
tsk_error_reset();
}
}
}
else {
print.idx = 0;
print.hFile = hFile;
if (tsk_fs_file_walk(fs_file, TSK_FS_FILE_WALK_FLAG_AONLY,
(TSK_FS_FILE_WALK_CB)print_addr_act, (void *)&print)) {
tsk_fprintf(hFile, "\nError reading file: ");
tsk_error_print(hFile);
tsk_error_reset();
}
else if (print.idx != 0) {
tsk_fprintf(hFile, "\n");
}
}
tsk_fs_file_close(fs_file);
return 0;
}
| 0 |
[
"CWE-125",
"CWE-787"
] |
sleuthkit
|
459ae818fc8dae717549810150de4d191ce158f1
| 172,760,896,741,279,160,000,000,000,000,000,000,000 | 116 |
Fix stack buffer overflow in yaffsfs_istat
Prevent a stack buffer overflow in yaffsfs_istat by increasing the buffer size to the size required by tsk_fs_time_to_str.
|
void OSD::dispatch_session_waiting(Session *session, OSDMapRef osdmap)
{
assert(session->session_dispatch_lock.is_locked());
auto i = session->waiting_on_map.begin();
while (i != session->waiting_on_map.end()) {
OpRequestRef op = &(*i);
assert(ms_can_fast_dispatch(op->get_req()));
const MOSDFastDispatchOp *m = static_cast<const MOSDFastDispatchOp*>(
op->get_req());
if (m->get_min_epoch() > osdmap->get_epoch()) {
break;
}
session->waiting_on_map.erase(i++);
op->put();
spg_t pgid;
if (m->get_type() == CEPH_MSG_OSD_OP) {
pg_t actual_pgid = osdmap->raw_pg_to_pg(
static_cast<const MOSDOp*>(m)->get_pg());
if (!osdmap->get_primary_shard(actual_pgid, &pgid)) {
continue;
}
} else {
pgid = m->get_spg();
}
enqueue_op(pgid, op, m->get_map_epoch());
}
if (session->waiting_on_map.empty()) {
clear_session_waiting_on_map(session);
} else {
register_session_waiting_on_map(session);
}
}
| 0 |
[
"CWE-287",
"CWE-284"
] |
ceph
|
5ead97120e07054d80623dada90a5cc764c28468
| 211,714,128,909,502,300,000,000,000,000,000,000,000 | 35 |
auth/cephx: add authorizer challenge
Allow the accepting side of a connection to reject an initial authorizer
with a random challenge. The connecting side then has to respond with an
updated authorizer proving they are able to decrypt the service's challenge
and that the new authorizer was produced for this specific connection
instance.
The accepting side requires this challenge and response unconditionally
if the client side advertises they have the feature bit. Servers wishing
to require this improved level of authentication simply have to require
the appropriate feature.
Signed-off-by: Sage Weil <[email protected]>
(cherry picked from commit f80b848d3f830eb6dba50123e04385173fa4540b)
# Conflicts:
# src/auth/Auth.h
# src/auth/cephx/CephxProtocol.cc
# src/auth/cephx/CephxProtocol.h
# src/auth/none/AuthNoneProtocol.h
# src/msg/Dispatcher.h
# src/msg/async/AsyncConnection.cc
- const_iterator
- ::decode vs decode
- AsyncConnection ctor arg noise
- get_random_bytes(), not cct->random()
|
int __init acpi_boot_table_init(void)
{
int error;
#ifdef __i386__
dmi_check_system(acpi_dmi_table);
#endif
/*
* If acpi_disabled, bail out
* One exception: acpi=ht continues far enough to enumerate LAPICs
*/
if (acpi_disabled && !acpi_ht)
return 1;
/*
* Initialize the ACPI boot-time table parser.
*/
error = acpi_table_init();
if (error) {
disable_acpi();
return error;
}
acpi_table_parse(ACPI_BOOT, acpi_parse_sbf);
/*
* blacklist may disable ACPI entirely
*/
error = acpi_blacklisted();
if (error) {
if (acpi_force) {
printk(KERN_WARNING PREFIX "acpi=force override\n");
} else {
printk(KERN_WARNING PREFIX "Disabling ACPI support\n");
disable_acpi();
return error;
}
}
return 0;
}
| 0 |
[] |
linux-2.6
|
f0f4c3432e5e1087b3a8c0e6bd4113d3c37497ff
| 81,136,725,570,076,040,000,000,000,000,000,000,000 | 42 |
[PATCH] i386: add HPET(s) into resource map
Add HPET(s) into resource map. This will allow for the HPET(s) to be
visibile within /proc/iomem.
Signed-off-by: Aaron Durbin <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
|
Subsets and Splits
CWE 416 & 19
The query filters records related to specific CWEs (Common Weakness Enumerations), providing a basic overview of entries with these vulnerabilities but without deeper analysis.
CWE Frequency in Train Set
Counts the occurrences of each CWE (Common Weakness Enumeration) in the dataset, providing a basic distribution but limited insight.