code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
void ConnectionManagerImpl::ActiveStream::recreateStream(
StreamInfo::FilterStateSharedPtr filter_state) {
// n.b. we do not currently change the codecs to point at the new stream
// decoder because the decoder callbacks are complete. It would be good to
// null out that pointer but should not be necessary.
... | cwe | CWE-416 | Unknown |
static int crypto_report_acomp(struct sk_buff *skb, struct crypto_alg *alg)
{
struct crypto_report_acomp racomp;
strlcpy(racomp.type, "acomp", sizeof(racomp.type));
if (nla_put(skb, CRYPTOCFGA_REPORT_ACOMP,
sizeof(struct crypto_report_acomp), &racomp))
goto nla_put_failure;
return 0;
nla_put_failure:
re... | cwe | CWE-200 | Unknown |
public static String getAttachedFilePath(String inputStudyOid) {
// Using a standard library to validate/Sanitize user inputs which will be used in path expression to prevent from path traversal
String studyOid = FilenameUtils.getName(inputStudyOid);
String attachedFilePath = CoreResources.getField("... | cwe | CWE-22 | Java |
pci_lintr_assert(struct pci_vdev *dev)
{
assert(dev->lintr.pin > 0);
pthread_mutex_lock(&dev->lintr.lock);
if (dev->lintr.state == IDLE) {
if (pci_lintr_permitted(dev)) {
dev->lintr.state = ASSERTED;
pci_irq_assert(dev);
} else
dev->lintr.state = PENDING;
}
pthread_mutex_unlock(&dev->lintr.lock);
} | cwe | CWE-617 | C/C++ |
ns_client_error(ns_client_t *client, isc_result_t result) {
dns_message_t *message = NULL;
dns_rcode_t rcode;
bool trunc = false;
REQUIRE(NS_CLIENT_VALID(client));
CTRACE("error");
message = client->message;
if (client->rcode_override == -1) {
rcode = dns_result_torcode(result);
} else {
rcode = (dns_rc... | cwe | CWE-617 | C/C++ |
get_function_args(
char_u **argp,
char_u endchar,
garray_T *newargs,
garray_T *argtypes, // NULL unless using :def
int types_optional, // types optional if "argtypes" is not NULL
evalarg_T *evalarg, // context or NULL
int *varargs,
garray_T *default_args,
int skip,
exarg_T *ea... | cwe | CWE-416 | C/C++ |
evbuffer_copyout(struct evbuffer *buf, void *data_out, size_t datlen)
{
/*XXX fails badly on sendfile case. */
struct evbuffer_chain *chain;
char *data = data_out;
size_t nread;
ev_ssize_t result = 0;
EVBUFFER_LOCK(buf);
chain = buf->first;
if (datlen >= buf->total_len)
datlen = buf->total_len;
if (datle... | cwe | CWE-189 | Unknown |
static int mxf_parse_structural_metadata(MXFContext *mxf)
{
MXFPackage *material_package = NULL;
int i, j, k, ret;
av_log(mxf->fc, AV_LOG_TRACE, "metadata sets count %d\n", mxf->metadata_sets_count);
/* TODO: handle multiple material packages (OP3x) */
for (i = 0; i < mxf->packages_count; i++) {
... | cwe | CWE-125 | Unknown |
public function jsonError(Exception $exception) {
$message = $exception->getMessage();
$code = $this->getHttpStatusCode($exception);
return new JSONResponse(
[
'message' => $message . ' (' . $code . ')',
'success' => false
],
$code
);
} | cwe | CWE-79 | PHP |
over : function(e, ui) {
var hash = fm.cwd().hash;
$.each(ui.helper.data('files'), function(i, h) {
if (fm.file(h).phash == hash) {
cwd.removeClass(clDropActive);
return false;
}
});
} | cwe | CWE-89 | JavaScript |
obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena)
{
PyObject* tmp = NULL;
identifier name;
identifier asname;
if (_PyObject_HasAttrId(obj, &PyId_name)) {
int res;
tmp = _PyObject_GetAttrId(obj, &PyId_name);
if (tmp == NULL) goto failed;
res = obj2ast_identifier... | cwe | CWE-125 | C/C++ |
dissect_blip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, _U_ void *data)
{
proto_tree *blip_tree;
gint offset = 0;
/* Set the protcol column to say BLIP */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BLIP");
/* Clear out stuff in the info column */
col_clear(pinfo->cinfo,COL_INFO);
// ------------------... | cwe | CWE-476 | Unknown |
def __init__(self, **kwargs):
"""Initialize HTMLSerializer.
Keyword options (default given first unless specified) include:
inject_meta_charset=True|False
Whether it insert a meta element to define the character set of the
document.
quote_attr_values=True|False
... | cwe | CWE-79 | Python |
package com.salesmanager.shop.admin.controller.products;
import com.salesmanager.core.business.services.catalog.category.CategoryService;
import com.salesmanager.core.business.services.catalog.product.ProductService;
import com.salesmanager.core.business.utils.ajax.AjaxPageableResponse;
import com.salesmanager.core.bu... | cwe | CWE-639 | Java |
static bool pdb_samba_dsdb_set_trusteddom_pw(struct pdb_methods *m,
const char* domain, const char* pwd,
const struct dom_sid *sid)
{
struct pdb_samba_dsdb_state *state = talloc_get_type_abort(
m->private_data, struct pdb_samba_dsdb_state);
TALLOC_CTX *tmp_ctx = talloc_stackframe();
const char ... | cwe | CWE-200 | Unknown |
print_set_output(char *name, TBOOLEAN datablock, TBOOLEAN append_p)
{
if (print_out && print_out != stderr && print_out != stdout) {
#ifdef PIPES
if (print_out_name[0] == '|') {
if (0 > pclose(print_out))
perror(print_out_name);
} else
#endif
if (0 > fclose(print_out))
perror(print_out_name);
}
... | cwe | CWE-415 | Unknown |
secret_core_crt (gcry_mpi_t M, gcry_mpi_t C,
gcry_mpi_t D, unsigned int Nlimbs,
gcry_mpi_t P, gcry_mpi_t Q, gcry_mpi_t U)
{
gcry_mpi_t m1 = mpi_alloc_secure ( Nlimbs + 1 );
gcry_mpi_t m2 = mpi_alloc_secure ( Nlimbs + 1 );
gcry_mpi_t h = mpi_alloc_secure ( Nlimbs + 1 );
/* m... | cwe | CWE-200 | C/C++ |
void Phase2() final {
Local<Context> context_handle = Deref(context);
Context::Scope context_scope{context_handle};
Local<Object> object = Local<Object>::Cast(Deref(reference));
result = Unmaybe(object->Delete(context_handle, key->CopyInto()));
} | cwe | CWE-913 | C/C++ |
njs_vmcode_await(njs_vm_t *vm, njs_vmcode_await_t *await,
njs_promise_capability_t *pcap, njs_async_ctx_t *ctx)
{
size_t size;
njs_int_t ret;
njs_frame_t *frame;
njs_value_t ctor, val, on_fulfilled, on_rejected, *value;
njs_promise_t *promise;
njs... | cwe | CWE-125 | Unknown |
void GpuDataManager::UpdateGpuInfo(const GPUInfo& gpu_info) {
{
base::AutoLock auto_lock(gpu_info_lock_);
if (!gpu_info_.Merge(gpu_info))
return;
RunGpuInfoUpdateCallbacks();
content::GetContentClient()->SetGpuInfo(gpu_info_);
}
UpdateGpuFeatureFlags();
} | cwe | CWE-20 | C/C++ |
static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no, OPJ_BOOL isEncoder, OPJ_FLOAT32 fraction, OPJ_SIZE_T sizeof_block, opj_event_mgr_t* manager)
{
OPJ_UINT32 (*l_gain_ptr)(OPJ_UINT32) = 00;
OPJ_UINT32 compno, resno, bandno, precno, cblkno;
opj_tcp_t * l_tcp = 00;
opj_cp_t * l_cp = 00;
... | cwe | CWE-369 | C/C++ |
dispose() {
this._disposables.dispose();
} | cwe | CWE-79 | JavaScript |
function networkStatsSingle(iface) {
function parseLinesWindowsPerfData(sections) {
let perfData = [];
for (let i in sections) {
if ({}.hasOwnProperty.call(sections, i)) {
if (sections[i].trim() !== '') {
let lines = sections[i].trim().split('\r\n');
perfData.push({
... | cwe | CWE-78 | JavaScript |
static void redo_fd_request(void)
{
int drive;
int tmp;
lastredo = jiffies;
if (current_drive < N_DRIVE)
floppy_off(current_drive);
do_request:
if (!current_req) {
int pending;
spin_lock_irq(&floppy_lock);
pending = set_next_request();
spin_unlock_irq(&floppy_lock);
if (!pending) {
do_floppy = NU... | cwe | CWE-416 | Unknown |
/*
* PKCS15 emulation layer for EstEID card.
*
* Copyright (C) 2004, Martin Paljak <martin@martinpaljak.net>
* Copyright (C) 2004, Bud P. Bruegger <bud@comune.grosseto.it>
* Copyright (C) 2004, Antonino Iacono <ant_iacono@tin.it>
* Copyright (C) 2003, Olaf Kirch <okir@suse.de>
*
* This library is free software;... | cwe | CWE-119 | C/C++ |
get_dns_cert (const char *name, estream_t *r_key,
unsigned char **r_fpr, size_t *r_fprlen, char **r_url)
{
#ifdef USE_DNS_CERT
#ifdef USE_ADNS
gpg_error_t err;
adns_state state;
adns_answer *answer = NULL;
unsigned int ctype;
int count;
*r_key = NULL;
*r_fpr = NULL;
*r_fprlen = 0;
*r_ur... | cwe | CWE-20 | Unknown |
TfLiteStatus LogSoftmaxEval(TfLiteContext* context, TfLiteNode* node) {
const LogSoftmaxOpData* data =
reinterpret_cast<LogSoftmaxOpData*>(node->user_data);
const TfLiteTensor* input = GetInput(context, node, 0);
TfLiteTensor* output = GetOutput(context, node, 0);
switch (input->type) {
case kTfLiteFl... | cwe | CWE-125 | C/C++ |
TfLiteStatus LogSoftmaxPrepare(TfLiteContext* context, TfLiteNode* node) {
LogSoftmaxOpData* data = reinterpret_cast<LogSoftmaxOpData*>(node->user_data);
TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* input = GetInput(context, node, 0);
Tf... | cwe | CWE-787 | C/C++ |
static int snd_ctl_elem_add(struct snd_ctl_file *file,
struct snd_ctl_elem_info *info, int replace)
{
struct snd_card *card = file->card;
struct snd_kcontrol kctl, *_kctl;
unsigned int access;
long private_size;
struct user_element *ue;
int idx, err;
if (!replace && card->user_ctl_count >= MAX_USER_CONTR... | cwe | CWE-416 | C/C++ |
/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2018 Red Hat, Inc
*
* This program 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-116 | C/C++ |
import dayjs from 'dayjs'
import customParseFormat from 'dayjs/plugin/customParseFormat'
import { t } from './i18n.js'
import Projects from '../api/projects/projects.js'
import projectUsers from '../api/users/users.js'
import { periodToDates } from './periodHelpers.js'
import { getGlobalSetting, getUserSetting } from '... | cwe | CWE-1236 | JavaScript |
void ResourceDispatcherHostImpl::OnSSLCertificateError(
net::URLRequest* request,
const net::SSLInfo& ssl_info,
bool is_hsts_host) {
DCHECK(request);
ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request);
DCHECK(info);
GlobalRequestID request_id(info->GetChildID(), info->GetRe... | cwe | CWE-119 | C/C++ |
createenv(const struct rule *rule)
{
struct env *env;
u_int i;
env = malloc(sizeof(*env));
if (!env)
err(1, NULL);
RB_INIT(&env->root);
env->count = 0;
if (rule->options & KEEPENV) {
extern char **environ;
for (i = 0; environ[i] != NULL; i++) {
struct envnode *node;
const char *e, *eq;
size_t l... | cwe | CWE-459 | C/C++ |
PerformanceNavigationTiming::PerformanceNavigationTiming(
LocalFrame* frame,
ResourceTimingInfo* info,
TimeTicks time_origin,
const WebVector<WebServerTimingInfo>& server_timing)
: PerformanceResourceTiming(info ? info->InitialURL().GetString() : "",
"navigation",
... | cwe | CWE-200 | C/C++ |
package com.seafile.seadroid2.ui.activity;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.ServiceConnection;
import android.database.Cursor;
import android.net.Ur... | cwe | CWE-330 | Java |
static int __ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
{
struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr;
struct inet_sock *inet = inet_sk(sk);
struct ipv6_pinfo *np = inet6_sk(sk);
struct in6_addr *daddr, *final_p, final;
struct dst_entry *dst;
struct flowi6 fl6;
str... | cwe | CWE-264 | Unknown |
public function transformAsset(Asset $asset)
{
/**
* Set some default values here
*/
$purchase_cost = null;
$depreciated_value = null;
$monthly_depreciation = null;
$diff = null;
$checkout_target = null;
/**
* If there is a locatio... | cwe | CWE-79 | PHP |
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 |
{% load i18n %}
/* globals
makeIconButton,
renderLink,
*/
/* exported
addAttachmentButtonCallbacks,
loadAttachmentTable,
reloadAttachmentTable,
*/
/*
* Add callbacks to buttons for creating new attachments.
*
* Note: Attachments can also be external links!
*/
function addAttachmentButtonCall... | cwe | CWE-434 | Python |
/* vi:set ts=8 sts=4 sw=4 noet:
*
* VIM - Vi IMproved by Bram Moolenaar
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
* See README.txt for an overview of the Vim source code.
*/
#include "vim.h"
/*
* Vim originated fro... | cwe | CWE-416 | C/C++ |
get_password(const char *prompt, char *input, int capacity)
{
#ifdef ENABLE_SYSTEMD
int is_systemd_running;
struct stat a, b;
/* We simply test whether the systemd cgroup hierarchy is
* mounted */
is_systemd_running = (lstat("/sys/fs/cgroup", &a) == 0)
&& (lstat("/sys/fs/cgroup/systemd", &b) == 0)
&& (a.st_d... | cwe | CWE-78 | Unknown |
private String clean(String svg) {
svg = svg.toLowerCase().replaceAll("\\s", "");
if (svg.contains("<script>"))
return EMPTY_SVG;
if (svg.contains("</script>"))
return EMPTY_SVG;
if (svg.contains("<foreignobject"))
return EMPTY_SVG;
if (svg.contains("</foreignobject>"))
return EMPTY_SVG;
return ... | cwe | CWE-79 | Java |
addExtension({ zipFile }) {
checkAuthentication(this)
const regex = /^data:.+\/(.+);base64,(.*)$/
const matches = zipFile.match(regex)
const data = matches[2]
let zip
if (data) {
zip = new AdmZip(Buffer.from(data, 'base64'))
} else {
return new Meteor.Error('Invalid extension upl... | cwe | CWE-285 | JavaScript |
function refreshTags(tags, selected)
{
tagCloud.innerHTML = '';
if (tags.length > 0)
{
var table = document.createElement('table');
table.setAttribute('cellpadding', '2');
table.style.boxSizing = 'border-box';
table.style.tableLayout = 'fixed';
table.style.width = '100%';
var tbod... | cwe | CWE-94 | JavaScript |
from typing import Dict, Iterable
def path_to_nested(dict_obj: Dict) -> Dict:
"""
Transform a dict with paths as keys into a nested
dict
>>> path_to_nested ({"a/b/c": "d", "a/e": "f"})
{"a": {"b": {"c": "d"}, "e": "f"}}
If 2 unconsistent values are detected, fails with ValueError:
>>> pat... | cwe | CWE-74 | Python |
# -*- coding: utf-8 -*-
#
# fastecdsa documentation build configuration file, created by
# sphinx-quickstart on Thu Dec 15 20:02:52 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | cwe | CWE-347 | C/C++ |
_gcry_ecc_eddsa_sign (gcry_mpi_t input, ECC_secret_key *skey,
gcry_mpi_t r_r, gcry_mpi_t s, int hashalgo, gcry_mpi_t pk)
{
int rc;
mpi_ec_t ctx = NULL;
int b;
unsigned int tmp;
unsigned char *digest = NULL;
gcry_buffer_t hvec[3];
const void *mbuf;
size_t mlen;
unsigned char *rawm... | cwe | CWE-200 | Unknown |
static ssize_t _hostfs_pwrite(
oe_fd_t* desc,
const void* buf,
size_t count,
oe_off_t offset)
{
ssize_t ret = -1;
file_t* file = _cast_file(desc);
if (!file)
OE_RAISE_ERRNO(OE_EINVAL);
if (oe_syscall_pwrite_ocall(&ret, file->host_fd, buf, count, offset) !=
OE_OK)
... | cwe | CWE-552 | Unknown |
ready(callback) {
if (this.domReady) {
callback();
}
this.on('ready', callback);
} | cwe | CWE-1321 | JavaScript |
import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc'
import { FlowRouter } from 'meteor/ostrio:flow-router-extra'
import { saveAs } from 'file-saver'
import { NullXlsx } from '@neovici/nullxlsx'
import './dailytimetable.html'
import './pagination.js'
import './limitpicker.js'
import {
getGlobalSetting,
numb... | cwe | CWE-79 | JavaScript |
static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
const u8 *mac,
struct station_parameters *params)
{
struct ieee80211_local *local = wiphy_priv(wiphy);
struct sta_info *sta;
struct ieee80211_sub_if_data *sdata;
int err;
int layer2_update;
if (params->vlan) {
sdata = IEEE8... | cwe | CWE-287 | Unknown |
size_t OpenMP4SourceUDTA(char *filename)
{
mp4object *mp4 = (mp4object *)malloc(sizeof(mp4object));
if (mp4 == NULL) return 0;
memset(mp4, 0, sizeof(mp4object));
#ifdef _WINDOWS
fopen_s(&mp4->mediafp, filename, "rb");
#else
mp4->mediafp = fopen(filename, "rb");
#endif
if (mp4->mediafp)
{
uint32_t qttag, qts... | cwe | CWE-125 | Unknown |
static const char *parse_number( cJSON *item, const char *num )
{
int64_t i = 0;
double f = 0;
int isint = 1;
int sign = 1, scale = 0, subscale = 0, signsubscale = 1;
/* Could use sscanf for this? */
if ( *num == '-' ) {
/* Has sign. */
sign = -1;
++num;
}
if ( *num == '0' )
/* Is zero. */
++num;
i... | cwe | CWE-120 | C/C++ |
templateResult: function(item) {
var selectionText = item.text.split('\n');
var returnString = $('<span></span>');
$.each(selectionText, function(index, value){
line = value === undefined ? '' : value;
returnString.append(line + '</br>');
})
return returnString;
} | cwe | CWE-79 | JavaScript |
AppProto AppLayerProtoDetectGetProto(AppLayerProtoDetectThreadCtx *tctx,
Flow *f,
uint8_t *buf, uint32_t buflen,
uint8_t ipproto, uint8_t direction)
{
SCEnter();
SCLogDebug("buflen %u for %s direction"... | cwe | CWE-20 | C/C++ |
read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
{
JDIMENSION n;
void (*color_convert) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JDIMENSION input_row, JSAMPARRAY output_buf,
int num_rows) = NULL;
void (*color_quantize) (j_decompress_pt... | cwe | CWE-476 | Unknown |
// imagew-bmp.c
// Part of ImageWorsener, Copyright (c) 2011 by Jason Summers.
// For more information, see the readme.txt file.
#include "imagew-config.h"
#include <stdio.h> // for SEEK_SET
#include <stdlib.h>
#include <string.h>
#define IW_INCLUDE_UTIL_FUNCTIONS
#include "imagew.h"
#define IWBMP_BI_RGB 0 //... | cwe | CWE-682 | C/C++ |
OMX_ERRORTYPE SoftVorbis::internalGetParameter(
OMX_INDEXTYPE index, OMX_PTR params) {
switch (index) {
case OMX_IndexParamAudioVorbis:
{
OMX_AUDIO_PARAM_VORBISTYPE *vorbisParams =
(OMX_AUDIO_PARAM_VORBISTYPE *)params;
if (vorbisParams->nPortIndex != 0) {
... | cwe | CWE-119 | C/C++ |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import json, inspect
import frappe
from frappe import _
from frappe.utils import cint
from six import text_type, string_types
@frappe.whitelist()
def runserverobj(method, docs=No... | cwe | CWE-79 | Python |
#
# Read and parse /proc/cpuinfo
#
# Copyright (c) 2015 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. Y... | cwe | CWE-264 | Python |
void InferenceContext::PreInputInit(
const OpDef& op_def, const std::vector<const Tensor*>& input_tensors,
const std::vector<ShapeHandle>& input_tensors_as_shapes) {
// TODO(mdan): This is also done at graph construction. Run only here instead?
const auto ret = full_type::SpecializeType(attrs_, op_def);
D... | cwe | CWE-617 | C/C++ |
PaintImage AcceleratedStaticBitmapImage::PaintImageForCurrentFrame() {
CheckThread();
if (!IsValid())
return PaintImage();
sk_sp<SkImage> image;
if (original_skia_image_ &&
original_skia_image_thread_id_ ==
Platform::Current()->CurrentThread()->ThreadId()) {
image = original_skia_i... | cwe | CWE-787 | C/C++ |
/*
* Copyright 2014 jmrozanec
*
* 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 agreed to in writing, ... | cwe | CWE-94 | Java |
static void pointer_event(VncState *vs, int button_mask, int x, int y)
{
static uint32_t bmap[INPUT_BUTTON_MAX] = {
[INPUT_BUTTON_LEFT] = 0x01,
[INPUT_BUTTON_MIDDLE] = 0x02,
[INPUT_BUTTON_RIGHT] = 0x04,
[INPUT_BUTTON_WHEEL_UP] = 0x08,
[INPUT_BUTTON_WHEEL_DOWN... | cwe | CWE-125 | Unknown |
MemInStream(const void* data, int len, bool deleteWhenDone_=false)
: start((const U8*)data), deleteWhenDone(deleteWhenDone_)
{
ptr = start;
end = start + len;
} | cwe | CWE-787 | C/C++ |
// Copyright 2013 Unknown
//
// 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 agreed to in writ... | cwe | CWE-20 | Go |
ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
{
ASN1_INTEGER *ret;
int len, j;
if (ai == NULL)
ret = M_ASN1_INTEGER_new();
else
ret = ai;
if (ret == NULL) {
ASN1err(ASN1_F_BN_TO_ASN1_INTEGER, ERR_R_NESTED_ASN1_ERROR);
goto err;
}
if (BN... | cwe | CWE-119 | Unknown |
// +build !libsodium
package internal
// This file contains functions that should return `nil`,
// in order to be able to build wal-g without specific implementations of the crypter.
// And the configure_crypter_<crypter>.go files must have a real implementation of the function.
//
// Thus, if the tag is missing, the... | cwe | CWE-754 | Go |
bool Unpack::ProcessDecoded(UnpackThreadData &D)
{
UnpackDecodedItem *Item=D.Decoded,*Border=D.Decoded+D.DecodedSize;
while (Item<Border)
{
UnpPtr&=MaxWinMask;
if (((WriteBorder-UnpPtr) & MaxWinMask)<MAX_LZ_MATCH+3 && WriteBorder!=UnpPtr)
{
UnpWriteBuf();
if (WrittenFileSize>DestUnpSize)
... | cwe | CWE-787 | C/C++ |
int SocketStream::DoBeforeConnect() {
next_state_ = STATE_BEFORE_CONNECT_COMPLETE;
if (!context_.get() || !context_->network_delegate()) {
return OK;
}
int result = context_->network_delegate()->NotifyBeforeSocketStreamConnect(
this, io_callback_);
if (result != OK && result != ERR_IO_PENDING)... | cwe | CWE-399 | C/C++ |
/*
* Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2010-2014, Pieter Noordhuis <pcnoordhuis at gmail dot com>
* Copyright (c) 2015, Matt Stancliff <matt at genges dot com>,
* Jan-Erik Rediger <janerik at fnordig dot com>
*
* All rights reserved.
*
*... | cwe | CWE-680 | C/C++ |
# -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | cwe | CWE-79 | Python |
HeaderLookupTable_t::lookup (const char *buf, const std::size_t len) const {
const HeaderTableRecord *r = HttpHeaderHashTable::lookup(buf, len);
if (!r)
return BadHdr;
return *r;
} | cwe | CWE-79 | Unknown |
/** BEGIN COPYRIGHT BLOCK
* Copyright (C) 2013 Red Hat, Inc.
* All rights reserved.
*
* License: GPL (version 3 or any later version).
* See LICENSE for details.
* END COPYRIGHT BLOCK **/
#include "sync.h"
#include "slap.h" /* for LDAP_TAG_SK_REVERSE */
static struct berval *create_syncinfo_value(int type, con... | cwe | CWE-476 | C/C++ |
public function create(Codendi_Request $request)
{
$content_id = false;
$vId = new Valid_UInt($this->widget_id . '_job_id');
$vId->setErrorMessage("Can't add empty job id");
$vId->required();
if ($request->valid($vId)) {
$job_id = $request->get($this->widget_id . ... | cwe | CWE-89 | PHP |
static size_t WritePSDChannel(const PSDInfo *psd_info,
const ImageInfo *image_info,Image *image,Image *next_image,
const QuantumType quantum_type, unsigned char *compact_pixels,
MagickOffsetType size_offset,const MagickBooleanType separate,
const CompressionType compression,ExceptionInfo *exception)
{
MagickB... | cwe | CWE-399 | C/C++ |
#include "rar.hpp"
CommandData::CommandData()
{
Init();
}
void CommandData::Init()
{
RAROptions::Init();
*Command=0;
*ArcName=0;
FileLists=false;
NoMoreSwitches=false;
ListMode=RCLM_AUTO;
BareOutput=false;
FileArgs.Reset();
ExclArgs.Reset();
InclArgs.Reset();
StoreArgs.Reset();
ArcName... | cwe | CWE-787 | C/C++ |
int rm_rf_children(
int fd,
RemoveFlags flags,
const struct stat *root_dev) {
_cleanup_closedir_ DIR *d = NULL;
int ret = 0, r;
assert(fd >= 0);
/* This returns the first error we run into, but nevertheless tries to go on. This closes th... | cwe | CWE-674 | C/C++ |
/*
Copyright The Helm 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 agreed to in writing, software
di... | cwe | CWE-200 | Go |
int avpriv_ac3_parse_header(AC3HeaderInfo **phdr, const uint8_t *buf,
size_t size)
{
GetBitContext gb;
AC3HeaderInfo *hdr;
int err;
if (!*phdr)
*phdr = av_mallocz(sizeof(AC3HeaderInfo));
if (!*phdr)
return AVERROR(ENOMEM);
hdr = *phdr;
init_ge... | cwe | CWE-476 | Unknown |
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* lib/krb5/krb/s4u_creds.c */
/*
* Copyright (C) 2009 by the Massachusetts Institute of Technology.
* All rights reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Governm... | cwe | CWE-20 | C/C++ |
static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
struct net_device *netdev;
struct atl2_adapter *adapter;
static int cards_found;
unsigned long mmio_start;
int mmio_len;
int err;
cards_found = 0;
err = pci_enable_device(pdev);
if (err)
return err;
/*
* atl2 is a shared-hig... | cwe | CWE-200 | C/C++ |
def verify_signature(jwt)
head = token_head(jwt)
# Make sure the algorithm is supported and get the decode key.
if head[:alg] == 'RS256'
[rs256_decode_key(head[:kid]), head[:alg]]
elsif head[:alg] == 'HS256'
[@client_secret, head[:alg]]
else
raise O... | cwe | CWE-347 | Ruby |
void Compute(OpKernelContext* ctx) override {
const Tensor& input = ctx->input(kInputTensorIndex);
const Tensor& input_min = ctx->input(kInputMinIndex);
const Tensor& input_max = ctx->input(kInputMaxIndex);
const size_t depth = input_max.NumElements();
OP_REQUIRES(
ctx, input_min.dim_size(0... | cwe | CWE-703 | C/C++ |
from __future__ import unicode_literals
from itertools import chain
import re
import warnings
import six
from six.moves.urllib.parse import urlparse
from xml.sax.saxutils import unescape
from bleach import html5lib_shim
from bleach.utils import alphabetize_attributes, force_unicode
#: List of allowed tags
ALLOWED_... | cwe | CWE-79 | Python |
/*
* 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 |
int connect_n_handle_errors(struct st_command *command,
MYSQL* con, const char* host,
const char* user, const char* pass,
const char* db, int port, const char* sock)
{
DYNAMIC_STRING *ds;
int failed_attempts= 0;
ds= &ds_res;
/... | cwe | CWE-319 | Unknown |
static void warnf(struct Configurable *config, const char *fmt, ...)
{
if(!(config->conf & CONF_MUTE)) {
va_list ap;
int len;
char *ptr;
char print_buffer[256];
va_start(ap, fmt);
va_start(ap, fmt);
len = vsnprintf(print_buffer, sizeof(print_buffer), fmt, ap);
va_end(ap);
ptr = p... | cwe | CWE-125 | C/C++ |
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++ |
package com.salesmanager.shop.admin.controller.customers;
import com.salesmanager.core.business.services.customer.attribute.CustomerOptionValueService;
import com.salesmanager.core.business.services.reference.language.LanguageService;
import com.salesmanager.core.business.utils.ajax.AjaxResponse;
import com.salesmanag... | cwe | CWE-639 | Java |
long kernel_wait4(pid_t upid, int __user *stat_addr, int options,
struct rusage *ru)
{
struct wait_opts wo;
struct pid *pid = NULL;
enum pid_type type;
long ret;
if (options & ~(WNOHANG|WUNTRACED|WCONTINUED|
__WNOTHREAD|__WCLONE|__WALL))
return -EINVAL;
if (upid == -1)
type = PIDTYPE_MAX;
else... | cwe | CWE-20 | C/C++ |
load_msg(RES* ssl, sldns_buffer* buf, struct worker* worker)
{
struct regional* region = worker->scratchpad;
struct query_info qinf;
struct reply_info rep;
char* s = (char*)sldns_buffer_begin(buf);
unsigned int flags, qdcount, security, an, ns, ar;
long long ttl;
size_t i;
int go_on = 1;
regional_free_all(reg... | cwe | CWE-613 | Unknown |
checked_xmalloc (size_t size)
{
alloc_limit_assert ("checked_xmalloc", size);
return xmalloc (size);
} | cwe | CWE-190 | C/C++ |
/*
* Copyright (C) 2017 Frank Morgner <frankmorgner@gmail.com>
*
* This file is part of OpenSC.
*
* 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 Licen... | cwe | CWE-119 | C/C++ |
Network::FilterStatus Context::onUpstreamData(int data_length, bool end_of_stream) {
if (!wasm_->onUpstreamData_) {
return Network::FilterStatus::Continue;
}
auto result = wasm_->onUpstreamData_(this, id_, static_cast<uint32_t>(data_length),
static_cast<uint32_t>(end_of_... | cwe | CWE-476 | C/C++ |
IMPEG2D_ERROR_CODES_T impeg2d_dec_seq_ext_data(dec_state_t *ps_dec)
{
stream_t *ps_stream;
UWORD32 u4_start_code;
IMPEG2D_ERROR_CODES_T e_error;
e_error = (IMPEG2D_ERROR_CODES_T) IVD_ERROR_NONE;
ps_stream = &ps_dec->s_bit_stream;
u4_start_code = impeg2d_bit_stream_nxt(ps_stream,START_C... | cwe | CWE-254 | C/C++ |
processOctetMsgLen(const instanceConf_t *const inst, struct conn_wrkr_s *connWrkr, char ch)
{
DEFiRet;
if (connWrkr->parseState.inputState == eAtStrtFram) {
if (inst->bSuppOctetFram && isdigit(ch)) {
connWrkr->parseState.inputState = eInOctetCnt;
connWrkr->parseState.iOctetsRemain = 0;
connWrkr->parseState... | cwe | CWE-787 | Unknown |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2000-2021
* All rights reserved
*
* This file is part of GPAC / ISO Media File Format sub-project
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU L... | cwe | CWE-190 | C/C++ |
SProcXFixesSelectCursorInput(ClientPtr client)
{
REQUEST(xXFixesSelectCursorInputReq);
swaps(&stuff->length);
swapl(&stuff->window);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
} | cwe | CWE-20 | C/C++ |
0<fa.length&&b.pickFolder(b.mode,function(sa){b.createFile(fa,Q,null!=T&&0<T.length?T:null,null,function(){b.hideDialog()},null,sa,null,null!=P&&0<P.length?P:null)},b.mode!=App.MODE_GOOGLE||null==b.stateArg||null==b.stateArg.folderId)}}function u(fa,sa,xa,wa,ua,va,ia){null!=S&&(S.style.backgroundColor="transparent",S.s... | cwe | CWE-94 | JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.