code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
/* @flow */
/* eslint max-len: 0 */
const messages = {
upToDate: 'Already up-to-date.',
folderInSync: 'Folder in sync.',
nothingToInstall: 'Nothing to install.',
resolvingPackages: 'Resolving packages',
checkingManifest: 'Validating package.json',
fetchingPackages: 'Fetching packages',
linkingDependencie... | cwe | CWE-59 | JavaScript |
static int m88rs2000_frontend_attach(struct dvb_usb_adapter *d)
{
u8 obuf[] = { 0x51 };
u8 ibuf[] = { 0 };
if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
err("command 0x51 transfer failed.");
d->fe_adap[0].fe = dvb_attach(m88rs2000_attach, &s421_m88rs2000_config,
&d->dev->i2c_adap);
if (d-... | cwe | CWE-119 | C/C++ |
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/nearby_sharing/sharesheet/nearby_share_action.h"
#include <memory>
#include <vector>
#include "base/files/file_path.h"
#include... | cwe | CWE-416 | C/C++ |
"""Validators module."""
import re
def valid_regex(regex):
"""Check if string is a valid regular expression."""
if regex is None:
return True, None, None
try:
compiled_regex = re.compile(regex)
except re.error as regex_err:
err = "Invalid regex: " + regex_err.msg + "."
... | cwe | CWE-290 | Python |
wolfssl_connect_step3(struct Curl_easy *data, struct connectdata *conn,
int sockindex)
{
CURLcode result = CURLE_OK;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
struct ssl_backend_data *backend = connssl->backend;
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
if... | cwe | CWE-290 | Unknown |
public function validate($value, $isUserFormat = false)
{
if (empty($value)) {
return;
}
if (\is_string($value)) {
$value = \App\Json::decode($value);
}
if (!\is_array($value)) {
throw new \App\Exceptions\Security('ERR_ILLEGAL_FIELD_VALUE||' . $this->getFieldModel()->getFieldName() . '||' . $this->g... | cwe | CWE-20 | PHP |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import os
import sys
import re
try:
import pwd
import grp
except ImportError:
# don't expect to have this on windows :)
pwd = grp = None
import stat
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we h... | cwe | CWE-306 | Python |
/** @file opf.c
* @brief Functions for handling OPF structures
*
* Copyright (c) 2020 Bartek Fabiszewski
* http://www.fabiszewski.net
*
* This file is part of libmobi.
* Licensed under LGPL, either version 3, or any later.
* See <http://www.gnu.org/licenses/>
*/
#define _GNU_SOURCE 1
#ifndef __USE_BSD
#defin... | cwe | CWE-476 | C/C++ |
/*
* Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy,... | cwe | CWE-287 | Java |
static void update_blocked_averages(int cpu)
{
struct rq *rq = cpu_rq(cpu);
struct cfs_rq *cfs_rq, *pos;
const struct sched_class *curr_class;
struct rq_flags rf;
bool done = true;
rq_lock_irqsave(rq, &rf);
update_rq_clock(rq);
/*
* Iterates the task_group tree in a bottom up fashion, see
* list_ad... | cwe | CWE-400 | C/C++ |
function forEach(obj, iterator, context) {
var key, length;
if (obj) {
if (isFunction(obj)) {
for (key in obj) {
if (key !== 'prototype' && key !== 'length' && key !== 'name' && obj.hasOwnProperty(key)) {
iterator.call(context, obj[key], key, obj);
}
}
} else if (isArra... | cwe | CWE-74 | JavaScript |
xfs_attr_shortform_to_leaf(
struct xfs_da_args *args,
struct xfs_buf **leaf_bp)
{
xfs_inode_t *dp;
xfs_attr_shortform_t *sf;
xfs_attr_sf_entry_t *sfe;
xfs_da_args_t nargs;
char *tmpbuffer;
int error, i, size;
xfs_dablk_t blkno;
struct xfs_buf *bp;
xfs_ifork_t *ifp;
trace_xfs_attr_sf_to_leaf(args);
dp = ... | cwe | CWE-476 | C/C++ |
""" html parser to clean up incoming text from unknown sources """
from html.parser import HTMLParser
class InputHtmlParser(HTMLParser): # pylint: disable=abstract-method
"""Removes any html that isn't allowed_tagsed from a block"""
def __init__(self):
HTMLParser.__init__(self)
self.allowed_... | cwe | CWE-79 | Python |
int Lua::handle_script_request(struct mg_connection *conn,
const struct mg_request_info *request_info,
char *script_path) {
char buf[64], key[64], ifname[MAX_INTERFACE_NAME_LEN];
char *_cookies, user[64] = { '\0' }, outbuf[FILENAME_MAX];
AddressTree ptree;
int rc;
if(!L) return(-1);
lu... | cwe | CWE-352 | C/C++ |
void Compute(OpKernelContext* context) override {
const Tensor& logits_in = context->input(0);
const Tensor& labels_in = context->input(1);
TensorShape shape_in = logits_in.shape();
BCast bcast(BCast::FromShape(logits_in.shape()),
BCast::FromShape(labels_in.shape()));
if (!logits_i... | cwe | CWE-354 | C/C++ |
import { mainPage } from "../../support/page_objects/mainPage";
import {
isTestSuiteActive,
isXcdb,
getProjectString,
isPostgres,
} from "../../support/page_objects/projectConstants";
export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${api... | cwe | CWE-918 | JavaScript |
App.main=function(b,f){function l(k){mxUtils.getAll("1"!=urlParams.dev?[k]:[k,STYLE_PATH+"/default.xml"],function(m){function q(){var n=null!=f?f():new App(new Editor("0"==urlParams.chrome||"min"==uiTheme,null,null,null,"0"!=urlParams.chrome));if(null!=window.mxscript){if("function"===typeof window.DropboxClient&&null=... | cwe | CWE-20 | JavaScript |
static MemTxResult address_space_write_continue(AddressSpace *as, hwaddr addr,
MemTxAttrs attrs,
const uint8_t *buf,
int len, hwaddr addr1,
... | cwe | CWE-125 | Unknown |
null!=na){ca=ia.getAttribute("section");aa=ia.getAttribute("subsection");if(null==ca&&(la=na.indexOf("/"),ca=na.substring(0,la),null==aa)){var qa=na.indexOf("/",la+1);-1<qa&&(aa=na.substring(la+1,qa))}la=ya[ca];null==la&&(xa++,la=[],ya[ca]=la);na=ia.getAttribute("clibs");null!=ra[na]&&(na=ra[na]);na={url:ia.getAttribut... | cwe | CWE-94 | JavaScript |
DSA_Signature_Operation::raw_sign(const uint8_t msg[], size_t msg_len,
RandomNumberGenerator& rng)
{
const BigInt& q = m_group.get_q();
BigInt i(msg, msg_len, q.bits());
while(i >= q)
i -= q;
#if defined(BOTAN_HAS_RFC6979_GENERATOR)
BOTAN_UNUSED(rng);
const B... | cwe | CWE-200 | C/C++ |
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/ory/fosite/handler/oauth2 (interfaces: AccessTokenStrategy)
// Package internal is a generated GoMock package.
package internal
import (
context "context"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
fosite "github.com/ory/fosite"
)
/... | cwe | CWE-345 | Go |
int _mkp_stage_30(struct plugin *p,
struct client_session *cs,
struct session_request *sr)
{
mk_ptr_t referer;
(void) p;
(void) cs;
PLUGIN_TRACE("[FD %i] Mandril validating URL", cs->socket);
if (mk_security_check_url(sr->uri) < 0) {
PLUGIN_TRACE("[FD %i] Close connectio... | cwe | CWE-264 | C/C++ |
/*
* chfn.c -- change your finger information
* (c) 1994 by salvatore valente <svalente@athena.mit.edu>
* (c) 2012 by Cody Maloney <cmaloney@theoreticalchaos.com>
*
* this program is free software. you can redistribute it and
* modify it under the terms of the gnu general public license.
* there is ... | cwe | CWE-209 | C/C++ |
/*
* Copyright (c) 2002-2023 Gargoyle Software Inc.
*
* 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
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... | cwe | CWE-787 | Java |
# -*- 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 |
parseNormalModeParameters(IsoPresentation* self, uint8_t* buffer, int totalLength, int bufPos)
{
int endPos = bufPos + totalLength;
self->calledPresentationSelector.size = 0;
self->callingPresentationSelector.size = 0;
bool hasUserData = false;
while (bufPos < endPos) {
uint8_t tag = buff... | cwe | CWE-703 | C/C++ |
function inetLatency(host, callback) {
// fallback - if only callback is given
if (util.isFunction(host) && !callback) {
callback = host;
host = '';
}
host = host || '8.8.8.8';
return new Promise((resolve) => {
process.nextTick(() => {
if (typeof host !== 'string') {
if (callback)... | cwe | CWE-78 | JavaScript |
// SPDX-License-Identifier: GPL-2.0-only
/*
* Bluetooth Software UART Qualcomm protocol
*
* HCI_IBS (HCI In-Band Sleep) is Qualcomm's power management
* protocol extension to H4.
*
* Copyright (C) 2007 Texas Instruments, Inc.
* Copyright (c) 2010, 2012, 2018 The Linux Foundation. All rights reserved.
*
* ... | cwe | CWE-476 | C/C++ |
static int uv__idna_toascii_label(const char* s, const char* se,
char** d, char* de) {
static const char alphabet[] = "abcdefghijklmnopqrstuvwxyz0123456789";
const char* ss;
unsigned c;
unsigned h;
unsigned k;
unsigned n;
unsigned m;
unsigned q;
unsigned t;
unsigned... | cwe | CWE-125 | Unknown |
/*****************************************************************************/
/* LibreDWG - free implementation of the DWG file format */
/* */
/* Copyright (C) 2009-2010,2018-2019 Free Software Foundation, Inc. */
... | cwe | CWE-476 | C/C++ |
/*
*
* Copyright 2017 Asylo authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agree... | cwe | CWE-119 | C/C++ |
static int discovery_stop(struct discovery_client *client)
{
struct btd_adapter *adapter = client->adapter;
struct mgmt_cp_stop_discovery cp;
/* Check if there are more client discovering */
if (g_slist_next(adapter->discovery_list)) {
discovery_remove(client);
update_discovery_filter(adapter);
return 0;
}
... | cwe | CWE-863 | C/C++ |
/*-------------------------------------------------------------------------
*
* pqcomm.c
* Communication functions between the Frontend and the Backend
*
* These routines handle the low-level details of communication between
* frontend and backend. They just shove data across the communication
* channel, and ... | cwe | CWE-89 | Java |
String StringUtil::Crypt(const String& input, const char *salt /* = "" */) {
if (salt && salt[0] == '\0') {
raise_notice("crypt(): No salt parameter was specified."
" You must use a randomly generated salt and a strong"
" hash function to produce a secure hash.");
}
return String(string_crypt(inpu... | cwe | CWE-22 | C/C++ |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-399 | C/C++ |
my_object_emit_frobnicate (MyObject *obj, GError **error)
{
g_signal_emit (obj, signals[FROBNICATE], 0, 42);
return TRUE;
} | cwe | CWE-264 | C/C++ |
int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc,
const char **argv) {
struct passwd *pw = NULL, pw_s;
const char *user = NULL;
cfg_t cfg_st;
cfg_t *cfg = &cfg_st;
char buffer[BUFSIZE];
char *buf = NULL;
char *authfile_dir;
size_t authfile_dir_len;
int pgu_ret,... | cwe | CWE-200 | Unknown |
public void testCycle_ECDH_ES_Curve_P256_attackPoint2()
throws Exception {
ECKey ecJWK = generateECJWK(ECKey.Curve.P_256);
BigInteger privateReceiverKey = ecJWK.toECPrivateKey().getS();
JWEHeader header = new JWEHeader.Builder(JWEAlgorithm.ECDH_ES,
EncryptionMethod.A128GCM)
.agreementPartyUInfo(B... | cwe | CWE-347 | Java |
protected DataSource createDataSource() throws SQLException {
InitialContext context = null;
DataSource source = null;
try {
context = GeoTools.getInitialContext();
source = (DataSource) context.lookup(datasourceName);
} catch (IllegalArgumentException | NoInitial... | cwe | CWE-20 | Java |
static int l2cap_sock_getname(struct socket *sock, struct sockaddr *addr, int *len, int peer)
{
struct sockaddr_l2 *la = (struct sockaddr_l2 *) addr;
struct sock *sk = sock->sk;
struct l2cap_chan *chan = l2cap_pi(sk)->chan;
BT_DBG("sock %p, sk %p", sock, sk);
addr->sa_family = AF_BLUETOOTH;
*len = sizeof(s... | cwe | CWE-200 | C/C++ |
IMPEG2D_ERROR_CODES_T impeg2d_dec_p_b_slice(dec_state_t *ps_dec)
{
WORD16 *pi2_vld_out;
UWORD32 i;
yuv_buf_t *ps_cur_frm_buf = &ps_dec->s_cur_frm_buf;
UWORD32 u4_frm_offset = 0;
const dec_mb_params_t *ps_dec_mb_params;
IMPEG2D_ERROR_CODES_T e_error = (IMPEG2D_ERROR_CODES_T)IVD_ERROR_N... | cwe | CWE-119 | Unknown |
GF_Err gf_hinter_finalize(GF_ISOFile *file, GF_SDP_IODProfile IOD_Profile, u32 bandwidth)
{
u32 i, sceneT, odT, descIndex, size, size64;
GF_InitialObjectDescriptor *iod;
GF_SLConfig slc;
GF_ISOSample *samp;
Bool remove_ocr;
u8 *buffer;
char buf64[5000], sdpLine[5100];
gf_isom_sdp_clean(file);
if (bandwidth)... | cwe | CWE-703 | C/C++ |
@app.route('/referrer_count')
def referrer_count():
account_id = request.args.get('account_id')
if not isObject(account_id):
ws.send('{"id":1, "method":"call", "params":[0,"lookup_account_names",[["' + account_id + '"], 0]]}')
result_l = ws.recv()
j_l = json.loads(result_l)
acc... | cwe | CWE-89 | Python |
void SoftAVC::onQueueFilled(OMX_U32 /* portIndex */) {
if (mSignalledError || mOutputPortSettingsChange != NONE) {
return;
}
if (mEOSStatus == OUTPUT_FRAMES_FLUSHED) {
return;
}
List<BufferInfo *> &inQueue = getPortQueue(kInputPortIndex);
List<BufferInfo *> &outQueue = getPortQueue(kOutputPortIndex);
if (mH... | cwe | CWE-20 | C/C++ |
TfLiteStatus PrepareHashtableFind(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 3);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* input_resource_id_tensor =
GetInput(context, node, kInputResourceIdTensor);
TF_LITE_ENSURE_EQ(context, input_r... | cwe | CWE-787 | C/C++ |
public Controller execute(FolderComponent fc, UserRequest ureq, WindowControl windowControl, Translator trans) {
this.folderComponent = fc;
this.translator = trans;
this.fileSelection = new FileSelection(ureq, fc.getCurrentContainerPath());
VelocityContainer main = new VelocityContainer("mc", VELOCITY_ROOT... | cwe | CWE-22 | Java |
static int asn1_template_noexp_d2i(ASN1_VALUE **val,
const unsigned char **in, long len,
const ASN1_TEMPLATE *tt, char opt,
ASN1_TLC *ctx)
{
int flags, aclass;
int ret;
ASN1_VALUE *tval;
const unsign... | cwe | CWE-400 | Unknown |
static MagickBooleanType WritePDBImage(const ImageInfo *image_info,Image *image)
{
const char
*comment;
int
bits;
MagickBooleanType
status;
PDBImage
pdb_image;
PDBInfo
pdb_info;
QuantumInfo
*quantum_info;
register const PixelPacket
*p;
register ssize_t
x;
regist... | cwe | CWE-125 | C/C++ |
mrb_proc_s_new(mrb_state *mrb, mrb_value proc_class)
{
mrb_value blk;
mrb_value proc;
struct RProc *p;
/* Calling Proc.new without a block is not implemented yet */
mrb_get_args(mrb, "&!", &blk);
p = MRB_OBJ_ALLOC(mrb, MRB_TT_PROC, mrb_class_ptr(proc_class));
mrb_proc_copy(p, mrb_proc_ptr(blk));
proc =... | cwe | CWE-476 | C/C++ |
SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs)
{
struct rtas_args args;
unsigned long flags;
char *buff_copy, *errbuf = NULL;
int nargs, nret, token;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
if (!rtas.entry)
return -EINVAL;
if (copy_from_user(&args, uargs, 3 * sizeof(u32)) != 0)
return -EFAU... | cwe | CWE-862 | Unknown |
DOMStorageContextWrapper::DOMStorageContextWrapper(
service_manager::Connector* connector,
const base::FilePath& profile_path,
const base::FilePath& local_partition_path,
storage::SpecialStoragePolicy* special_storage_policy) {
base::FilePath data_path;
if (!profile_path.empty())
data_path = ... | cwe | CWE-415 | C/C++ |
onIgnoreTagAttr(tag, name, value) {
const forTag = allowList.attrList[tag];
if (forTag) {
const forAttr = forTag[name];
if (
(forAttr &&
(forAttr.indexOf("*") !== -1 || forAttr.indexOf(value) !== -1)) ||
(name.indexOf("data-") === 0 && forTag["data-*"]) ||
... | cwe | CWE-79 | JavaScript |
function yourls_verify_nonce( $action, $nonce = false, $user = false, $return = '' ) {
// get user
if( false == $user )
$user = defined( 'YOURLS_USER' ) ? YOURLS_USER : '-1';
// get current nonce value
if( false == $nonce && isset( $_REQUEST['nonce'] ) )
$nonce = $_REQUEST['nonce'];
// Allow plugins to short... | cwe | CWE-352 | PHP |
FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, uint32_t samples, FLAC__bool is_last_block)
{
const FLAC__byte *buffer;
size_t bytes;
FLAC__ASSERT(FLAC__bitwriter_is_byte_aligned(encoder->private_->frame));
if(!FLAC__bitwriter_get_buffer(encoder->private_->frame, &buffer, &bytes)) {
encoder->protected... | cwe | CWE-787 | C/C++ |
static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,
struct dj_report *dj_report)
{
/* Called in delayed work context */
struct hid_device *djrcv_hdev = djrcv_dev->hdev;
struct usb_interface *intf = to_usb_interface(djrcv_hdev->dev.parent);
struct usb_device *usbdev = interface_to_usb... | cwe | CWE-119 | C/C++ |
f.getElementsByTagName("span")[0];g.style.fontSize="18px";g.style.marginRight="5px";mxUtils.write(f,mxResources.get("moreShapes")+"...");mxEvent.addListener(f,mxClient.IS_POINTER?"pointerdown":"mousedown",mxUtils.bind(this,function(m){m.preventDefault()}));mxEvent.addListener(f,"click",mxUtils.bind(this,function(m){thi... | cwe | CWE-94 | JavaScript |
def listUsernames(pageId: PageId, prefix: String): Action[Unit] = GetAction { request =>
import request.dao
val pageMeta = dao.getPageMeta(pageId) getOrElse throwIndistinguishableNotFound("EdE4Z0B8P5")
val categoriesRootLast = dao.getAncestorCategoriesRootLast(pageMeta.categoryId)
SECURITY // Later: s... | cwe | CWE-613 | Scala |
void isis_notif_reject_adjacency(const struct isis_circuit *circuit,
const char *reason, const char *raw_pdu,
size_t raw_pdu_len)
{
const char *xpath = "/frr-isisd:rejected-adjacency";
struct list *arguments = yang_data_list_new();
char xpath_arg[XPATH_MAXLEN];
struct yang_data *data;
struct isis_area *a... | cwe | CWE-119 | Unknown |
xcf_load_stream (Gimp *gimp,
GInputStream *input,
GFile *input_file,
GimpProgress *progress,
GError **error)
{
XcfInfo info = { 0, };
const gchar *filename;
GimpImage *image = NULL;
gchar id[14];
gboole... | cwe | CWE-125 | Unknown |
bool run(OperationContext* opCtx,
const string& dbname,
const BSONObj& cmdObj,
BSONObjBuilder& result) {
auth::CreateOrUpdateUserArgs args;
Status status = auth::parseCreateOrUpdateUserCommands(cmdObj, "createUser", dbname, &args);
uassertStatusOK(status);
... | cwe | CWE-613 | Unknown |
GF_Err gf_bifs_dec_sf_field(GF_BifsDecoder * codec, GF_BitStream *bs, GF_Node *node, GF_FieldInfo *field, Bool is_mem_com)
{
GF_Err e;
GF_Node *new_node;
u32 size, length, w, h, i;
char *buffer;
//blindly call unquantize. return is OK, error or GF_EOS
if (codec->ActiveQP && node) {
e = gf_bifs_dec_unquant_fiel... | cwe | CWE-476 | C/C++ |
def markAllNotfsAsSeen(): Action[JsValue] = PostJsonAction(RateLimits.MarkNotfAsSeen, 200) {
request =>
request.dao.markAllNotfsAsSeen(request.theUserId)
loadNotificationsImpl(request.theUserId, upToWhen = None, request)
}
def markNotificationAsSeen(): Action[JsValue] = PostJsonAction(RateLimits.M... | cwe | CWE-613 | Scala |
int pipe_resize_ring(struct pipe_inode_info *pipe, unsigned int nr_slots)
{
struct pipe_buffer *bufs;
unsigned int head, tail, mask, n;
/*
* We can shrink the pipe, if arg is greater than the ring occupancy.
* Since we don't expect a lot of shrink+grow operations, just free and
* allocate again like we would ... | cwe | CWE-362 | C/C++ |
}
inline size_t http_parser_execute (http_parser *parser,
const http_parser_settings *settings,
const char *data,
size_t len)
{
/* Tokens as defined by rfc 2616. Also lowercases them.
* token = 1*<any CHAR except CTLs or... | cwe | CWE-416 | Unknown |
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright 2004 Komarov Valery
* Copyright 2006 Christophe Leitienne
* Copyright 2008-2017 David Hoerl
* Copyright 2013 Bob Colbert
* Copyright 2013-2018 Evan Miller
*
* This file is part of libxls -- A multiplatform, C/C++ libr... | cwe | CWE-476 | C/C++ |
static int process_options(int argc, char *argv[], char *operation)
{
int error= 0;
int i= 0;
/* Parse and execute command-line options */
if ((error= handle_options(&argc, &argv, my_long_options, get_one_option)))
goto exit;
/* If the print defaults option used, exit. */
if (opt_print_defaults)
{... | cwe | CWE-200 | Unknown |
start_pass_merged_upsample(j_decompress_ptr cinfo)
{
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
/* Mark the spare buffer empty */
upsample->spare_full = FALSE;
/* Initialize total-height counter for detecting bottom of image */
upsample->rows_to_go = cinfo->output_height;
} | cwe | CWE-476 | Unknown |
function request_encounter_data(model_data, mode, prev_encounter) {
var request = {
pid: pid,
encounter: enc,
mode: mode,
task: "retrieve"
};
if (prev_encounter != null) {
request.prev_encounter = prev_encounter;
}
$.post(review_ajax, request, function (result... | cwe | CWE-79 | JavaScript |
#ifndef JSI_LITE_ONLY
#define __JSIINT_C__
#ifndef JSI_AMALGAMATION
#include "jsiInt.h"
#endif
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <assert.h>
#ifdef __WIN32
#include <windows.h>
#include <shlwapi.h>
#ifndef JSI_OMIT_THREADS
#include <process.h>
#endif
#else
#ifndef JSI_OMIT_THREADS
#inc... | cwe | CWE-190 | C/C++ |
load_deployed_metadata (FlatpakTransaction *self, FlatpakDecomposed *ref, char **out_commit, char **out_remote)
{
FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (self);
g_autoptr(GFile) deploy_dir = NULL;
g_autoptr(GFile) metadata_file = NULL;
g_autofree char *metadata_contents = NUL... | cwe | CWE-276 | C/C++ |
process_options(argc, argv)
int argc;
char *argv[];
{
int i, l;
/*
* Process options.
*/
while (argc > 1 && argv[1][0] == '-') {
argv++;
argc--;
l = (int) strlen(*argv);
/* must supply at least 4 chars to match "-XXXgraphics" */
if (l < 4)
l = 4... | cwe | CWE-120 | C/C++ |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* data = GetInput(context, node, kInputDataTensor);
const TfLiteTensor* segment_ids =
GetInput(context, node, kInputSegmentIdsTensor);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
if (IsDynamicTensor(output... | cwe | CWE-787 | C/C++ |
package service
import (
"context"
"database/sql"
"encoding/base64"
"errors"
"html/template"
"net/http"
"time"
"github.com/fleetdm/fleet/v4/server"
"github.com/fleetdm/fleet/v4/server/authz"
"github.com/fleetdm/fleet/v4/server/contexts/ctxerr"
"github.com/fleetdm/fleet/v4/server/contexts/viewer"
"github.c... | cwe | CWE-863 | Go |
function La(e,t,n,r){var a,i,o=e._adapter,s=+o.startOf(t[0].value,r),l=t[t.length-1].value;for(a=s;a<=l;a=+o.add(a,1,r))(i=n[a])>=0&&(t[i].major=!0);return t} | cwe | CWE-79 | JavaScript |
bool CascadeClassifierImpl::Data::read(const FileNode &root)
{
static const float THRESHOLD_EPS = 1e-5f;
// load stage params
String stageTypeStr = (String)root[CC_STAGE_TYPE];
if( stageTypeStr == CC_BOOST )
stageType = BOOST;
else
return false;
String featureTypeStr = (String)... | cwe | CWE-125 | Unknown |
/******************************************************************************
* emulate.c
*
* Generic x86 (32-bit and 64-bit) instruction decoder and emulator.
*
* Copyright (c) 2005 Keir Fraser
*
* Linux coding style, mod r/m decoder, segment base fixes, real-mode
* privileged instructions:
*
* Copyright (... | cwe | CWE-200 | C/C++ |
// SPDX-License-Identifier: GPL-2.0
/*
* Kernel internal timers
*
* Copyright (C) 1991, 1992 Linus Torvalds
*
* 1997-01-28 Modified by Finn Arne Gangstad to make timers scale better.
*
* 1997-09-10 Updated NTP code according to technical memorandum Jan '96
* "A Kernel Model for Precision Tim... | cwe | CWE-200 | C/C++ |
setv4key_principal_2_svc(setv4key_arg *arg, struct svc_req *rqstp)
{
static generic_ret ret;
char *prime_arg;
gss_buffer_desc client_name,
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;... | cwe | CWE-772 | C/C++ |
compat_mpt_command(struct file *filp, unsigned int cmd,
unsigned long arg)
{
struct mpt_ioctl_command32 karg32;
struct mpt_ioctl_command32 __user *uarg = (struct mpt_ioctl_command32 __user *) arg;
struct mpt_ioctl_command karg;
MPT_ADAPTER *iocp = NULL;
int iocnum, iocnumX;
int nonblock = (filp->f_flags & O_NO... | cwe | CWE-369 | Unknown |
(function($) {
$.extend($.summernote.lang, {
'zh-CN': {
font: {
bold: '粗体',
italic: '斜体',
underline: '下划线',
clear: '清除格式',
height: '行高',
name: '字体',
strikethrough: '删除线',
subscript: '下标',
superscript: '上标',
size: '字号'
},
... | cwe | CWE-79 | Java |
# -*- coding: utf-8 -*-
import hashlib
import os
from ..utils.struct.style import style
# TODO: rewrite using scrypt or argon2_cffi
def _salted_password(password, salt):
dk = hashlib.pbkdf2_hmac("sha256", password.encode(), bytes.fromhex(salt), 100000)
return salt + dk.hex()
def _gensalt():
return os.... | cwe | CWE-613 | Python |
static long madvise_remove(struct vm_area_struct *vma,
struct vm_area_struct **prev,
unsigned long start, unsigned long end)
{
loff_t offset;
int error;
*prev = NULL; /* tell sys_madvise we drop mmap_sem */
if (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB))
return -EINVAL;
if (!vma->vm_file || !... | cwe | CWE-362 | C/C++ |
lockd(void *vrqstp)
{
int err = 0;
struct svc_rqst *rqstp = vrqstp;
/* try_to_freeze() is called from svc_recv() */
set_freezable();
/* Allow SIGKILL to tell lockd to drop all of its locks */
allow_signal(SIGKILL);
dprintk("NFS locking service started (ver " LOCKD_VERSION ").\n");
/*
* The main req... | cwe | CWE-404 | C/C++ |
function uploadFile($file_array, $destination_directory, $destination_filename = null)
{
if ((! isset($file_array['name'])) || (! isset($file_array['tmp_name'])) || (! isset($file_array['error']))) {
throw new Exception(_('Ungültiges Array übergeben!'));
}
//Dont allow to upload a PHP file.
if(... | cwe | CWE-78 | PHP |
void unix_inflight(struct file *fp)
{
struct sock *s = unix_get_socket(fp);
if (s) {
struct unix_sock *u = unix_sk(s);
spin_lock(&unix_gc_lock);
if (atomic_long_inc_return(&u->inflight) == 1) {
BUG_ON(!list_empty(&u->link));
list_add_tail(&u->link, &gc_inflight_list);
} else {
BUG_ON(list_empty(&u... | cwe | CWE-119 | C/C++ |
package api
// Visibility is the type of a visibility.
type Visibility string
const (
// Public is the PUBLIC visibility.
Public Visibility = "PUBLIC"
// Protected is the PROTECTED visibility.
Protected Visibility = "PROTECTED"
// Private is the PRIVATE visibility.
Private Visibility = "PRIVATE"
)
func (e Visi... | cwe | CWE-284 | Go |
struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor)
{
struct udev_device *udev_device;
struct msghdr smsg;
struct iovec iov;
char cred_msg[CMSG_SPACE(sizeof(struct ucred))];
struct cmsghdr *cmsg;
struct ucred *cred;
char buf[4096];
size_t bufpos;
int devpath_set = 0;
int subsyst... | cwe | CWE-346 | Unknown |
/*-
* Copyright (c) 2003-2010 Tim Kientzle
* Copyright (c) 2012 Michihiro NAKAJIMA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the abo... | cwe | CWE-19 | C/C++ |
static int set_evtchn_to_irq(evtchn_port_t evtchn, unsigned int irq)
{
unsigned row;
unsigned col;
if (evtchn >= xen_evtchn_max_channels())
return -EINVAL;
row = EVTCHN_ROW(evtchn);
col = EVTCHN_COL(evtchn);
if (evtchn_to_irq[row] == NULL) {
/* Unallocated irq entries return -1 anyway */
if (irq == -1)
... | cwe | CWE-476 | C/C++ |
Jsi_RC jsi_StaticArgTypeCheck(Jsi_Interp *interp, int atyp, const char *p1, const char *p2, int index, Jsi_Func *func, jsi_Pline *line) {
Assert(index>0);
Jsi_RC rc;
if (interp->typeCheck.parse==0 && interp->typeCheck.all==0)
return JSI_OK;
int ai = index-1+func->callflags.bits.addargs;
if (... | cwe | CWE-120 | C/C++ |
static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
{
VirtIONet *n = opaque;
VirtIODevice *vdev = VIRTIO_DEVICE(n);
int ret, i, link_down;
if (version_id < 2 || version_id > VIRTIO_NET_VM_VERSION)
return -EINVAL;
ret = virtio_load(vdev, f);
if (ret) {
return r... | cwe | CWE-119 | C/C++ |
var exec = require('child_process').exec;
var regexRegex = /[-\/\\^$*+?.()|[\]{}]/g;
function escape(string) {
return string.replace(regexRegex, '\\$&');
}
module.exports = function (iface, callback) {
exec("ipconfig /all", function (err, out) {
if (err) {
callback(err, null);
... | cwe | CWE-78 | Java |
function getParent($this) {
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = selector && $(selector)
return $parent && $p... | cwe | CWE-79 | JavaScript |
gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
{
TIFF* tif = img->tif;
tileSeparateRoutine put = img->put.separate;
unsigned char *buf = NULL;
unsigned char *p0 = NULL, *p1 = NULL, *p2 = NULL, *pa = NULL;
uint32 row, y, nrow, rowstoread;
tmsize_t pos;
tmsize_t scanline;
uint32 rowsperst... | cwe | CWE-190 | C/C++ |
static int dex_loadcode(RBinFile *arch, RBinDexObj *bin) {
struct r_bin_t *rbin = arch->rbin;
int i;
int *methods = NULL;
int sym_count = 0;
// doublecheck??
if (!bin || bin->methods_list) {
return false;
}
bin->code_from = UT64_MAX;
bin->code_to = 0;
bin->methods_list = r_list_newf ((RListFree)free);
if ... | cwe | CWE-125 | Unknown |
package config
import (
"fmt"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/sec"
"github.com/libp2p/go-libp2p-core/sec/insecure"
csms "github.com/libp2p/go-conn-security-multistream"
)
// SecC is a s... | cwe | CWE-400 | Go |
static struct phy *serdes_simple_xlate(struct device *dev,
struct of_phandle_args *args)
{
struct serdes_ctrl *ctrl = dev_get_drvdata(dev);
unsigned int port, idx, i;
if (args->args_count != 2)
return ERR_PTR(-EINVAL);
port = args->args[0];
idx = args->args[1];
for (i = 0; i <= SERDES_MAX; i++) {
... | cwe | CWE-125 | C/C++ |
/**
* Wrapper for built-in http.js to emulate the browser XMLHttpRequest object.
*
* This can be used with JS designed for browsers to improve reuse of code and
* allow the use of existing libraries.
*
* Usage: include("XMLHttpRequest.js") and use XMLHttpRequest per W3C specs.
*
* @author Dan DeFelippi <dan@dri... | cwe | CWE-295 | JavaScript |
MOBI_RET mobi_decode_infl(unsigned char *decoded, int *decoded_size, const unsigned char *rule) {
int pos = *decoded_size;
char mod = 'i';
char dir = '<';
char olddir;
unsigned char c;
while ((c = *rule++)) {
if (c <= 4) {
mod = (c <= 2) ? 'i' : 'd'; /* insert, delete */
... | cwe | CWE-787 | C/C++ |
static js_Ast *additive(js_State *J)
{
js_Ast *a = multiplicative(J);
loop:
if (jsP_accept(J, '+')) { a = EXP2(ADD, a, multiplicative(J)); goto loop; }
if (jsP_accept(J, '-')) { a = EXP2(SUB, a, multiplicative(J)); goto loop; }
return a;
} | cwe | CWE-674 | Unknown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.