code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
cliprdr_process(STREAM s)
{
uint16 type, status;
uint32 length, format;
uint8 *data;
in_uint16_le(s, type);
in_uint16_le(s, status);
in_uint32_le(s, length);
data = s->p;
DEBUG_CLIPBOARD(("CLIPRDR recv: type=%d, status=%d, length=%d\n", type, status, length));
if (status == CLIPRDR_ERROR)
{
switch (type)... | cwe | CWE-787 | Unknown |
/*
* . .o8 oooo
* .o8 "888 `888
* .o888oo oooo d8b oooo oooo .oooo888 .ooooo. .oooo.o 888 oooo
* 888 `888""8P `888 `888 d88' `888 d88' `88b d88( "8 888 .8P'
* 888 888 888 888 8... | cwe | CWE-190 | JavaScript |
self::assertSame($shouldBePresent, $request->hasHeader('Authorization'));
self::assertSame($shouldBePresent, $request->hasHeader('Cookie'));
return new Response(200);
}
]); | cwe | CWE-212 | PHP |
function escapeArgZsh(arg, interpolation, quoted) {
let result = arg.replace(/\u0000/g, "");
if (interpolation) {
result = result
.replace(/\\/g, "\\\\")
.replace(/\n/g, " ")
.replace(/(^|\s)(~|#|=)/g, "$1\\$2")
.replace(/(\*|\?)/g, "\\$1")
.replace(/(\$|\;|\&|\|)/g, "\\$1")
... | cwe | CWE-400 | JavaScript |
find_and_process_abbrev_set (struct dwarf_section *section,
dwarf_vma abbrev_base,
dwarf_vma abbrev_size,
dwarf_vma abbrev_offset,
abbrev_list **free_list)
{
if (free_list)
*free_list = NULL;
if (abbrev_base >= section->size
|| abbrev_size > section->size - abbrev_base)
... | cwe | CWE-703 | Unknown |
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/ory/fosite/storage (interfaces: Transactional)
// Package internal is a generated GoMock package.
package internal
import (
context "context"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
)
// MockTransactional is a mock of Transactional... | cwe | CWE-345 | Go |
function ToolbarLink(props) {
return <a
className={classnames('maputnik-toolbar-link', props.className)}
href={props.href}
target={"blank"}
>
{props.children}
</a>
} | cwe | CWE-200 | JavaScript |
sysapi_translate_arch( const char *machine, const char *)
{
char tmp[64];
char *tmparch;
#if defined(AIX)
/* AIX machines have a ton of different models encoded into the uname
structure, so go to some other function to decode and group the
architecture together */
struct utsname buf;
if( uname(&buf) < 0 ) {
... | cwe | CWE-134 | C/C++ |
static ssize_t soc_info_get(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct soc_device *soc_dev = container_of(dev, struct soc_device, dev);
if (attr == &dev_attr_machine)
return sprintf(buf, "%s\n", soc_dev->attr->machine);
if (attr == &dev_attr_family)
return sprintf(buf, ... | cwe | CWE-787 | Unknown |
static create(data) {
const node = super.create();
const denotationChar = document.createElement("span");
denotationChar.className = "ql-mention-denotation-char";
denotationChar.innerHTML = data.denotationChar;
node.appendChild(denotationChar);
node.innerHTML += data.value;
return MentionBlo... | cwe | CWE-79 | JavaScript |
function refresh()
{
layerCount = graph.model.getChildCount(graph.model.root)
listDiv.innerHTML = '';
layerDivs.clear();
function addLayer(index, label, child, defaultParent)
{
var ldiv = document.createElement('div');
ldiv.className = 'geToolbarContainer';
layerDivs.put(child, ldiv);
ldiv.st... | cwe | CWE-94 | JavaScript |
getAndCreate = function(path, object, defaultValue) {
var aPath, key, value;
if (object == null) {
return;
}
if (!isObject(object)) {
return;
}
aPath = ("" + path).split(".");
value = object;
key = aPath.shift();
if (key === 'constructor' && typeof o... | cwe | CWE-1321 | JavaScript |
def wrapper(request, *args, **kwargs):
if request.user.is_authenticated:
return redirect(request.GET.get('next', request.user.st.get_absolute_url()))
return view_func(request, *args, **kwargs) | cwe | CWE-601 | Python |
def getFileCacheID(self, pth):
"""
Returns ID of a cached file on Telegram from DB. None if file doesn't exist or has no cached ID.
:param pth:
:return:
"""
command = "SELECT file_id FROM {0} WHERE path='{1}'".format(TABLE_NAME, pth)
data = self._run_command(command)
try:
data = data[0][0]
except ... | cwe | CWE-89 | Python |
int perf_event_refresh(struct perf_event *event, int refresh)
{
/*
* not supported on inherited events
*/
if (event->attr.inherit || !is_sampling_event(event))
return -EINVAL;
atomic_add(refresh, &event->event_limit);
perf_event_enable(event);
return 0;
} | cwe | CWE-264 | C/C++ |
dwg_decode_add_object (Dwg_Data *restrict dwg, Bit_Chain *dat,
Bit_Chain *hdl_dat, long unsigned int address)
{
long unsigned int objpos, restartpos;
Bit_Chain abs_dat = { NULL };
unsigned char previous_bit;
Dwg_Object *restrict obj;
BITCODE_BL num = dwg->num_objects;
int error = 0;
... | cwe | CWE-835 | Unknown |
#include "LogHandler.hpp"
INITIALIZE_EASYLOGGINGPP
namespace et {
el::Configurations LogHandler::setupLogHandler(int *argc, char ***argv) {
// easylogging parse verbose arguments, see [Application Arguments]
// in https://github.com/muflihun/easyloggingpp/blob/master/README.md
START_EASYLOGGINGPP(*argc, *argv);... | cwe | CWE-362 | C/C++ |
dbd_st_prepare(
SV *sth,
imp_sth_t *imp_sth,
char *statement,
SV *attribs)
{
int i;
SV **svp;
dTHX;
#if MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION
#if MYSQL_VERSION_ID < CALL_PLACEHOLDER_VERSION
char *str_ptr, *str_last_ptr;
#if MYSQL_VERSION_ID < LIMIT_PLACEHOLDER_VERSION
int limit_flag=0;
#endif
#en... | cwe | CWE-125 | C/C++ |
/* Copyright 2015 The TensorFlow 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.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-617 | Python |
// mkerrors.sh -m64
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build arm64,freebsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
package unix
import "syscall"
const (
AF_APPLETALK = 0x10
AF_ARP = 0x23
AF... | cwe | CWE-287 | Go |
def _modify_3par_fibrechan_host(self, hostname, wwn):
# when using -add, you can not send the persona or domain options
out = self.common._cli_run('createhost -add %s %s'
% (hostname, " ".join(wwn)), None) | cwe | CWE-78 | Python |
public static SocketFactory getSocketFactory(Properties info) throws PSQLException {
// Socket factory
String socketFactoryClassName = PGProperty.SOCKET_FACTORY.get(info);
if (socketFactoryClassName == null) {
return SocketFactory.getDefault();
}
try {
return (SocketFactory) ObjectFactor... | cwe | CWE-665 | Java |
/* Copyright 2017 The TensorFlow 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.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-476 | Python |
/* Copyright 2015 The TensorFlow 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.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-754 | C/C++ |
XRRGetMonitors(Display *dpy, Window window, Bool get_active, int *nmonitors)
{
XExtDisplayInfo *info = XRRFindDisplay(dpy);
xRRGetMonitorsReply rep;
xRRGetMonitorsReq *req;
int nbytes, nbytesRead, rbytes;
int nmon, noutput;
int m, o;
char *buf, *buf_head;
... | cwe | CWE-787 | C/C++ |
RawTile KakaduImage::getRegion( int seq, int ang, unsigned int res, int layers, int x, int y, unsigned int w, unsigned int h )
{
// Scale up our output bit depth to the nearest factor of 8
unsigned int obpc = bpc;
if( bpc <= 16 && bpc > 8 ) obpc = 16;
else if( bpc <= 8 ) obpc = 8;
#ifdef DEBUG
Timer timer;
... | cwe | CWE-190 | C/C++ |
TPMI_ST_COMMAND_TAG_Unmarshal(TPMI_ST_COMMAND_TAG *target, BYTE **buffer, INT32 *size)
{
TPM_RC rc = TPM_RC_SUCCESS;
if (rc == TPM_RC_SUCCESS) {
rc = TPM_ST_Unmarshal(target, buffer, size);
}
if (rc == TPM_RC_SUCCESS) {
switch (*target) {
case TPM_ST_NO_SESSIONS:
case TPM_ST_SESSIONS:
br... | cwe | CWE-787 | Unknown |
static int test_sm2_crypt(const EC_GROUP *group,
const EVP_MD *digest,
const char *privkey_hex,
const char *message,
const char *k_hex, const char *ctext_hex)
{
const size_t msg_len = strlen(message);
BIGNUM ... | cwe | CWE-120 | Unknown |
long mkvparser::UnserializeInt(IMkvReader* pReader, long long pos, long size,
long long& result) {
assert(pReader);
assert(pos >= 0);
assert(size > 0);
assert(size <= 8);
{
signed char b;
const long status = pReader->Read(pos, 1, (unsigned char*)&b);
if (status... | cwe | CWE-20 | C/C++ |
Status GetFirstDimensionSize(OpKernelContext* context, INDEX_TYPE* result) {
const Tensor first_partition_tensor =
context->input(kFirstPartitionInputIndex);
const RowPartitionType first_partition_type = row_partition_types_[0];
switch (first_partition_type) {
case RowPartitionType::FIRST_DIM_... | cwe | CWE-125 | C/C++ |
def make_hs256_token(payload = nil)
payload = { sub: 'abc123' } if payload.nil?
JWT.encode payload, client_secret, 'HS256'
end | cwe | CWE-287 | Ruby |
void GaiaOAuthClient::Core::RefreshToken(
const OAuthClientInfo& oauth_client_info,
const std::string& refresh_token,
GaiaOAuthClient::Delegate* delegate) {
DCHECK(!request_.get()) << "Tried to fetch two things at once!";
delegate_ = delegate;
access_token_.clear();
expires_in_seconds_ = 0;
std... | cwe | CWE-399 | C/C++ |
xfs_agf_verify(
struct xfs_buf *bp)
{
struct xfs_mount *mp = bp->b_mount;
struct xfs_agf *agf = XFS_BUF_TO_AGF(bp);
if (xfs_sb_version_hascrc(&mp->m_sb)) {
if (!uuid_equal(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid))
return __this_address;
if (!xfs_log_check_lsn(mp,
be64_to_cpu(XFS_BUF_TO_AGF(bp)->agf_lsn... | cwe | CWE-703 | C/C++ |
def self.open(path_or_url, ext = nil, options = {})
options, ext = ext, nil if ext.is_a?(Hash)
ext ||=
if File.exist?(path_or_url)
File.extname(path_or_url)
else
File.extname(URI(path_or_url).path)
end
ext.sub!(/:.*/, '') # hack for filenames or URLs that ... | cwe | CWE-78 | Ruby |
BuildIndexValueDescription(Relation indexRelation,
Datum *values, bool *isnull)
{
StringInfoData buf;
int natts = indexRelation->rd_rel->relnatts;
int i;
initStringInfo(&buf);
appendStringInfo(&buf, "(%s)=(",
pg_get_indexdef_columns(RelationGetRelid(indexRelation),
true));
for (i ... | cwe | CWE-209 | Unknown |
void csync_daemon_session()
{
static char line[4 * 4096];
struct stat sb;
address_t peername = { .sa.sa_family = AF_UNSPEC, };
socklen_t peerlen = sizeof(peername);
char *peer=0, *tag[32];
int i;
if (fstat(0, &sb))
csync_fatal("Can't run fstat on fd 0: %s", strerror(errno));
switch (sb.st_mode & S_IFMT) {
... | cwe | CWE-703 | C/C++ |
async function httpRedirectFetch (fetchParams, response) {
// 1. Let request be fetchParams’s request.
const request = fetchParams.request
// 2. Let actualResponse be response, if response is not a filtered response,
// and response’s internal response otherwise.
const actualResponse = response.internalRespo... | cwe | CWE-200 | JavaScript |
from typing import Any, List
import vyper.utils as util
from vyper.address_space import CALLDATA, DATA, MEMORY
from vyper.ast.signatures.function_signature import FunctionSignature, VariableRecord
from vyper.codegen.context import Context
from vyper.codegen.core import get_element_ptr, getpos, make_setter
from vyper.c... | cwe | CWE-190 | Python |
gen_assignment(codegen_scope *s, node *tree, node *rhs, int sp, int val)
{
int idx;
int type = nint(tree->car);
switch (type) {
case NODE_GVAR:
case NODE_ARG:
case NODE_LVAR:
case NODE_IVAR:
case NODE_CVAR:
case NODE_CONST:
case NODE_NIL:
case NODE_MASGN:
if (rhs) {
codegen(s, rhs, VAL)... | cwe | CWE-125 | C/C++ |
static int fsmMkdir(const char *path, mode_t mode)
{
int rc = mkdir(path, (mode & 07777));
if (_fsm_debug)
rpmlog(RPMLOG_DEBUG, " %8s (%s, 0%04o) %s\n", __func__,
path, (unsigned)(mode & 07777),
(rc < 0 ? strerror(errno) : ""));
if (rc < 0) rc = RPMERR_MKDIR_FAILED;
return rc;
} | cwe | CWE-59 | C/C++ |
void add_param_to_argv(char *parsestart, int line)
{
int quote_open = 0, escaped = 0, param_len = 0;
char param_buffer[1024], *curchar;
/* After fighting with strtok enough, here's now
* a 'real' parser. According to Rusty I'm now no
} else {
param_buffer[param_len++] = *curchar;
for (curchar = parse... | cwe | CWE-787 | C/C++ |
http_rxchunk(struct http *hp)
{
char *q;
int l, i;
l = hp->prxbuf;
do
(void)http_rxchar(hp, 1, 0);
while (hp->rxbuf[hp->prxbuf - 1] != '\n');
vtc_dump(hp->vl, 4, "len", hp->rxbuf + l, -1);
i = strtoul(hp->rxbuf + l, &q, 16);
bprintf(hp->chunklen, "%d", i);
if ((q == hp->rxbuf + l) ||
(*q != '\0' && !vct_i... | cwe | CWE-269 | 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 |
static int read_rindex_entry(struct gfs2_inode *ip)
{
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
const unsigned bsize = sdp->sd_sb.sb_bsize;
loff_t pos = sdp->sd_rgrps * sizeof(struct gfs2_rindex);
struct gfs2_rindex buf;
int error;
struct gfs2_rgrpd *rgd;
if (pos >= i_size_read(&ip->i_inode))
return 1;
... | cwe | CWE-416 | C/C++ |
/*jshint laxbreak:true */
var sizeParser = require('filesize-parser');
var exec = require('child_process').exec, child;
module.exports = function(path, opts, cb) {
if (!cb) {
cb = opts;
opts = {};
}
var cmd = module.exports.cmd(path, opts);
opts.timeout = opts.timeout || 5000;
exec(cmd, opts, func... | cwe | CWE-74 | JavaScript |
const bootbox = require('bootbox');
require('./Requisitions');
/**
* @author Alejandro Galue <agalue@opennms.org>
* @copyright 2014 The OpenNMS Group, Inc.
*/
(function() {
'use strict';
angular.module('onms-requisitions')
/**
* @ngdoc service
* @name SynchronizeService
* @module onms-requisitions
*... | cwe | CWE-352 | Java |
__poll_t psi_trigger_poll(void **trigger_ptr,
struct file *file, poll_table *wait)
{
__poll_t ret = DEFAULT_POLLMASK;
struct psi_trigger *t;
if (static_branch_likely(&psi_disabled))
return DEFAULT_POLLMASK | EPOLLERR | EPOLLPRI;
rcu_read_lock();
t = rcu_dereference(*(void __rcu __force **)trigger_ptr);
i... | cwe | CWE-416 | Unknown |
AnsiUp.prototype.escape_txt_for_html = function (txt) {
return txt.replace(/[&<>]/gm, function (str) {
if (str === "&")
return "&";
if (str === "<")
return "<";
if (str === ">")
return ">";
});
}; | cwe | CWE-79 | JavaScript |
def vote(request, pk):
# TODO: check if user has access to this topic/poll
poll = get_object_or_404(
CommentPoll.objects.unremoved(),
pk=pk
)
if not request.user.is_authenticated:
return redirect_to_login(next=poll.get_absolute_url())
form = PollVoteManyForm(user=request.us... | cwe | CWE-601 | Python |
public VFSLeaf createChildLeaf(String name) {
File fNewFile = new File(getBasefile(), name);
try {
if(!fNewFile.getParentFile().exists()) {
fNewFile.getParentFile().mkdirs();
}
if (!fNewFile.createNewFile()) {
log.warn("Could not create a new leaf::" + name + " in container::" + getBasefile().getAb... | cwe | CWE-22 | Java |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const bool is_soft_nms = NumInputs(node) == 6;
const TfLiteTensor* input_boxes = GetInput(context, node, kInputTensorBoxes);
const int num_boxes = SizeOfDimension(input_boxes, 0);
const TfLiteTensor* input_scores =
GetInput(context, node, kInp... | cwe | CWE-125 | C/C++ |
TfLiteStatus HardSwishPrepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_STATUS(GenericPrepare(context, node));
TfLiteTensor* output = GetOutput(context, node, 0);
if (output->type == kTfLiteUInt8 || output->type == kTfLiteInt8) {
HardSwishData* data = static_cast<HardSwishData*>(node->user_d... | cwe | CWE-125 | C/C++ |
/*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2002-2014 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc.
*
* OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
*
* OpenNMS(... | cwe | CWE-79 | Java |
TfLiteStatus EluEval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input = GetInput(context, node, 0);
TfLiteTensor* output = GetOutput(context, node, 0);
switch (input->type) {
case kTfLiteFloat32: {
optimized_ops::Elu(GetTensorShape(input), GetTensorData<float>(input),
... | cwe | CWE-787 | C/C++ |
static long aio_read_events_ring(struct kioctx *ctx,
struct io_event __user *event, long nr)
{
struct aio_ring *ring;
unsigned head, tail, pos;
long ret = 0;
int copy_ret;
mutex_lock(&ctx->ring_lock);
/* Access to ->ring_pages here is protected by ctx->ring_lock. */
ring = kmap_atomic(ctx->ring_pages[0]);... | cwe | CWE-200 | C/C++ |
static int newque(struct ipc_namespace *ns, struct ipc_params *params)
{
struct msg_queue *msq;
int id, retval;
key_t key = params->key;
int msgflg = params->flg;
msq = ipc_rcu_alloc(sizeof(*msq));
if (!msq)
return -ENOMEM;
msq->q_perm.mode = msgflg & S_IRWXUGO;
msq->q_perm.key = key;
msq->q_perm.security... | cwe | CWE-362 | C/C++ |
l2tp_ppp_discon_cc_print(netdissect_options *ndo, const u_char *dat, u_int length)
{
const uint16_t *ptr = (const uint16_t *)dat;
ND_PRINT((ndo, "%04x, ", EXTRACT_16BITS(ptr))); ptr++; /* Disconnect Code */
ND_PRINT((ndo, "%04x ", EXTRACT_16BITS(ptr))); ptr++; /* Control Protocol Number */
ND_PRINT((ndo, "%s", to... | cwe | CWE-125 | C/C++ |
static void file_change(struct diff_options *options,
unsigned old_mode, unsigned new_mode,
const unsigned char *old_sha1,
const unsigned char *new_sha1,
const char *base, const char *path)
{
tree_difference = REV_TREE_DIFFERENT;
DIFF_OPT_SET(options, HAS_CHANGES);
} | cwe | CWE-119 | Unknown |
get_matching_model_microcode(int cpu, unsigned long start,
void *data, size_t size,
struct mc_saved_data *mc_saved_data,
unsigned long *mc_saved_in_initrd,
struct ucode_cpu_info *uci)
{
u8 *ucode_ptr = data;
unsigned int leftover = size;
enum ucode_state state = UCODE_OK;
unsigned in... | cwe | CWE-119 | C/C++ |
static void parseAuthUsers(HttpRoute *route, cchar *key, MprJson *prop)
{
MprJson *child;
cchar *roles, *password;
int ji;
for (ITERATE_CONFIG(route, prop, child, ji)) {
password = mprGetJson(child, "password");
roles = getList(mprGetJsonObj(child, "roles"));
i... | cwe | CWE-476 | C/C++ |
def extend_volume(self, volume, new_size):
LOG.debug(_('enter: extend_volume: volume %s') % volume['id'])
ret = self._ensure_vdisk_no_fc_mappings(volume['name'],
allow_snaps=False)
if not ret:
exception_message = (_('extend_volume: Exte... | cwe | CWE-78 | Python |
void AOClient::pktEditEvidence(AreaData* area, int argc, QStringList argv, AOPacket packet)
{
if (!checkEvidenceAccess(area))
return;
bool is_int = false;
int idx = argv[0].toInt(&is_int);
AreaData::Evidence evi = {argv[1], argv[2], argv[3]};
if (is_int && idx <= area->evidence().size() && i... | cwe | CWE-129 | C/C++ |
static bool on_accept(private_stroke_socket_t *this, stream_t *stream)
{
stroke_msg_t *msg;
uint16_t len;
FILE *out;
/* read length */
if (!stream->read_all(stream, &len, sizeof(len)))
{
if (errno != EWOULDBLOCK)
{
DBG1(DBG_CFG, "reading length of stroke message failed: %s",
strerror(errno));
... | cwe | CWE-787 | Unknown |
static int writeBufferToSeparateTiles (TIFF* out, uint8* buf, uint32 imagelength,
uint32 imagewidth, tsample_t spp,
struct dump_opts * dump)
{
tdata_t obuf = _TIFFmalloc(TIFFTileSize(out));
uint32 tl, tw;
uint32 row, col, nrow, ncol;
uint32 src_rowsize, col_o... | cwe | CWE-125 | Unknown |
ZSTD_buildCTable(void* dst, size_t dstCapacity,
FSE_CTable* nextCTable, U32 FSELog, symbolEncodingType_e type,
U32* count, U32 max,
const BYTE* codeTable, size_t nbSeq,
const S16* defaultNorm, U32 defaultNormLog, U32 defaultMax,
const FSE_C... | cwe | CWE-362 | C/C++ |
res_nmkquery(res_state statp,
int op, /* opcode of query */
const char *dname, /* domain name */
int class, int type, /* class and type of query */
const u_char *data, /* resource record data */
int datalen, /* length of data */
const u_char *newrr_in, /* new rr for modify or app... | cwe | CWE-476 | Unknown |
status_t IPCThreadState::executeCommand(int32_t cmd)
{
BBinder* obj;
RefBase::weakref_type* refs;
status_t result = NO_ERROR;
switch ((uint32_t)cmd) {
case BR_ERROR:
result = mIn.readInt32();
break;
case BR_OK:
break;
case BR_ACQUIRE:
refs = (RefBase::weakref_type*)mIn.readPointer();
... | cwe | CWE-264 | C/C++ |
/*
* chsh.c -- change your login shell
* (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 no warr... | cwe | CWE-209 | C/C++ |
get_pka_info (const char *address, unsigned char *fpr)
{
#ifdef USE_ADNS
int rc;
adns_state state;
const char *domain;
char *name;
adns_answer *answer = NULL;
char *buffer = NULL;
domain = strrchr (address, '@');
if (!domain || domain == address || !domain[1])
return NULL; /* Invalid mail address g... | cwe | CWE-20 | Unknown |
def retrieve_video(id, playlist_id, db):
db.execute("SELECT id, position from video WHERE id={id} and playlist_id={playlist_id};".format(
id=id, playlist_id=playlist_id))
row = db.fetchone()
return row | cwe | CWE-89 | Python |
static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
Image *image, *image2=NULL,
*rotated_image;
register Quantum *q;
unsigned int status;
MATHeader MATLAB_HDR;
size_t size;
size_t CellType;
QuantumInfo *quantum_info;
ImageInfo *clone_info;
int i;
ssize_t ldblk;
... | cwe | CWE-125 | C/C++ |
void isis_notif_max_area_addr_mismatch(const struct isis_circuit *circuit,
uint8_t max_area_addrs,
const char *raw_pdu, size_t raw_pdu_len)
{
const char *xpath = "/frr-isisd:max-area-addresses-mismatch";
struct list *arguments = yang_data_list_new();
char xpath_arg[XPATH_MAXLEN];
struct yang_d... | cwe | CWE-787 | Unknown |
static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset)
{
MXFContext *mxf = arg;
int item_num = avio_rb32(pb);
int item_len = avio_rb32(pb);
if (item_len != 18) {
avpriv_request_sample(pb, "Primer pack item length %d", item_len);
retur... | cwe | CWE-20 | Unknown |
context_length_arg (char const *str, int *out)
{
uintmax_t value;
if (! (xstrtoumax (str, 0, 10, &value, "") == LONGINT_OK
&& 0 <= (*out = value)
&& *out == value))
{
error (EXIT_TROUBLE, 0, "%s: %s", str,
_("invalid context length argument"));
}
page size, unles... | cwe | CWE-189 | Unknown |
mxCodecRegistry.register(function(){var a=new mxObjectCodec(new mxCell,["children","edges","overlays","mxTransient"],["parent","source","target"]);a.isCellCodec=function(){return!0};a.isNumericAttribute=function(b,c,d){return"value"!==c.nodeName&&mxObjectCodec.prototype.isNumericAttribute.apply(this,arguments)};a.isExc... | cwe | CWE-94 | JavaScript |
'use strict'
import './polyfills'
import naturalSort from 'javascript-natural-sort'
import jsonrepair from 'jsonrepair'
import jsonlint from './assets/jsonlint/jsonlint'
import jsonMap from 'json-source-map'
import { translate } from './i18n'
const MAX_ITEMS_FIELDS_COLLECTION = 10000
const YEAR_2000 = 946684800000
/... | cwe | CWE-400 | JavaScript |
static gboolean avdtp_setconf_cmd(struct avdtp *session, uint8_t transaction,
struct setconf_req *req, unsigned int size)
{
struct conf_rej rej;
struct avdtp_local_sep *sep;
struct avdtp_stream *stream;
uint8_t err, category = 0x00;
struct btd_service *service;
GSList *l;
if (size < sizeof(struct setconf_re... | cwe | CWE-703 | Unknown |
it 'returns a list of all private messages that has been archived' do
UserArchivedMessage.archive!(user_2.id, private_message)
GroupArchivedMessage.archive!(user_2.id, group_message)
topics = TopicQuery.new(nil).list_private_messages_all_archive(user_2).topics
expect(topics).to contain_exactly... | cwe | CWE-863 | Ruby |
def _delete_3par_host(self, hostname):
self._cli_run('removehost %s' % hostname, None) | cwe | CWE-78 | Python |
static Image *ReadMATImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
Image *image, *image2=NULL,
*rotated_image;
register Quantum *q;
unsigned int status;
MATHeader MATLAB_HDR;
size_t size;
size_t CellType;
QuantumInfo *quantum_info;
ImageInfo *clone_info;
int i;
ssize_t ldblk;
u... | cwe | CWE-416 | C/C++ |
/*
* File operations used by nfsd. Some of these have been ripped from
* other parts of the kernel because they weren't exported, others
* are partial duplicates with added or changed functionality.
*
* Note that several functions dget() the dentry upon which they want
* to act, most notably those that create dir... | cwe | CWE-404 | C/C++ |
evbuffer_add(struct evbuffer *buf, const void *data, size_t datlen)
{
size_t need = buf->misalign + buf->off + datlen;
size_t oldoff = buf->off;
if (buf->totallen < need) {
if (evbuffer_expand(buf, datlen) == -1)
return (-1);
}
memcpy(buf->buffer + buf->off, data, datlen);
buf->off += datlen;
if (datlen ... | cwe | CWE-189 | C/C++ |
PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, zend_bool *has_port)
{
char port_buf[6];
php_url *ret = ecalloc(1, sizeof(php_url));
char const *s, *e, *p, *pp, *ue;
*has_port = 0;
s = str;
ue = s + length;
/* parse scheme */
if ((e = memchr(s, ':', length)) && e != s) {
/* validate scheme... | cwe | CWE-20 | Unknown |
/**
* Copyright (c) 2006-2016, JGraph Ltd
*/
/**
* No CSS and resources available in embed mode. Parameters and docs:
* https://www.diagrams.net/doc/faq/embed-html-options
*/
GraphViewer = function(container, xmlNode, graphConfig)
{
this.init(container, xmlNode, graphConfig);
};
// Editor inherits from mxEventSo... | cwe | CWE-94 | JavaScript |
static inline bool kvm_apic_has_events(struct kvm_vcpu *vcpu)
{
return vcpu->arch.apic->pending_events;
} | cwe | CWE-703 | C/C++ |
opj_pi_iterator_t *opj_pi_create_decode(opj_image_t *p_image,
opj_cp_t *p_cp,
OPJ_UINT32 p_tile_no)
{
OPJ_UINT32 numcomps = p_image->numcomps;
/* loop */
OPJ_UINT32 pino;
OPJ_UINT32 compno, resno;
/* to store w, h, dx ... | cwe | CWE-122 | Unknown |
int HevcSpsUnit::deserialize()
{
int rez = HevcUnit::deserialize();
if (rez)
return rez;
try
{
vps_id = m_reader.getBits(4);
int max_sub_layers_minus1 = m_reader.getBits(3);
if (max_sub_layers_minus1 > 6)
return 1;
max_sub_layers = max_sub_layers_minus... | cwe | CWE-22 | Unknown |
package api
type Resource struct {
ID int `json:"id"`
// Standard fields
CreatorID int `json:"creatorId"`
CreatedTs int64 `json:"createdTs"`
UpdatedTs int64 `json:"updatedTs"`
// Domain specific fields
Filename string `json:"filename"`
Blob []byte `json:"-"`
Type string `json:"type"`
Size int... | cwe | CWE-284 | Go |
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/ory/fosite/handler/oauth2 (interfaces: CoreStorage)
// 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"
)
// MockCo... | cwe | CWE-345 | Go |
static inline int pmd_large(pmd_t pte)
{
return (pmd_flags(pte) & (_PAGE_PSE | _PAGE_PRESENT)) ==
(_PAGE_PSE | _PAGE_PRESENT);
} | cwe | CWE-119 | Unknown |
/*
* Copyright 2021 ThoughtWorks, 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | cwe | CWE-200 | Java |
IW_IMPL(int) iw_get_i32le(const iw_byte *b)
{
return (iw_int32)(iw_uint32)(b[0] | (b[1]<<8) | (b[2]<<16) | (b[3]<<24));
} | cwe | CWE-682 | C/C++ |
nsPluginInstance::setupCookies(const std::string& pageurl)
{
std::string::size_type pos;
pos = pageurl.find("/", pageurl.find("//", 0) + 2) + 1;
std::string url = pageurl.substr(0, pos);
std::string ncookie;
char *cookie = 0;
uint32_t length = 0;
NPError rv = NPERR_GENERIC_ERROR;
#if NPA... | cwe | CWE-264 | Unknown |
void ion_free(struct ion_client *client, struct ion_handle *handle)
{
bool valid_handle;
BUG_ON(client != handle->client);
mutex_lock(&client->lock);
valid_handle = ion_handle_validate(client, handle);
if (!valid_handle) {
WARN(1, "%s: invalid handle passed to free.\n", __func__);
mutex_unlock(&client->lock... | cwe | CWE-284 | Unknown |
ns_nprint(netdissect_options *ndo,
register const u_char *cp, register const u_char *bp)
{
register u_int i, l;
register const u_char *rp = NULL;
register int compress = 0;
int chars_processed;
int elt;
int data_size = ndo->ndo_snapend - bp;
if ((l = labellen(ndo, cp)) == (u_int)-1)
return(NULL);
i... | cwe | CWE-835 | C/C++ |
/*
* PgBouncer - Lightweight connection pooler for PostgreSQL.
*
* Copyright (c) 2007-2009 Marko Kreen, Skype Technologies OÜ
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permis... | cwe | CWE-287 | C/C++ |
// Copyright 2017 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 "components/url_formatter/idn_spoof_checker.h"
#include "base/no_destructor.h"
#include "base/numerics/safe_conversions.h"
#include "base/string... | cwe | CWE-20 | C/C++ |
/* Apache 2.0 - Copyright 2007-2022 - pancake and dso
class.c rewrite: Adam Pridgen <dso@rice.edu || adam.pridgen@thecoverofnight.com>
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <r_types.h>
#include <r_util.h>
#include <r_bin.h>
#include <math.h>
#include <sdb.h>
#inc... | cwe | CWE-125 | C/C++ |
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <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 the
* <a href="http://www.apache... | cwe | CWE-91 | Java |
success: function (message) {
input.replaceWith('<span data-tag-id="' + id + '">' + input.val() + '</span>');
$('span[data-tag-id="' + id + '"]').append(' ✓');
$('#saving_data_indicator').html('✓ ' + message);
} | cwe | CWE-79 | JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.