code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
import vyper.utils as util
from vyper.address_space import MEMORY
from vyper.codegen.abi_encoder import abi_encode
from vyper.codegen.core import (
calculate_type_for_external_return,
check_assign,
check_external_call,
dummy_node_for_type,
get_element_ptr,
)
from vyper.codegen.ir_node import Encodin... | cwe | CWE-190 | Python |
bool Decoder::canSplitFunctionOn(
utils::Address addr,
llvm::BasicBlock* splitBb,
std::set<llvm::BasicBlock*>& newFncStarts)
{
newFncStarts.insert(splitBb);
auto* f = splitBb->getParent();
auto fAddr = getFunctionAddress(f);
auto fSzIt = _fnc2sz.find(f);
if (fSzIt != _fnc2sz.end())
{
if (fAddr <= addr &... | cwe | CWE-787 | Unknown |
static int uas_switch_interface(struct usb_device *udev,
struct usb_interface *intf)
{
int alt;
alt = uas_find_uas_alt_setting(intf);
if (alt < 0)
return alt;
return usb_set_interface(udev,
intf->altsetting[0].desc.bInterfaceNumber, alt);
} | cwe | CWE-125 | C/C++ |
_gnutls_server_name_recv_params (gnutls_session_t session,
const opaque * data, size_t _data_size)
{
int i;
const unsigned char *p;
uint16_t len, type;
ssize_t data_size = _data_size;
int server_names = 0;
if (session->security_parameters.entity == GNUTLS_SERVER)
{
DECR_LENGTH_RET (data_size... | cwe | CWE-189 | C/C++ |
/*
* Routines for driver control interface
* Copyright (c) by Jaroslav Kysela <perex@perex.cz>
*
*
* 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 2 of the License,... | cwe | CWE-416 | C/C++ |
int ntlm_read_message_header(wStream* s, NTLM_MESSAGE_HEADER* header)
{
if (Stream_GetRemainingLength(s) < 12)
return -1;
Stream_Read(s, header->Signature, 8);
Stream_Read_UINT32(s, header->MessageType);
if (strncmp((char*) header->Signature, NTLM_SIGNATURE, 8) != 0)
return -1;
return 1;
} | cwe | CWE-125 | C/C++ |
static NTSTATUS idmap_sid_to_xid(struct idmap_context *idmap_ctx,
TALLOC_CTX *mem_ctx,
const struct dom_sid *sid,
struct unixid *unixid)
{
int ret;
NTSTATUS status;
struct ldb_context *ldb = idmap_ctx->ldb_ctx;
struct ldb_dn *dn;
struct ldb_message *hwm_msg, *map_msg, *sam_msg;
struct ldb_result *r... | cwe | CWE-200 | Unknown |
/*
* Copyright (c) 2006-2020, JGraph Ltd
*
* This provides an indirection to make sure the mxClient.js
* loads before the dependent classes below are loaded. This
* is used for development mode where the JS is in separate
* files and the mxClient.js loads other files.
*/
if (!mxIsElectron && location.protocol !... | cwe | CWE-79 | JavaScript |
png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
png_uint_32 width, png_uint_32 height, int bit_depth,
int color_type, int interlace_type, int compression_type,
int filter_type)
{
png_debug1(1, "in %s storage function", "IHDR");
if (png_ptr == NULL || info_ptr == NULL)
return;
info_ptr->w... | cwe | CWE-120 | C/C++ |
evbuffer_ptr_set(struct evbuffer *buf, struct evbuffer_ptr *pos,
size_t position, enum evbuffer_ptr_how how)
{
size_t left = position;
struct evbuffer_chain *chain = NULL;
EVBUFFER_LOCK(buf);
switch (how) {
case EVBUFFER_PTR_SET:
chain = buf->first;
pos->pos = position;
position = 0;
break;
case EVB... | cwe | CWE-189 | Unknown |
def add_constraint_set_remote(params, request, session)
if not allowed_for_local_cluster(session, Permissions::WRITE)
return 403, 'Permission denied'
end
case params["c_type"]
when "ord"
retval, error = add_order_set_constraint(
session,
params["resources"].values, params["force"], !params['... | cwe | CWE-384 | Ruby |
void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
struct kvm_io_device *dev)
{
int i;
struct kvm_io_bus *new_bus, *bus;
bus = kvm_get_bus(kvm, bus_idx);
if (!bus)
return;
for (i = 0; i < bus->dev_count; i++)
if (bus->range[i].dev == dev) {
break;
}
if (i == bus->dev_count... | cwe | CWE-401 | C/C++ |
get_user_command_name(int idx, int cmdidx)
{
if (cmdidx == CMD_USER && idx < ucmds.ga_len)
return USER_CMD(idx)->uc_name;
if (cmdidx == CMD_USER_BUF)
{
// In cmdwin, the alternative buffer should be used.
buf_T *buf =
#ifdef FEAT_CMDWIN
is_in_cmdwin() ? prevwin->w_buffer :
#endif
curbuf;
if... | cwe | CWE-476 | C/C++ |
/* $Id$ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
*
* 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; eit... | cwe | CWE-120 | C/C++ |
// This may look like C code, but it is really -*- C++ -*-
//
// Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003
// Copyright Dirk Lemstra 2013-2017
//
// Implementation of Image
//
#define MAGICKCORE_IMPLEMENTATION 1
#define MAGICK_PLUSPLUS_IMPLEMENTATION 1
#include "Magick++/Include.h"
#include <cstdlib>
#... | cwe | CWE-416 | C/C++ |
void ProcessStateChangesUnifiedPlan(
WebRtcSetDescriptionObserver::States states) {
DCHECK_EQ(sdp_semantics_, webrtc::SdpSemantics::kUnifiedPlan);
handler_->OnModifyTransceivers(
std::move(states.transceiver_states),
action_ == PeerConnectionTracker::ACTION_SET_REMOTE_DESCRIPTION);
} | cwe | CWE-787 | 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 |
xmlSchemaSimpleTypeErr(xmlSchemaAbstractCtxtPtr actxt,
xmlParserErrors error,
xmlNodePtr node,
const xmlChar *value,
xmlSchemaTypePtr type,
int displayValue)
{
xmlChar *msg = NULL;
xmlSchemaFormatNodeForError(&msg, actxt, node);
if (displayValue || (xmlSchemaEv... | cwe | CWE-134 | Unknown |
package configuration
import (
"encoding/json"
"io/ioutil"
logger "github.com/TykTechnologies/tyk-identity-broker/log"
"github.com/TykTechnologies/tyk-identity-broker/tothic"
tyk "github.com/TykTechnologies/tyk-identity-broker/tyk-api"
"github.com/kelseyhightower/envconfig"
"github.com/sirupsen/logrus"
)
var... | cwe | CWE-287 | Go |
static ssize_t aio_setup_iocb(struct kiocb *kiocb, bool compat)
{
struct file *file = kiocb->ki_filp;
ssize_t ret = 0;
switch (kiocb->ki_opcode) {
case IOCB_CMD_PREAD:
ret = -EBADF;
if (unlikely(!(file->f_mode & FMODE_READ)))
break;
ret = -EFAULT;
if (unlikely(!access_ok(VERIFY_WRITE, kiocb->ki_buf,
... | cwe | CWE-200 | Unknown |
ssize_t __weak cpu_show_l1tf(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sprintf(buf, "Not affected\n");
} | cwe | CWE-787 | Unknown |
void close_all_sockets(atransport* t) {
asocket* s;
/* this is a little gross, but since s->close() *will* modify
** the list out from under you, your options are limited.
*/
adb_mutex_lock(&socket_list_lock);
restart:
for (s = local_socket_list.next; s != &local_socket_list; s = s->next)... | cwe | CWE-264 | C/C++ |
// Copyright 2016 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package db
import (
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"os"
"os/exec"
"path"
"path/filepath"
"strings"
"time"
"github.com/pkg/errors"
gouui... | cwe | CWE-78 | Go |
static inline Quantum ClampPixel(const MagickRealType value)
{
#if !defined(MAGICKCORE_HDRI_SUPPORT)
return((Quantum) value);
#else
if (value < 0.0f)
return(0.0);
if (value >= (MagickRealType) QuantumRange)
return((Quantum) QuantumRange);
return(value);
#endif
} | cwe | CWE-119 | Unknown |
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 1994 Linus Torvalds
*
* Cyrix stuff, June 1998 by:
* - Rafael R. Reilova (moved everything from head.S),
* <rreilova@ececs.uc.edu>
* - Channing Corn (tests & fixes),
* - Andrew D. Balsa (code cleanup).
*/
#include <linux/init.h>
#include <linux/ut... | cwe | CWE-254 | C/C++ |
package session
import (
"context"
"encoding/json"
"errors"
"fmt"
"math"
"math/rand"
"net"
"net/http"
"os"
"time"
oidc "github.com/coreos/go-oidc"
"github.com/dgrijalva/jwt-go/v4"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/argoproj/argo... | cwe | CWE-613 | Go |
psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
{ sf_count_t total = 0 ;
ssize_t count ;
if (psf->virtual_io)
return psf->vio.write (ptr, bytes*items, psf->vio_user_data) / bytes ;
items *= bytes ;
/* Do this check after the multiplication above. */
if (items <= 0)
re... | cwe | CWE-189 | C/C++ |
#include "webcc/body.h"
#include "webcc/logger.h"
#include "webcc/utility.h"
#if WEBCC_ENABLE_GZIP
#include "webcc/gzip.h"
#endif
namespace webcc {
// -----------------------------------------------------------------------------
#if WEBCC_ENABLE_GZIP
bool StringBody::Compress() {
if (compressed_) {
return t... | cwe | CWE-22 | C/C++ |
function ce(){return(ce=ie(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!ae.passwordPolicy.api||!ae.passwordPolicy.api.generate){e.next=14;break}return e.prev=1,e.next=4,d.default.get(ae.passwordPolicy.api.generate);case 4:if(!(n=e.sent).... | cwe | CWE-338 | JavaScript |
#include <linux/mm.h>
#include <linux/vmacache.h>
#include <linux/hugetlb.h>
#include <linux/huge_mm.h>
#include <linux/mount.h>
#include <linux/seq_file.h>
#include <linux/highmem.h>
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/pagemap.h>
#include <linux/mempolicy.h>
#include <linux/rmap.h>
#inclu... | cwe | CWE-200 | C/C++ |
function getLinkComponent(config) {
const showOpenOptionOnHover = config.showOpenOptionOnHover;
return class Link extends Component {
static propTypes = {
entityKey: PropTypes.string.isRequired,
children: PropTypes.array,
contentState: PropTypes.object,
};
state: Object = {
show... | cwe | CWE-79 | JavaScript |
/*
CSV Parse
Please look at the [project documentation](https://csv.js.org/parse/) for additional
information.
*/
const { Transform } = require('stream')
const ResizeableBuffer = require('./ResizeableBuffer')
const cr = 13
const nl = 10
const space = 32
const tab = 9
const bom_utf8 = Buffer.from([239, 187, 191])
c... | cwe | CWE-400 | Java |
/* tjws - WarRoller.java
* Copyright (C) 2004-2010 Dmitriy Rogatkin. 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 above copyright
* n... | cwe | CWE-22 | Java |
/** @file read.c
* @brief Functions for reading and parsing of MOBI document
*
* Copyright (c) 2014 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/>
*/
#include <stdio.h>
#include <st... | cwe | CWE-119 | C/C++ |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2005-2012
* All rights reserved
*
* This file is part of GPAC / command-line client
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General ... | cwe | CWE-787 | C/C++ |
static base::Callback<void(const gfx::Image&)> Wrap(
const base::Callback<void(const SkBitmap&)>& image_decoded_callback) {
auto* handler = new ImageDecodedHandlerWithTimeout(image_decoded_callback);
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
base::Bind(&ImageDecodedH... | cwe | CWE-119 | C/C++ |
void writeStats(Array& /*ret*/) override {
fprintf(stderr, "writeStats start\n");
// RetSame: the return value is the same instance every time
// HasThis: call has a this argument
// AllSame: all returns were the same data even though args are different
// MemberCount: number of different arg sets (... | cwe | CWE-787 | C/C++ |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may n... | cwe | CWE-552 | Java |
ex_finally(exarg_T *eap)
{
int idx;
int skip = FALSE;
int pending = CSTP_NONE;
cstack_T *cstack = eap->cstack;
if (cmdmod_error(FALSE))
return;
if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0)
eap->errmsg = _(e_finally_without_try);
else
{
if (!(cstack->cs_flags[cstack->cs_idx... | cwe | CWE-787 | Unknown |
from __future__ import absolute_import, unicode_literals
import re
from collections import OrderedDict
from django import template
from django.template import loader
from django.urls import NoReverseMatch, reverse
from django.utils import six
from django.utils.encoding import force_text, iri_to_uri
from django.utils.... | cwe | CWE-79 | Python |
if(p||q){var J=[],V=null,U=null,X=null,t=function(fa){W.setAttribute("disabled","disabled");for(var sa=0;sa<J.length;sa++)J[sa].className=sa==fa?"geBtn gePrimaryBtn":"geBtn"};N=!0;z=document.createElement("div");z.style.whiteSpace="nowrap";z.style.height="30px";G.appendChild(z);C=mxUtils.button(mxResources.get("Templat... | cwe | CWE-94 | JavaScript |
function cellClicked(cell)
{
// Forces focusout in IE
if (!ui.editor.isChromelessView())
{
graph.container.focus();
}
// Gets the selection cell
if (cell == null)
{
highlight.highlight(null);
div.innerHTML = '<p><i>' + mxResources.get('nothingIsSelected') + '</i></p>';
}
else
{
var att... | cwe | CWE-94 | JavaScript |
package scheduler
import (
"github.com/openshift/cluster-kube-apiserver-operator/pkg/operator/configobservation"
"github.com/openshift/library-go/pkg/operator/configobserver"
"github.com/openshift/library-go/pkg/operator/events"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructur... | cwe | CWE-284 | Go |
void HierarchicalBitmapRequester::PrepareForDecoding(void)
{
#if ACCUSOFT_CODE
UBYTE i;
BuildCommon();
if (m_ppDecodingMCU == NULL) {
m_ppDecodingMCU = (struct Line **)m_pEnviron->AllocMem(sizeof(struct Line *) * m_ucCount*8);
memset(m_ppDecodingMCU,0,sizeof(struct Line *) * m_ucCount * 8);
}
if (... | cwe | CWE-787 | Unknown |
njs_promise_perform_race_handler(njs_vm_t *vm, njs_iterator_args_t *args,
njs_value_t *value, int64_t index)
{
njs_int_t ret;
njs_value_t arguments[2], next;
njs_promise_capability_t *capability;
njs_promise_iterator_args_t *pargs;
pargs = (njs_promise_i... | cwe | CWE-416 | Unknown |
void requestResetPassword() throws Exception
{
when(this.userManager.exists(this.userReference)).thenReturn(true);
InternetAddress email = new InternetAddress("foobar@xwiki.org");
when(this.userProperties.getEmail()).thenReturn(email);
BaseObject xObject = mock(BaseObject.class);
... | cwe | CWE-200 | Java |
const got = require('@/utils/got');
const cheerio = require('cheerio');
const timezone = require('@/utils/timezone');
const { parseDate } = require('@/utils/parse-date');
const { art } = require('@/utils/render');
const path = require('path');
module.exports = async (ctx) => {
let category = ctx.params.category ??... | cwe | CWE-918 | JavaScript |
do_decrypt (const RIJNDAEL_context *ctx, unsigned char *bx,
const unsigned char *ax)
{
#ifdef USE_AMD64_ASM
return _gcry_aes_amd64_decrypt_block(ctx->keyschdec, bx, ax, ctx->rounds,
&dec_tables);
#elif defined(USE_ARM_ASM)
return _gcry_aes_arm_decrypt_block(ctx->keyschdec, bx, ax, ctx->rounds... | cwe | CWE-668 | C/C++ |
private List<Gadget> prepareGadgets(List<BaseObject> objects, Syntax sourceSyntax,
MacroTransformationContext context) throws Exception
{
List<Gadget> gadgets = new ArrayList<>();
// prepare velocity tools to render title
VelocityContext velocityContext = velocityManager.getVelocity... | cwe | CWE-94 | Java |
TPMI_TDES_KEY_BITS_Unmarshal(TPMI_SM4_KEY_BITS *target, BYTE **buffer, INT32 *size)
{
TPM_RC rc = TPM_RC_SUCCESS;
if (rc == TPM_RC_SUCCESS) {
rc = TPM_KEY_BITS_Unmarshal(target, buffer, size);
}
if (rc == TPM_RC_SUCCESS) {
switch (*target) {
case 128:
case 192:
break;
default:
rc =... | cwe | CWE-787 | Unknown |
public function assets_path($file = NULL, $path = NULL, $module = NULL, $absolute = NULL)
{
$cache = '';
if (!isset($absolute)) $absolute = $this->assets_absolute_path;
$CI = $this->_get_assets_config();
if ($this->asset_append_cache_timestamp AND in_array($path, $this->asset_append_cache_timestamp) AND !em... | cwe | CWE-74 | PHP |
aodv_extension(netdissect_options *ndo,
const struct aodv_ext *ep, u_int length)
{
const struct aodv_hello *ah;
switch (ep->type) {
case AODV_EXT_HELLO:
ah = (const struct aodv_hello *)(const void *)ep;
ND_TCHECK(*ah);
if (length < sizeof(struct aodv_hello))
goto trunc;
ND_PRINT(... | cwe | CWE-125 | C/C++ |
smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst)
{
int rc;
struct kvec *iov = rqst->rq_iov;
int n_vec = rqst->rq_nvec;
unsigned int smb_buf_length = get_rfc1002_length(iov[0].iov_base);
unsigned int i;
size_t total_len = 0, sent;
struct socket *ssocket = server->ssocket;
int val = 1;
c... | cwe | CWE-362 | C/C++ |
/*
* Copyright (c) 2006-2020, JGraph Ltd
*
* This provides an indirection to make sure the mxClient.js
* loads before the dependent classes below are loaded. This
* is used for development mode where the JS is in separate
* files and the mxClient.js loads other files.
*/
if (!mxIsElectron && location.protocol !... | cwe | CWE-94 | JavaScript |
static void rds_tcp_kill_sock(struct net *net)
{
struct rds_tcp_connection *tc, *_tc;
LIST_HEAD(tmp_list);
struct rds_tcp_net *rtn = net_generic(net, rds_tcp_netid);
struct socket *lsock = rtn->rds_tcp_listen_sock;
rtn->rds_tcp_listen_sock = NULL;
rds_tcp_listen_stop(lsock, &rtn->rds_tcp_accept_w);
spin_lock_ir... | cwe | CWE-362 | C/C++ |
public function display_sdm_stats_meta_box($post) { //Stats metabox
$old_count = get_post_meta($post->ID, 'sdm_count_offset', true);
$value = isset($old_count) && $old_count != '' ? $old_count : '0';
// Get checkbox for "disable download logging"
$no_logs = get_post_meta($post->ID, 'sdm_item_no_log', true);
$che... | cwe | CWE-79 | PHP |
function u(){mxShape.call(this)}function J(){mxShape.call(this)}function N(){mxRectangleShape.call(this)}function W(){mxShape.call(this)}function S(){mxShape.call(this)}function P(){mxShape.call(this)}function Z(){mxShape.call(this)}function oa(){mxShape.call(this)}function va(){mxCylinder.call(this)}function Aa(){mxCy... | cwe | CWE-20 | JavaScript |
yyparse (void *yyscanner, YR_COMPILER* compiler)
{
/* The lookahead symbol. */
int yychar;
/* The semantic value of the lookahead symbol. */
/* Default value used for initialization, for pacifying older GCCs
or non-GCC compilers. */
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
YYSTYPE yylval YY_INITIAL_VALU... | cwe | CWE-416 | Unknown |
public void performTest()
throws Exception
{
KeyFactory ecFact = KeyFactory.getInstance("EC", "BC");
KeyPair keyPair = new KeyPair(ecFact.generatePublic(new X509EncodedKeySpec(p256_1_pub)), ecFact.generatePrivate(new PKCS8EncodedKeySpec(p256_1_pri)));
doTestNoParams("ECIES with P-2... | cwe | CWE-310 | Java |
static ssize_t parse8BIM(Image *ifile, Image *ofile)
{
char
brkused,
quoted,
*line,
*token,
*newstr,
*name;
int
state,
next;
unsigned char
dataset;
unsigned int
recnum;
int
inputlen = MaxTextExtent;
MagickOffsetType
savedpos,
currentpos;
ssize_t
... | cwe | CWE-772 | Unknown |
void Curl_detach_connnection(struct Curl_easy *data)
{
struct connectdata *conn = data->conn;
if(conn)
Curl_llist_remove(&conn->easyq, &data->conn_queue, NULL);
data->conn = NULL;
} | cwe | CWE-295 | Unknown |
var INTERPOLATE = /{([\s\S]+?)}/g
module.exports = function(str, data) {
var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' +
'with(obj||{}){__p.push(\'' +
str.replace(/\\/g, '\\\\')
.replace(/'/g, "\\'")
.replace(INTERPOLATE, function(match, code) {
return "'," ... | cwe | CWE-697 | JavaScript |
R_API ut64 r_bin_java_element_pair_calc_size(RBinJavaElementValuePair *evp) {
ut64 sz = 0;
if (evp == NULL) {
return sz;
}
// evp->element_name_idx = r_bin_java_read_short(bin, bin->b->cur);
sz += 2;
// evp->value = r_bin_java_element_value_new (bin, offset+2);
if (evp->value) {
sz += r_bin_java_element_valu... | cwe | CWE-119 | C/C++ |
set_interface_var(const char *iface,
const char *var, const char *name,
uint32_t val)
{
FILE *fp;
char spath[64+IFNAMSIZ]; /* XXX: magic constant */
if (snprintf(spath, sizeof(spath), var, iface) >= sizeof(spath))
return -1;
if (access(spath, F_OK) != 0)
return -1;
fp = fopen(spath, "w");
if (... | cwe | CWE-22 | C/C++ |
static int sctp_init_sock(struct sock *sk)
{
struct net *net = sock_net(sk);
struct sctp_sock *sp;
pr_debug("%s: sk:%p\n", __func__, sk);
sp = sctp_sk(sk);
/* Initialize the SCTP per socket area. */
switch (sk->sk_type) {
case SOCK_SEQPACKET:
sp->type = SCTP_SOCKET_UDP;
break;
case SOCK_STREAM:
sp->ty... | cwe | CWE-362 | C/C++ |
1?0:Ua.y*ia);this.shape.bounds.height=ma.height-(Ta==Ma.length-1?0:(Ua.height+Ua.y)*ia)}this.shape.redraw()}};var Ya=!1;za.setPosition=function(Ua,eb,jb){La=Math.max(Graph.minTableColumnWidth-Ea.width,eb.x-Ua.x-Ea.width);Ya=mxEvent.isShiftDown(jb.getEvent());null==Da||Ya||(La=Math.min(La,Da.width-Graph.minTableColumnWi... | cwe | CWE-20 | JavaScript |
def write_key_to_disk(key, identity)
# Writing is disabled. Don't bother checking any other states.
return unless lookup_config_option('learn_public_keys') =~ /^1|y/
publickey_dir = lookup_config_option('publickey_dir')
unless publickey_dir
Log.info("Public key sent with req... | cwe | CWE-20 | Ruby |
serialNumberAndIssuerSerialCheck(
struct berval *in,
struct berval *sn,
struct berval *is,
struct berval *i_sn, /* contain serial of baseCertificateID */
void *ctx )
{
/* Parse GSER format */
enum {
HAVE_NONE = 0x0,
HAVE_SN = 0x1,
HAVE_ISSUER = 0x2,
HAVE_ALL = ( HAVE_SN | HAVE_ISSUER )
} have = HAVE_NO... | cwe | CWE-191 | Unknown |
path_in(PG_FUNCTION_ARGS)
{
char *str = PG_GETARG_CSTRING(0);
PATH *path;
int isopen;
char *s;
int npts;
int size;
int depth = 0;
if ((npts = pair_count(str, ',')) <= 0)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("invalid input syntax for type path: \... | cwe | CWE-189 | C/C++ |
bool PackLinuxElf32::canPack()
{
union {
unsigned char buf[sizeof(Elf32_Ehdr) + 14*sizeof(Elf32_Phdr)];
//struct { Elf32_Ehdr ehdr; Elf32_Phdr phdr; } e;
} u;
COMPILE_TIME_ASSERT(sizeof(u.buf) <= 512)
fi->seek(0, SEEK_SET);
fi->readx(u.buf, sizeof(u.buf));
fi->seek(0, SEEK_SET);... | cwe | CWE-415 | Unknown |
int af_get_page(AFFILE *af,int64_t pagenum,unsigned char *data,size_t *bytes)
{
uint32_t arg=0;
size_t page_len=0;
if (af_trace){
fprintf(af_trace,"af_get_page(%p,pagenum=%" I64d ",buf=%p,bytes=%u)\n",af,pagenum,data,(int)*bytes);
}
/* Find out the size of the segment and if it is compressed or n... | cwe | CWE-295 | C/C++ |
new mxPoint(l,v),new mxPoint(0,v)],this.isRounded,A,!0);c.end()};mxCellRenderer.registerShape("corner",Ka);mxUtils.extend(bb,mxActor);bb.prototype.redrawPath=function(c,l,x,p,v){c.moveTo(0,0);c.lineTo(0,v);c.end();c.moveTo(p,0);c.lineTo(p,v);c.end();c.moveTo(0,v/2);c.lineTo(p,v/2);c.end()};mxCellRenderer.registerShape(... | cwe | CWE-20 | JavaScript |
int __do_munmap(struct mm_struct *mm, unsigned long start, size_t len,
struct list_head *uf, bool downgrade)
{
unsigned long end;
struct vm_area_struct *vma, *prev, *last;
if ((offset_in_page(start)) || start > TASK_SIZE || len > TASK_SIZE-start)
return -EINVAL;
len = PAGE_ALIGN(len);
end = start + len;
if ... | cwe | CWE-362 | Unknown |
f_mzeval(typval_T *argvars, typval_T *rettv)
{
char_u *str;
char_u buf[NUMBUFLEN];
str = tv_get_string_buf(&argvars[0], buf);
do_mzeval(str, rettv);
} | cwe | CWE-78 | Unknown |
store_rrsets(struct module_env* env, struct reply_info* rep, time_t now,
time_t leeway, int pside, struct reply_info* qrep,
struct regional* region)
{
size_t i;
/* see if rrset already exists in cache, if not insert it. */
for(i=0; i<rep->rrset_count; i++) {
rep->ref[i].key = rep->rrsets[i];
rep->ref[i].id = r... | cwe | CWE-613 | Unknown |
def shame_ask(name):
db = db_connect()
cursor = db.cursor()
try:
cursor.execute('''
SELECT shame FROM people WHERE name='{}'
'''.format(name))
shame = cursor.fetchone()
db.close()
if shame is None:
logger.debug('No shame found for name {}'.... | cwe | CWE-89 | Python |
/*
* sc.c: General functions
*
* Copyright (C) 2001, 2002 Juha Yrjölä <juha.yrjola@iki.fi>
*
* This library 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 the License, ... | cwe | CWE-119 | C/C++ |
static const char *get_ansi_color(THEME_REC *theme, const char *str,
int *fg_ret, int *bg_ret, int *flags_ret)
{
static char ansitab[8] = { 0, 4, 2, 6, 1, 5, 3, 7 };
const char *start;
int fg, bg, flags, num, i;
unsigned int num2;
if (*str != '[')
return str;
start = str++;
fg = fg_ret == NULL || *fg_r... | cwe | CWE-476 | Unknown |
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.... | cwe | CWE-611 | Java |
static int calipso_doi_remove(u32 doi, struct netlbl_audit *audit_info)
{
int ret_val;
struct calipso_doi *doi_def;
struct audit_buffer *audit_buf;
spin_lock(&calipso_doi_list_lock);
doi_def = calipso_doi_search(doi);
if (!doi_def) {
spin_unlock(&calipso_doi_list_lock);
ret_val = -ENOENT;
goto doi_remove_r... | cwe | CWE-416 | Unknown |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# 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.or... | cwe | CWE-668 | Python |
static int get_bitmap_file(struct mddev *mddev, void __user * arg)
{
mdu_bitmap_file_t *file = NULL; /* too big for stack allocation */
char *ptr;
int err;
file = kmalloc(sizeof(*file), GFP_NOIO);
if (!file)
return -ENOMEM;
err = 0;
spin_lock(&mddev->lock);
/* bitmap disabled, zero the first byte and copy o... | cwe | CWE-200 | C/C++ |
static int msr_open(struct inode *inode, struct file *file)
{
unsigned int cpu;
struct cpuinfo_x86 *c;
cpu = iminor(file->f_path.dentry->d_inode);
if (cpu >= nr_cpu_ids || !cpu_online(cpu))
return -ENXIO; /* No such CPU */
c = &cpu_data(cpu);
if (!cpu_has(c, X86_FEATURE_MSR))
return -EIO; /* MSR not s... | cwe | CWE-264 | C/C++ |
static void put_crypt_info(struct fscrypt_info *ci)
{
if (!ci)
return;
key_put(ci->ci_keyring_key);
crypto_free_skcipher(ci->ci_ctfm);
kmem_cache_free(fscrypt_info_cachep, ci);
} | cwe | CWE-416 | Unknown |
void ParamTraits<GURL>::Write(Message* m, const GURL& p) {
DCHECK(p.possibly_invalid_spec().length() <= content::kMaxURLChars);
m->WriteString(p.possibly_invalid_spec());
} | cwe | CWE-264 | C/C++ |
static int recv_stream(struct kiocb *iocb, struct socket *sock,
struct msghdr *m, size_t buf_len, int flags)
{
struct sock *sk = sock->sk;
struct tipc_port *tport = tipc_sk_port(sk);
struct sk_buff *buf;
struct tipc_msg *msg;
long timeout;
unsigned int sz;
int sz_to_copy, target, needed;
int sz_copied ... | cwe | CWE-20 | C/C++ |
static ssize_t pm_qos_latency_tolerance_us_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
s32 value = dev_pm_qos_get_user_latency_tolerance(dev);
if (value < 0)
return sprintf(buf, "auto\n");
if (value == PM_QOS_LATENCY_ANY)
return sprintf(buf, "any\n");
return sprintf(buf, "... | cwe | CWE-787 | Unknown |
long Segment::DoParseNext(const Cluster*& pResult, long long& pos, long& len) {
long long total, avail;
long status = m_pReader->Length(&total, &avail);
if (status < 0) // error
return status;
assert((total < 0) || (avail <= total));
const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size;
lon... | cwe | CWE-20 | C/C++ |
public void save(String comment, boolean minorEdit) throws XWikiException
{
if (hasAccessLevel("edit")) {
// If the current author does not have PR don't let it set current user as author of the saved document
// since it can lead to right escalation
if (hasProgrammingRig... | cwe | CWE-863 | Java |
/** \file env.c
Functions for setting and getting environment variables.
*/
#include "config.h"
#include <stdlib.h>
#include <wchar.h>
#include <string.h>
#include <stdio.h>
#include <locale.h>
#include <unistd.h>
#include <signal.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pthread.... | cwe | CWE-59 | C/C++ |
func TestSkipUnknownTypeBinaryProtocol(t *testing.T) {
var m MyTestStruct
d := NewDeserializer()
f := NewBinaryProtocolFactoryDefault()
d.Protocol = f.GetProtocol(d.Transport)
// skip over a map with invalid key/value type and 1.7B entries
data := []byte("\n\x10\rO\t6\x03\n\n\n\x10\r\n\tslice\x00")
start := time... | cwe | CWE-770 | Go |
long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask,
unsigned long bitmap_size)
{
unsigned long nr_compat_longs;
/* align bitmap up to nearest compat_long_t boundary */
bitmap_size = ALIGN(bitmap_size, BITS_PER_COMPAT_LONG);
nr_compat_longs = BITS_TO_COMPAT_LONGS(bitmap_size);
... | cwe | CWE-20 | Unknown |
static void v9fs_read(void *opaque)
{
int32_t fid;
uint64_t off;
ssize_t err = 0;
int32_t count = 0;
size_t offset = 7;
uint32_t max_count;
V9fsFidState *fidp;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
err = pdu_unmarshal(pdu, offset, "dqd", &fid, &off, &max_count);
if (... | cwe | CWE-399 | Unknown |
htmlParseComment(htmlParserCtxtPtr ctxt) {
xmlChar *buf = NULL;
int len;
int size = HTML_PARSER_BUFFER_SIZE;
int q, ql;
int r, rl;
int cur, l;
xmlParserInputState state;
/*
* Check that there is a comment right here.
*/
if ((RAW != '<') || (NXT(1) != '!') ||
(NXT(2... | cwe | CWE-119 | C/C++ |
NORET_TYPE void do_exit(long code)
{
struct task_struct *tsk = current;
int group_dead;
profile_task_exit(tsk);
WARN_ON(atomic_read(&tsk->fs_excl));
if (unlikely(in_interrupt()))
panic("Aiee, killing interrupt handler!");
if (unlikely(!tsk->pid))
panic("Attempted to kill the idle task!");
tracehook_repor... | cwe | CWE-264 | Unknown |
get_chv_status (app_t app, int sigg, int pwid)
{
unsigned char *result = NULL;
size_t resultlen;
char command[4];
int rc;
if (switch_application (app, sigg))
return sigg? -2 : -1; /* No such PIN / General error. */
command[0] = 0x00;
command[1] = 0x20;
command[2] = 0x00;
command[3] = pwid;
i... | cwe | CWE-20 | Unknown |
add_link_ref(
struct link_ref **references,
const uint8_t *name, size_t name_size)
{
struct link_ref *ref = calloc(1, sizeof(struct link_ref));
if (!ref)
return NULL;
ref->id = hash_link_ref(name, name_size);
ref->next = references[ref->id % REF_TABLE_SIZE];
references[ref->id % REF_TABLE_SIZE] = ref;
retu... | cwe | CWE-20 | C/C++ |
function er(e,t){return[t,e]} | cwe | CWE-601 | JavaScript |
static bool decode_openldap_dereference(void *mem_ctx, DATA_BLOB in, void *_out)
{
void **out = (void **)_out;
struct asn1_data *data = asn1_init(mem_ctx);
struct dsdb_openldap_dereference_result_control *control;
struct dsdb_openldap_dereference_result **r = NULL;
int i = 0;
if (!data) return false;
control = ... | cwe | CWE-399 | Unknown |
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c */
/*
* Copyright (C) 2016 by the Massachusetts Institute of Technology.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted prov... | cwe | CWE-476 | C/C++ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.