code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
/*
* GET mobile config
*/
exports.enrollment = function(req, res){
res.set('Content-Type', 'text/html');
var url = require('url');
var url_parts = url.parse(req.url, true);
var query = url_parts.query;
var tudid = query.udid;
if (tudid) // If it's in the query, store it and redirect (so t... | cwe | CWE-707 | JavaScript |
package com.manydesigns.portofino.dispatcher.security.jwt;
import com.manydesigns.portofino.dispatcher.security.RolesPermission;
import io.jsonwebtoken.Jwt;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.io.Decoders;
import org.apache.commons.configuration2.Configuration... | cwe | CWE-347 | Java |
static void usbredir_handle_interrupt_out_data(USBRedirDevice *dev,
USBPacket *p, uint8_t ep)
{
struct usb_redir_interrupt_packet_header interrupt_packet;
uint8_t buf[p->iov.size];
DPRINTF("interrupt-out ep %02X len %zd id %"PRIu64"\n", ep,
p->iov.... | cwe | CWE-770 | Unknown |
check_user_token (const char *authfile,
const char *username,
const char *otp_id,
int verbose,
FILE *debug_file)
{
char buf[1024];
char *s_user, *s_token;
int retval = AUTH_ERROR;
int fd;
struct stat st;
FILE *opwfile;
fd = open(authfile, O_RDONLY, 0);
if (fd < 0) {
... | cwe | CWE-200 | Unknown |
void operator()(OpKernelContext* context, const Tensor& input_tensor,
Tensor& output_tensor, int n, bool reverse) {
const T* input = input_tensor.flat<T>().data();
T* output = output_tensor.flat<T>().data();
// Assume input_shape is [d1,d2,...dk], and output_shape is [d1,d2...dk-1],
/... | cwe | CWE-703 | Unknown |
this.element.find('table tbody').find('tr').each(function(index, tr) {
// add custom td handlers
var $currentRow = $(tr);
var $expand = null;
if(thisObj.options.expand_callback && thisObj.table){
var allTds = thisObj.table.fnGetTds($currentRow[0]);
var row = [];... | cwe | CWE-79 | JavaScript |
F.createStatusContainer();F.statusContainer.style.position="relative";F.statusContainer.style.maxWidth="";F.statusContainer.style.marginTop="7px";F.statusContainer.style.marginLeft="6px";F.statusContainer.style.color="gray";F.statusContainer.style.cursor="default";var W=F.hideCurrentMenu;F.hideCurrentMenu=function(){W.... | cwe | CWE-20 | JavaScript |
ambsdtar_restore(
application_argument_t *argument)
{
char *cmd;
GPtrArray *argv_ptr = g_ptr_array_new();
int j;
char *include_filename = NULL;
char *exclude_filename = NULL;
int tarpid;
filter_t in_buf;
filter_t out_buf;
filter_t err_b... | cwe | CWE-264 | Unknown |
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* th... | cwe | CWE-22 | Java |
/*
* Copyright © 2015-2018 Aeneas Rekkas <aeneas+oss@aeneas.io>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required... | cwe | CWE-755 | Go |
bool Virtual_column_info::fix_and_check_expr(THD *thd, TABLE *table)
{
DBUG_ENTER("fix_and_check_vcol_expr");
DBUG_PRINT("info", ("vcol: %p", this));
DBUG_ASSERT(expr);
if (expr->fixed)
DBUG_RETURN(0); // nothing to do
if (fix_expr(thd))
DBUG_RETURN(1);
if (flags)
DBUG_RETURN(0); // already c... | cwe | CWE-416 | Unknown |
package cluster
import (
"net/url"
"time"
"context"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/client-go/kubernetes"
... | cwe | CWE-863 | Go |
int verify_compat_iovec(struct msghdr *kern_msg, struct iovec *kern_iov,
struct sockaddr_storage *kern_address, int mode)
{
int tot_len;
if (kern_msg->msg_namelen) {
if (mode == VERIFY_READ) {
int err = move_addr_to_kernel(kern_msg->msg_name,
kern_msg->msg_namelen,
kern_address);
... | cwe | CWE-20 | C/C++ |
# -*- coding: utf-8 -*-
# Copyright 2015 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | cwe | CWE-400 | Python |
int64_t TensorByteSize(const TensorProto& t) {
// num_elements returns -1 if shape is not fully defined.
int64_t num_elems = TensorShape(t.tensor_shape()).num_elements();
return num_elems < 0 ? -1 : num_elems * DataTypeSize(t.dtype());
} | cwe | CWE-617 | C/C++ |
static void trim_marked(struct audit_tree *tree)
{
struct list_head *p, *q;
spin_lock(&hash_lock);
if (tree->goner) {
spin_unlock(&hash_lock);
return;
}
/* reorder */
for (p = tree->chunks.next; p != &tree->chunks; p = q) {
struct node *node = list_entry(p, struct node, list);
q = p->next;
if (node->ind... | cwe | CWE-362 | Unknown |
# -*- coding: utf-8 -*-
# rdiffweb, A web interface to rdiff-backup repositories
# Copyright (C) 2012-2021 rdiffweb contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version ... | cwe | CWE-770 | Python |
#include "AppHdr.h"
#include "clua.h"
#include <algorithm>
#include "cluautil.h"
#include "dlua.h"
#include "end.h"
#include "files.h"
#include "libutil.h"
#include "l-libs.h"
#include "maybe-bool.h"
#include "misc.h" // erase_val
#include "options.h"
#include "state.h"
#include "stringutil.h"
#include "syscalls.h"
... | cwe | CWE-434 | C/C++ |
// Load modules
var Fs = require('fs');
var Path = require('path');
var Boom = require('boom');
var Hoek = require('hoek');
var Items = require('items');
var Joi = require('joi');
var File = require('./file');
// Declare internals
var internals = {};
internals.schema = Joi.object({
path: Joi.alternatives(Joi.... | cwe | CWE-22 | JavaScript |
/* radare2 - LGPL - Copyright 2016-2017 - Davis, Alex Kornitzer */
#include <r_util.h>
#include "mdmp.h"
ut64 r_bin_mdmp_get_paddr(struct r_bin_mdmp_obj *obj, ut64 vaddr) {
/* FIXME: Will only resolve exact matches, probably no need to fix as
** this function will become redundant on the optimisation stage */
str... | cwe | CWE-119 | C/C++ |
def handle_file(u: Profile, headline: str, category: str, text: str, file):
m: Media = Media()
upload_base_path: str = 'uploads/' + str(date.today().year)
high_res_file_name = upload_base_path + '/HIGHRES_' + ntpath.basename(file.name.replace(" ", "_"))
low_res_file_name = upload_base_path + '/LOWRES_' ... | cwe | CWE-79 | Python |
static void fpm_resources_discard(struct fpm_child_s *child) /* {{{ */
{
fpm_scoreboard_proc_free(child->wp->scoreboard, child->scoreboard_i);
fpm_stdio_discard_pipes(child);
fpm_child_free(child);
} | cwe | CWE-787 | Unknown |
xps_decode_font_char_imp(xps_font_t *font, int code)
{
byte *table;
/* no cmap selected: return identity */
if (font->cmapsubtable <= 0)
return code;
table = font->data + font->cmapsubtable;
switch (u16(table))
{
case 0: /* Apple standard 1-to-1 mapping. */
{
... | cwe | CWE-125 | Unknown |
int wsrep_sst_donate(const std::string &msg, const wsrep::gtid ¤t_gtid,
const bool bypass) {
/* This will be reset when sync callback is called.
* Should we set wsrep_ready to false here too? */
local_status.set(wsrep::server_state::s_donor);
const char *method = msg.data();
size_... | cwe | CWE-77 | C/C++ |
setup_secureChannel(void) {
TestingPolicy(&dummyPolicy, dummyCertificate, &fCalled, &keySizes);
UA_SecureChannel_init(&testChannel, &UA_ConnectionConfig_default);
UA_SecureChannel_setSecurityPolicy(&testChannel, &dummyPolicy, &dummyCertificate);
testingConnection = createDummyConnection(65535, &sentDat... | cwe | CWE-703 | C/C++ |
static int huft_build(const unsigned *b, const unsigned n,
const unsigned s, const unsigned short *d,
const unsigned char *e, huft_t **t, unsigned *m)
{
unsigned a; /* counter for codes of length k */
unsigned c[BMAX + 1]; /* bit length count table */
unsigned eob_len; /* length of end-of-b... | cwe | CWE-476 | Unknown |
def mark_all_as_read(request):
(TopicNotification.objects
.for_access(request.user)
.filter(is_read=False)
.update(is_read=True))
return redirect(request.POST.get(
'next', reverse('spirit:topic:notification:index'))) | cwe | CWE-601 | Python |
package server
import (
"context"
"errors"
"fmt"
"sort"
"sync"
"time"
"github.com/ipfs/go-cid"
blockstore "github.com/ipfs/go-ipfs-blockstore"
"github.com/ipfs/go-libipfs/bitswap/internal/defaults"
"github.com/ipfs/go-libipfs/bitswap/message"
pb "github.com/ipfs/go-libipfs/bitswap/message/pb"
bmetrics "gi... | cwe | CWE-400 | Go |
void Compute(OpKernelContext* ctx) override {
const Tensor& a = ctx->input(0);
const Tensor& b = ctx->input(1);
OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(a.shape()),
errors::InvalidArgument("a is not a matrix"));
OP_REQUIRES(ctx, TensorShapeUtils::IsMatrix(b.shape()),
e... | cwe | CWE-125 | C/C++ |
function sendTestEmail() {
var headers = [];
$.each($("#headersTable").DataTable().rows().data(), function (i, header) {
headers.push({
key: unescapeHtml(header[0]),
value: unescapeHtml(header[1]),
})
})
var test_email_request = {
template: {},
fir... | cwe | CWE-79 | JavaScript |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
TF_LITE_ENSURE_... | cwe | CWE-125 | C/C++ |
mrb_class_real(struct RClass* cl)
{
if (cl == 0)
return NULL;
while ((cl->tt == MRB_TT_SCLASS) || (cl->tt == MRB_TT_ICLASS)) {
cl = cl->super;
}
return cl;
} | cwe | CWE-476 | C/C++ |
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/ory/fosite (interfaces: AccessResponder)
// Package internal is a generated GoMock package.
package internal
import (
reflect "reflect"
time "time"
gomock "github.com/golang/mock/gomock"
fosite "github.com/ory/fosite"
)
// MockAccessResponder is ... | cwe | CWE-345 | Go |
for(ca=la=0;ca<ta.length;ca++)if(0<ta[ca].length){ka=ra[ta[ca]];var La={};Ja=[];if(null!=ka)for(qa=0;qa<ka.length;qa++)na=ka[qa],0==la==(null==aa[na.url])&&(La[na.url]=!0,Ja.push(na));aa=La;la++}0==Ja.length?ha.innerHTML=mxResources.get("noResultsFor",[ia]):B(Ja,!0)}}function H(ia){if(ba!=ia||P!=da)A(),Aa.scrollTop=0,e... | cwe | CWE-94 | JavaScript |
int gg_change_status_descr(struct gg_session *sess, int status, const char *descr)
{
struct gg_new_status80 p;
char *gen_descr = NULL;
int descr_len = 0;
int res;
gg_debug_session(sess, GG_DEBUG_FUNCTION, "** gg_change_status_descr(%p, %d, \"%s\");\n", sess, status, descr);
if (!sess) {
errno = EFAULT;
retu... | cwe | CWE-310 | C/C++ |
send(data, allDevices) {
let coreData = data.data;
let expirationTime = data['expiration_time'] || coreData['expiration_time'];
let collapseId = data['collapse_id'] || coreData['collapse_id'];
let pushType = data['push_type'] || coreData['push_type'];
let priority = data['priority'] || coreData['pri... | cwe | CWE-20 | JavaScript |
void ScriptLoader::executeScript(const ScriptSourceCode& sourceCode)
{
ASSERT(m_alreadyStarted);
if (sourceCode.isEmpty())
return;
RefPtr<Document> elementDocument(m_element->document());
RefPtr<Document> contextDocument = elementDocument->contextDocument().get();
if (!contextDocument)
... | cwe | CWE-362 | C/C++ |
pub async fn run(&mut self) -> TResult<()> {
loop {
// Take the permit first, but we won't use it right now
// that's why we will forget it
self.base.climit.acquire().await.unwrap().forget();
let stream = self.accept().await?;
let mut chandle = Connect... | cwe | CWE-252 | Rust |
void sock_init_data(struct socket *sock, struct sock *sk)
{
skb_queue_head_init(&sk->sk_receive_queue);
skb_queue_head_init(&sk->sk_write_queue);
skb_queue_head_init(&sk->sk_error_queue);
#ifdef CONFIG_NET_DMA
skb_queue_head_init(&sk->sk_async_wait_queue);
#endif
sk->sk_send_head = NULL;
init_timer(&sk->sk_time... | cwe | CWE-400 | Unknown |
bmexec_trans (kwset_t kwset, char const *text, size_t size)
{
unsigned char const *d1;
char const *ep, *sp, *tp;
int d;
int len = kwset->mind;
char const *trans = kwset->trans;
if (len == 0)
return 0;
if (len > size)
return -1;
if (len == 1)
{
tp = memchr_kwset (text, size, kwset);
... | cwe | CWE-119 | Unknown |
void usb_serial_console_disconnect(struct usb_serial *serial)
{
if (serial->port[0] == usbcons_info.port) {
usb_serial_console_exit();
usb_serial_put(serial);
}
} | cwe | CWE-416 | C/C++ |
/*
* Unsquash a squashfs filesystem. This is a highly compressed read only
* filesystem.
*
* Copyright (c) 2009, 2010, 2011, 2012, 2019, 2021
* Phillip Lougher <phillip@squashfs.org.uk>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public Licen... | cwe | CWE-22 | C/C++ |
l2tp_result_code_print(netdissect_options *ndo, const u_char *dat, u_int length)
{
const uint16_t *ptr = (const uint16_t *)dat;
ND_PRINT((ndo, "%u", EXTRACT_16BITS(ptr))); ptr++; /* Result Code */
if (length > 2) { /* Error Code (opt) */
ND_PRINT((ndo, "/%u", EXTRACT_16BITS(ptr))); ptr++;
}
if (length... | cwe | CWE-125 | C/C++ |
function init(self, obj, doc, opts, prefix) {
prefix = prefix || '';
if (obj.$__ != null) {
obj = obj._doc;
}
const keys = Object.keys(obj);
const len = keys.length;
let schemaType;
let path;
let i;
let index = 0;
const strict = self.$__.strictMode;
const docSchema = self.$__schema;
while ... | cwe | CWE-1321 | JavaScript |
static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{
#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST)
struct snd_sof_dfsentry *dfse = file->private_data;
struct snd_sof_dev *sdev = dfse->sdev;
unsigned long ipc_duration_ms = 0;
bool flood_duratio... | cwe | CWE-401 | C/C++ |
def addTags(tag_list, listing_id):
"""
Adds a list of tags tag_list for a given listing with listing_id to the database
"""
cur = conn.cursor()
for x in tag_list:
sql = "INSERT INTO {} VALUES {}".format(listing_tags_table_name, str((listing_id, x)))
cur.execute(sql) | cwe | CWE-89 | Python |
static int ocsp_verify_signer(X509 *signer, int response,
X509_STORE *st, unsigned long flags,
STACK_OF(X509) *untrusted, STACK_OF(X509) **chain)
{
X509_STORE_CTX *ctx = X509_STORE_CTX_new();
X509_VERIFY_PARAM *vp;
int ret = -1;
if (ctx == NUL... | cwe | CWE-703 | Unknown |
int main (int argc, char **argv) {
int result;
struct mt_packet data;
struct sockaddr_in si_me;
unsigned char buff[1500];
unsigned char print_help = 0, have_username = 0, have_password = 0;
unsigned char drop_priv = 0;
int c;
int optval = 1;
setlocale(LC_ALL, "");
bindtextdomain("mactelnet","/usr/share/local... | cwe | CWE-119 | C/C++ |
// SPDX-License-Identifier: GPL-2.0
/*
* EFI capsule loader driver.
*
* Copyright 2015 Intel Corporation
*/
#define pr_fmt(fmt) "efi: " fmt
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/miscdevice.h>
#include <linux/highmem.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/mut... | cwe | CWE-416 | C/C++ |
const uploader = multer({ dest: path.join(__dirname, '.upload'), limits: { fileSize: 1024 ** 3 }, ...options.multer }).any()
app.get(`${basePath}/`, [
hooks0.onRequest,
ctrlHooks0.onRequest,
createValidateHandler(req => [
Object.keys(req.query).length ? validateOrReject(Object.assign(new Validators... | cwe | CWE-20 | JavaScript |
/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unl... | cwe | CWE-22 | Java |
int remap_struct(unsigned int gtypes_nr[], unsigned int ftypes_nr[],
void *ps, unsigned int f_size, unsigned int g_size, size_t b_size)
{
int d;
size_t n;
/* Sanity check */
if (MAP_SIZE(ftypes_nr) > f_size)
return -1;
/* Remap [unsigned] long fields */
d = gtypes_nr[0] - ftypes_nr[0];
if (d) {
n = MINI... | cwe | CWE-787 | C/C++ |
int config__parse_args(struct mosquitto_db *db, struct mosquitto__config *config, int argc, char *argv[])
{
int i;
int port_tmp;
for(i=1; i<argc; i++){
if(!strcmp(argv[i], "-c") || !strcmp(argv[i], "--config-file")){
if(i<argc-1){
db->config_file = argv[i+1];
if(config__read(db, config, false)){
... | cwe | CWE-200 | C/C++ |
proc_lambda(mrb_state *mrb, mrb_value self)
{
mrb_value blk;
struct RProc *p;
mrb_get_args(mrb, "&", &blk);
if (mrb_nil_p(blk)) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "tried to create Proc object without a block");
}
if (!mrb_proc_p(blk)) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "not a proc");
}
p = mrb_... | cwe | CWE-476 | Unknown |
_PUBLIC_ char *strupper_talloc_n_handle(struct smb_iconv_handle *iconv_handle,
TALLOC_CTX *ctx, const char *src, size_t n)
{
size_t size=0;
char *dest;
if (!src) {
return NULL;
}
/* this takes advantage of the fact that upper/lower can't
change the length of a character by more than 1 byte */
dest = ... | cwe | CWE-200 | Unknown |
int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len)
{
struct super_block *sb = inode->i_sb;
handle_t *handle;
struct ext4_ext_path *path;
struct ext4_extent *extent;
ext4_lblk_t offset_lblk, len_lblk, ee_start_lblk = 0;
unsigned int credits, ee_len;
int ret = 0, depth, split_flag = 0;
loff_t i... | cwe | CWE-362 | Unknown |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-787 | C/C++ |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
auto* params =
reinterpret_cast<TfLiteSpaceToDepthParams*>(node->builtin_data);
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
#define TF_LITE_SPACE_TO_DEPTH(ty... | cwe | CWE-125 | C/C++ |
static Image *ReadOneJNGImage(MngInfo *mng_info,
const ImageInfo *image_info, ExceptionInfo *exception)
{
Image
*alpha_image,
*color_image,
*image,
*jng_image;
ImageInfo
*alpha_image_info,
*color_image_info;
MagickBooleanType
logging;
int
unique_filenames;
ssize_t
y... | cwe | CWE-772 | Unknown |
OMX_ERRORTYPE SoftAVC::internalSetParameter(OMX_INDEXTYPE index, const OMX_PTR params) {
int32_t indexFull = index;
switch (indexFull) {
case OMX_IndexParamVideoBitrate:
{
return internalSetBitrateParams(
(const OMX_VIDEO_PARAM_BITRATETYPE *)params);
}
... | cwe | CWE-119 | C/C++ |
find(id, callback) {
pg.connect(this.connectionUri, function (err, client, done) {
if (err) {
return console.error('Could not connect to postgres', err);
done(client);
}
client.query('select id, term, tags, definition from terms where id = $1;... | cwe | CWE-79 | JavaScript |
from flask import current_app, request
from flask_restful import Resource, abort
from dns import reversename, rdatatype
from dns.resolver import NXDOMAIN, NoNameservers
from resolverapi.util import is_valid_hostname, is_valid_rdtype, is_valid_ip
from resolverapi.util.dns_query import parse_query
from resolverapi impor... | cwe | CWE-116 | Python |
package com.salesmanager.shop.admin.controller.products;
import com.salesmanager.core.business.services.catalog.product.ProductService;
import com.salesmanager.core.business.services.catalog.product.file.DigitalProductService;
import com.salesmanager.core.business.utils.ajax.AjaxResponse;
import com.salesmanager.core.... | cwe | CWE-639 | Java |
main(int argc, char *argv[])
{
int i, c;
FILE *ifp = 0, *ofp = 0;
const char *ifp_filename = "<stdin>";
const char *ofp_filename = "<stdout>";
const char *set_font_name = 0;
struct font_reader fr;
uint32_t rfork_len;
int raw = 0, macbinary = 1, applesingle = 0, appledouble = 0, binhex = 0;
Clp_Parser... | cwe | CWE-787 | Unknown |
$user = db_fetch_cell_prepared('SELECT username FROM user_auth WHERE id = ?', array($check['user']), 'username');
form_alternate_row('line' . $check['id']);
$name = get_data_source_title($check['datasource']);
$title = $name;
if (strlen($name) > 50) {
$name = substr($name, 0, 50);
}
form_selectabl... | cwe | CWE-79 | PHP |
int yr_execute_code(
YR_RULES* rules,
YR_SCAN_CONTEXT* context,
int timeout,
time_t start_time)
{
int64_t mem[MEM_SIZE];
int32_t sp = 0;
uint8_t* ip = rules->code_start;
YR_VALUE args[MAX_FUNCTION_ARGS];
YR_VALUE *stack;
YR_VALUE r1;
YR_VALUE r2;
YR_VALUE r3;
#ifdef PROFILING_ENABLED... | cwe | CWE-416 | Unknown |
/*
* Copyright (c) 2004-2021, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of cond... | cwe | CWE-89 | Java |
sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
{
void __user *p = (void __user *)arg;
int __user *ip = p;
int result, val, read_only;
Sg_device *sdp;
Sg_fd *sfp;
Sg_request *srp;
unsigned long iflags;
if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp)))
return -ENXIO;... | cwe | CWE-200 | C/C++ |
static void credential_write_item(FILE *fp, const char *key, const char *value)
{
if (!value)
return;
fprintf(fp, "%s=%s\n", key, value);
} | cwe | CWE-61 | C/C++ |
FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, unsigned predictor_order, unsigned partition_order, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, FLAC__int32 *residual, FLAC__bool is_extended)
{
FLAC__uint32 rice_parameter;
int i;
unsigned partition, sample, u... | cwe | CWE-119 | Unknown |
package org.mozilla.jss.nss;
import java.lang.IllegalArgumentException;
import java.util.ArrayList;
import org.mozilla.jss.crypto.X509Certificate;
import org.mozilla.jss.pkcs11.PK11Cert;
import org.mozilla.jss.ssl.SSLAlertEvent;
import org.mozilla.jss.util.GlobalRefProxy;
public class SSLFDProxy extends PRFDProxy {
... | cwe | CWE-401 | Java |
static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream,
unsigned char __user *userbuf,
unsigned char *kernelbuf, long count)
{
unsigned long flags;
long result = 0, count1;
struct snd_rawmidi_runtime *runtime = substream->runtime;
unsigned long appl_ptr;
spin_lock_irqsave(&... | cwe | CWE-416 | Unknown |
int ext4_da_write_inline_data_begin(struct address_space *mapping,
struct inode *inode,
loff_t pos, unsigned len,
unsigned flags,
struct page **pagep,
void **fsdata)
{
int ret, inline_size;
handle_t *handle;
struct page *page;
struct ext4_iloc iloc;
int retries;
ret = ext4... | cwe | CWE-787 | Unknown |
import operator
from functools import partial
from typing import TYPE_CHECKING, Any, Dict, Iterable, Optional, Tuple
from pypika import Table
from pypika.functions import Upper
from pypika.terms import BasicCriterion, Criterion, Equality, Term, ValueWrapper
from tortoise.fields import Field
from tortoise.fields.relat... | cwe | CWE-89 | Python |
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/* Copyright (C) 2017-2018 Netronome Systems, Inc. */
#include <linux/etherdevice.h>
#include <linux/lockdep.h>
#include <linux/pci.h>
#include <linux/skbuff.h>
#include <linux/vmalloc.h>
#include <net/devlink.h>
#include <net/dst_metadata.h>
#include "main.h... | cwe | CWE-401 | C/C++ |
tt_cmap12_validate( FT_Byte* table,
FT_Validator valid )
{
FT_Byte* p;
FT_ULong length;
FT_ULong num_groups;
if ( table + 16 > valid->limit )
FT_INVALID_TOO_SHORT;
p = table + 4;
length = TT_NEXT_ULONG( p );
p = table + 12;
p ... | cwe | CWE-190 | C/C++ |
const BlockEntry* Cues::GetBlock(
const CuePoint* pCP,
const CuePoint::TrackPosition* pTP) const
{
if (pCP == NULL)
return NULL;
if (pTP == NULL)
return NULL;
return m_pSegment->GetBlock(*pCP, *pTP);
} | cwe | CWE-119 | C/C++ |
int nfc_dev_down(struct nfc_dev *dev)
{
int rc = 0;
pr_debug("dev_name=%s\n", dev_name(&dev->dev));
device_lock(&dev->dev);
if (!device_is_registered(&dev->dev)) {
rc = -ENODEV;
goto error;
}
if (!dev->dev_up) {
rc = -EALREADY;
goto error;
}
if (dev->polling || dev->active_target) {
rc = -EBUSY;
... | cwe | CWE-416 | Unknown |
TEE_Result tee_mmu_check_access_rights(const struct user_ta_ctx *utc,
uint32_t flags, uaddr_t uaddr,
size_t len)
{
uaddr_t a;
size_t addr_incr = MIN(CORE_MMU_USER_CODE_SIZE,
CORE_MMU_USER_PARAM_SIZE);
if (ADD_OVERFLOW(uaddr, len, &a))
return TEE_ERROR_ACCESS_DENIED;
if (... | cwe | CWE-20 | C/C++ |
process_tgs_req(krb5_kdc_req *request, krb5_data *pkt,
const krb5_fulladdr *from, kdc_realm_t *kdc_active_realm,
krb5_data **response)
{
krb5_keyblock * subkey = 0;
krb5_keyblock *header_key = NULL;
krb5_keyblock *stkt_server_key = NULL;
krb5_keyblock *subject_key;
kr... | cwe | CWE-476 | C/C++ |
package provenance
import (
"sort"
distreference "github.com/docker/distribution/reference"
"github.com/moby/buildkit/solver/result"
digest "github.com/opencontainers/go-digest"
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
)
type Result = result.Result[*Capture]
type ImageSource struct {
Ref ... | cwe | CWE-200 | Go |
function addGroup($data) {
if($data['editgroupid'] == 0 || $data['editgroupid'] == '')
$data['editgroupid'] = 'NULL';
if($data['type'] == "user") {
if(! array_key_exists('custom', $data))
$data['custom'] = 1;
elseif($data['custom'] == 0) {
$ownerid = 'NULL';
$data['editgroupid'] = 'NULL';
}
if($dat... | cwe | CWE-264 | PHP |
unsigned int X509v3_addr_get_afi(const IPAddressFamily *f)
{
return ((f != NULL &&
f->addressFamily != NULL && f->addressFamily->data != NULL)
? ((f->addressFamily->data[0] << 8) | (f->addressFamily->data[1]))
: 0);
} | cwe | CWE-119 | Unknown |
/* radare - LGPL - Copyright 2010-2018 - pancake */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <r_util.h>
#include "armass16_const.h"
// TODO: only lo registers accessible in thumb arm
typedef struct {
ut64 off;
ut32 o;
char op[128];
char opstr[128];
char *a[16]; /* o... | cwe | CWE-125 | C/C++ |
# -*- coding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404
from django.shortcuts import redirect
from django.views.decorators.http import require_POST
from django.contrib import messages
from .models import TopicFavorite
from .forms import Favorite... | cwe | CWE-601 | Python |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2018 New Vector Ltd
# Copyright 2019 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
... | cwe | CWE-400 | Python |
static bool reconstruct_chained_fixup(struct MACH0_(obj_t) *bin) {
if (!bin->dyld_info) {
return false;
}
if (!bin->nsegs) {
return false;
}
bin->chained_starts = R_NEWS0 (struct r_dyld_chained_starts_in_segment *, bin->nsegs);
if (!bin->chained_starts) {
return false;
}
size_t wordsize = get_word_size (b... | cwe | CWE-787 | Unknown |
void BufferQueueConsumer::dump(String8& result, const char* prefix) const {
const IPCThreadState* ipc = IPCThreadState::self();
const pid_t pid = ipc->getCallingPid();
const uid_t uid = ipc->getCallingUid();
if ((uid != AID_SHELL)
&& !PermissionCache::checkPermission(String16(
"android.permission.DUM... | cwe | CWE-264 | Unknown |
virtual status_t configureVideoTunnelMode(
node_id node, OMX_U32 portIndex, OMX_BOOL tunneled,
OMX_U32 audioHwSync, native_handle_t **sidebandHandle ) {
Parcel data, reply;
data.writeInterfaceToken(IOMX::getInterfaceDescriptor());
data.writeInt32((int32_t)node);
data.wri... | cwe | CWE-264 | C/C++ |
olsr_print(netdissect_options *ndo,
const u_char *pptr, u_int length, int is_ipv6)
{
union {
const struct olsr_common *common;
const struct olsr_msg4 *msg4;
const struct olsr_msg6 *msg6;
const struct olsr_hello *hello;
const struct olsr_hello_link *hello_link;
... | cwe | CWE-125 | C/C++ |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
// TODO(b/137042749): TFLite infrastructure (converter, delegate) doesn't
// fully support 0-output ops yet. Currently it works if we manually crfat
// a TFLite graph that contains variable ops. Note... | cwe | CWE-787 | C/C++ |
GF_Err gp_rtp_builder_do_hevc(GP_RTPPacketizer *builder, u8 *nalu, u32 nalu_size, u8 IsAUEnd, u32 FullAUSize)
{
u32 do_flush, bytesLeft, size;
do_flush = 0;
if (!nalu) do_flush = 1;
else if (builder->sl_header.accessUnitStartFlag) do_flush = 1;
/*we must NOT fragment a NALU*/
else if (builder->bytesInPacket + na... | cwe | CWE-787 | Unknown |
int flb_gzip_compress(void *in_data, size_t in_len,
void **out_data, size_t *out_len)
{
int flush;
int status;
int footer_start;
uint8_t *pb;
size_t out_size;
void *out_buf;
z_stream strm;
mz_ulong crc;
out_size = in_len + 32;
out_buf = flb_malloc(out_size)... | cwe | CWE-787 | C/C++ |
bool dwgReader18::parseDataPage(const dwgSectionInfo &si/*, duint8 *dData*/){
DRW_DBG("\nparseDataPage\n ");
objData.reset( new duint8 [si.pageCount * si.maxSize] );
for (auto it=si.pages.begin(); it!=si.pages.end(); ++it){
dwgPageInfo pi = it->second;
if (!fileBuf->setPosition(pi.address))... | cwe | CWE-191 | Unknown |
_libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
size_t datalen, int macstate)
{
int rc = 0;
char *message = NULL;
char *language = NULL;
size_t message_len = 0;
size_t language_len = 0;
LIBSSH2_CHANNEL *channelp = NULL;
size_t data_head = 0;
unsign... | cwe | CWE-703 | C/C++ |
e1000_send_packet(E1000State *s, const uint8_t *buf, int size)
{
static const int PTCregs[6] = { PTC64, PTC127, PTC255, PTC511,
PTC1023, PTC1522 };
NetClientState *nc = qemu_get_queue(s->nic);
if (s->phy_reg[PHY_CTRL] & MII_CR_LOOPBACK) {
nc->info->receive(nc, bu... | cwe | CWE-835 | C/C++ |
send_results(struct iperf_test *test)
{
int r = 0;
cJSON *j;
cJSON *j_streams;
struct iperf_stream *sp;
cJSON *j_stream;
int sender_has_retransmits;
iperf_size_t bytes_transferred;
int retransmits;
j = cJSON_CreateObject();
if (j == NULL) {
i_errno = IEPACKAGERESULTS;
r = -1;
... | cwe | CWE-787 | Unknown |
String UTF16BEDecoder::to_utf8(const StringView& input)
{
StringBuilder builder(input.length() / 2);
for (size_t i = 0; i < input.length(); i += 2) {
u16 code_point = (input[i] << 8) | input[i + 1];
builder.append_code_point(code_point);
}
return builder.to_string();
} | cwe | CWE-120 | C/C++ |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-20 | C/C++ |
webSocketsHandshake(rfbClientPtr cl, char *scheme)
{
char *buf, *response, *line;
int n, linestart = 0, len = 0, llen, base64 = TRUE;
char prefix[5], trailer[17];
char *path = NULL, *host = NULL, *origin = NULL, *protocol = NULL;
char *key1 = NULL, *key2 = NULL, *key3 = NULL;
char *sec_ws_origin... | cwe | CWE-787 | Unknown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.