code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
private static void equipBackpack(MonsterEntity monster, ItemStack backpack, int difficulty, boolean playMusicDisc) { getSpawnEgg(monster.getType()).ifPresent(egg -> backpack.getCapability(CapabilityBackpackWrapper.getCapabilityInstance()) .ifPresent(w -> { w.setColors(getPrimaryColor(egg), getSecondaryColor...
vuln
Vulnerable
Java
/* 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...
vuln
Vulnerable
Python
import { mainPage } from "../../support/page_objects/mainPage"; import { isTestSuiteActive, isXcdb, getProjectString, } from "../../support/page_objects/projectConstants"; export const genTest = (apiType, dbType) => { if (!isTestSuiteActive(apiType, dbType)) return; describe(`${apiType.toUpperCase...
vuln
Safe
JavaScript
static void qpeg_decode_inter(const uint8_t *src, uint8_t *dst, int size, int stride, int width, int height, int delta, const uint8_t *ctable, uint8_t *refdata) { int i, j; int code; int filled = 0; int orig_height; if(!refdata) refdata...
vuln
Safe
C/C++
int CLASS ljpeg_diff (ushort *huff) { int len, diff; len = gethuff(huff); if (len == 16 && (!dng_version || dng_version >= 0x1010000)) return -32768; diff = getbits(len); if ((diff & (1 << (len-1))) == 0) diff -= (1 << len) - 1; return diff; }
vuln
Vulnerable
C/C++
def git_info(path, content) return '' unless @git_status real_path = File.realdirpath(content.name, path) return ' ' unless real_path.start_with? path relative_path = real_path.remove(Regexp.new('^' + Regexp.escape(@git_root_path) + '/?')) if content.directory? git_dir_info(...
vuln
Safe
Ruby
static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int depth) { XMLRPC_VALUE xReturn = NULL; if (in_val) { zval val; XMLRPC_VALUE_TYPE type; ZVAL_UNDEF(&val); type = get_zval_xmlrpc_type(in_val, &val); if (!Z_ISUNDEF(val)) { switch (type) { case xmlrpc_base64: if (Z_TYPE...
vuln
Safe
Unknown
MagickExport Image *AdaptiveThresholdImage(const Image *image, const size_t width,const size_t height,const double bias, ExceptionInfo *exception) { #define AdaptiveThresholdImageTag "AdaptiveThreshold/Image" CacheView *image_view, *threshold_view; Image *threshold_image; MagickBooleanType ...
vuln
Safe
C/C++
tight_detect_smooth_image(VncState *vs, int w, int h) { unsigned int errors; int compression = vs->tight.compression; int quality = vs->tight.quality; if (!vs->vd->lossy) { return 0; } if (ds_get_bytes_per_pixel(vs->ds) == 1 || vs->clientds.pf.bytes_per_pixel == 1 || ...
vuln
Vulnerable
C/C++
static int dfa_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { DfaContext *s = avctx->priv_data; const uint8_t *buf = avpkt->data; const uint8_t *buf_end = avpkt->data + avpkt->size; const uint8_t *tmp_buf; ui...
vuln
Vulnerable
C/C++
/** * Copyright (c) 2006-2012, JGraph Ltd */ Format = function(editorUi, container) { this.editorUi = editorUi; this.container = container; }; /** * Background color for inactive tabs. */ Format.inactiveTabBackgroundColor = '#f1f3f4'; /** * Icons for markers (24x16). */ Format.classicFilledMarkerImage = Graph...
vuln
Safe
JavaScript
/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2016 The PHP Group | +---------...
vuln
Vulnerable
C/C++
static void mv88w8618_eth_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { mv88w8618_eth_state *s = opaque; switch (offset) { case MP_ETH_SMIR: s->smir = value; break; case MP_ETH_PCXR: s->vlan_header = ((value >> MP_ETH_PCXR_2BS...
vuln
Safe
C/C++
parser_compiled_code_set_function_name (parser_context_t *context_p, /**< context */ ecma_compiled_code_t *bytecode_p, /**< function literal index */ uint16_t name_index, /**< function name literal index */ ...
vuln
Vulnerable
Unknown
TfLiteTensor* GetTemporary(TfLiteContext* context, const TfLiteNode* node, int index) { const int tensor_index = ValidateTensorIndexing( context, index, node->temporaries->size, node->temporaries->data); if (tensor_index < 0) { return nullptr; } return GetTensorAtIndex(conte...
vuln
Safe
C/C++
Classifier (const char *&ptr, int size) { if (size <= 0) throw IEX_NAMESPACE::InputExc("Error uncompressing DWA data" " (truncated rule)."); { // maximum length of string plus one byte for terminating NULL char suffix[...
vuln
Safe
Unknown
// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. * All Rights Reserved. */ #include "xfs.h" #include "xfs_fs.h" #include "xfs_format.h" #include "xfs_log_format.h" #include "xfs_shared.h" #include "xfs_trans_resv.h" #include "xfs_bit.h" #include "xfs_sb.h" #include "xfs_mo...
vuln
Vulnerable
C/C++
static byte parseHexByte(const char * &str) { byte b = parseHexChar(str[0]); if (str[1] == ':' || str[1] == '\0') { str += 2; return b; } else { b = b << 4 | parseHexChar(str[1]); str += 3; return b; } }
vuln
Vulnerable
Unknown
public static final String getSvgXml(Document document) throws HopException { try { DOMSource domSource = new DOMSource(document); StringWriter stringWriter = new StringWriter(); StreamResult streamResult = new StreamResult(stringWriter); TransformerFactory transformerFactory = XmlHandler.cr...
vuln
Safe
Java
static int get_metadata_size(const uint8_t *buf, int buf_size) { int metadata_last, metadata_size; const uint8_t *buf_end = buf + buf_size; buf += 4; do { if (buf_end - buf < 4) return 0; ff_flac_parse_block_header(buf, &metadata_last, NULL, &metadata_size); buf += 4;...
vuln
Safe
C/C++
import XLSX from 'xlsx' import { UITypes } from '~/components/project/spreadsheet/helpers/uiTypes' import TemplateGenerator from '~/components/import/templateParsers/TemplateGenerator' import { getCheckboxValue, isCheckboxType } from '~/components/import/templateParsers/parserHelpers' const excelTypeToUidt = { d: UI...
vuln
Safe
JavaScript
static uint dump_routines_for_db(char *db) { char query_buff[QUERY_LENGTH]; const char *routine_type[]= {"FUNCTION", "PROCEDURE"}; char db_name_buff[NAME_LEN*2+3], name_buff[NAME_LEN*2+3]; char *routine_name; int i; FILE *sql_file= md_result_file; MYSQL_RES *routine_res, *r...
vuln
Vulnerable
Unknown
void ep2_mul_basic(ep2_t r, const ep2_t p, const bn_t k) { int i, l; ep2_t t; ep2_null(t); if (bn_is_zero(k) || ep2_is_infty(p)) { ep2_set_infty(r); return; } RLC_TRY { ep2_new(t); l = bn_bits(k); if (bn_get_bit(k, l - 1)) { ep2_copy(t, p); } else { ep2_set_infty(t); } for (i = l - 2; i...
vuln
Vulnerable
C/C++
function isExec(command){ try{ exec(command, { stdio: 'ignore' }) return true } catch (_e){ return false } }
vuln
Vulnerable
JavaScript
void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level) { CPUState *cs = CPU(cpu); CPUPPCState *env = &cpu->env; unsigned int old_pending; bool locked = false; if (!qemu_mutex_iothread_locked()) { locked = true; qemu_mutex_lock_iothread(); } old_pending = env->pending_in...
vuln
Safe
C/C++
package service import ( "context" "github.com/fleetdm/fleet/v4/server/fleet" "github.com/fleetdm/fleet/v4/server/ptr" ) //////////////////////////////////////////////////////////////////////////////// // Get Global Schedule //////////////////////////////////////////////////////////////////////////////// type ge...
vuln
Vulnerable
Go
file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf, size_t nbytes, unichar *ubuf, size_t ulen, const char *code, const char *type, int text) { unsigned char *utf8_buf = NULL, *utf8_end; size_t mlen, i; int rv = -1; int mime = ms->flags & MAGIC_MIME; const char *subtype = NULL; con...
vuln
Safe
Unknown
static av_cold void decode_init_vlc(void){ static int done = 0; if (!done) { int i; int offset; done = 1; chroma_dc_coeff_token_vlc.table = chroma_dc_coeff_token_vlc_table; chroma_dc_coeff_token_vlc.table_allocated = chroma_dc_coeff_token_vlc_table_size; init_vlc(...
vuln
Safe
C/C++
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); output->type = in...
vuln
Vulnerable
C/C++
/* abrt-hook-ccpp.cpp - the hook for C/C++ crashing program Copyright (C) 2009 Zdenek Prikryl (zprikryl@redhat.com) Copyright (C) 2009 RedHat inc. 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 ...
vuln
Vulnerable
C/C++
/* * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * th...
vuln
Vulnerable
Java
SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, unsigned long, nbytes, int __user *, start, void __user *, arg) { unsigned long w; struct percpu_struct *cpu; switch (op) { case GSI_IEEE_FP_CONTROL: /* Return current software fp control & status bits. */ /* Note that DU doesn't veri...
vuln
Vulnerable
C/C++
public void analyze(Map<Element, Parser> allContext) { /* * Rules that must be met - Subcommands can only go on inner classes */ for (Entry<Element, Parser> contextEntry : allContext.entrySet()) { TypeElement classElement = (TypeElement) contextEntry.getKey(); Parser context = contextEntry.getValue();...
vuln
Vulnerable
Java
public String determineModeFromHeader() { // Mode is stored in the header // Find the most recent frame and return the mode that it has SortedFramePartArrayList payloads = new SortedFramePartArrayList(numberOfLayouts); int maxLayouts = 10; // First four layouts are rt, max, min, exp, but we may have mode in any...
vuln
Vulnerable
Java
static long do_sigreturn_v2(CPUARMState *env) { abi_ulong frame_addr; struct sigframe_v2 *frame = NULL; frame_addr = env->regs[13]; if (frame_addr & 7) { goto badframe; } if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) goto badframe; ...
vuln
Safe
C/C++
bytesPerLineTable (const Header &header, vector<size_t> &bytesPerLine) { const Box2i &dataWindow = header.dataWindow(); const ChannelList &channels = header.channels(); bytesPerLine.resize (dataWindow.max.y - dataWindow.min.y + 1); for (ChannelList::ConstIterator c = channels.begin(); c != chan...
vuln
Vulnerable
Unknown
'use strict'; const crypto = require('crypto'); const utils = require("../../utils.js"); const g_constants = require("../../constants.js"); const trade = require("../users/trade.js"); const wallet = require("../users/wallet.js"); const orders = require("../users/orders.js"); const market = require("../users/market.js"...
vuln
Vulnerable
JavaScript
init_pci(struct vmctx *ctx) { struct mem_range mr; struct pci_vdev_ops *ops; struct businfo *bi; struct slotinfo *si; struct funcinfo *fi; size_t lowmem; int bus, slot, func; int success_cnt = 0; int error; pci_emul_iobase = PCI_EMUL_IOBASE; pci_emul_membase32 = vm_get_lowmem_limit(ctx); pci_emul_membase64...
vuln
Vulnerable
C/C++
static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) { Vp3DecodeContext *s = avctx->priv_data; int visible_width, visible_height, colorspace; int offset_x = 0, offset_y = 0; AVRational fps, aspect; s->theora = get_bits_long(gb, 24); av_log(avctx, AV_LOG_DEBUG, "Theora bitstr...
vuln
Vulnerable
C/C++
rdpdr_process(STREAM s) { uint32 handle; uint16 vmin; uint16 component; uint16 pakid; struct stream packet = *s; #if WITH_DEBUG_RDP5 printf("--- rdpdr_process ---\n"); hexdump(s->p, s->end - s->p); #endif in_uint16(s, component); in_uint16(s, pakid); if (component == RDPDR_CTYP_CORE) { switch (pakid) ...
vuln
Safe
Unknown
/* SPDX-FileCopyrightText: 1997 Markus Wuebben <markus.wuebben@kde.org> SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net SPDX-FileCopyrightText: 2009 Andras Mantia <andras@kdab.net> SPDX-FileCopyrightText: 2010 Torgny Nyblom <nyblom@kde.org> SPDX-FileCopyrightText...
vuln
Vulnerable
C/C++
async fn(inputs, exits) { const { currentUser } = this.req; const { attachment, card, project } = await sails.helpers.attachments .getProjectPath(inputs.id) .intercept('pathNotFound', () => Errors.ATTACHMENT_NOT_FOUND); const isBoardMember = await sails.helpers.users.isBoardMember(currentUser....
vuln
Safe
JavaScript
void do_m68k_semihosting(CPUM68KState *env, int nr) { uint32_t args; void *p; void *q; uint32_t len; uint32_t result; args = env->dregs[1]; switch (nr) { case HOSTED_EXIT: gdb_exit(env, env->dregs[0]); exit(env->dregs[0]); case HOSTED_OPEN: if (use_gdb_syscall...
vuln
Vulnerable
C/C++
/*! * merge-deep <https://github.com/jonschlinkert/merge-deep> * * Copyright (c) 2014-2015, Jon Schlinkert. * Licensed under the MIT License. */ 'use strict'; var union = require('arr-union'); var clone = require('clone-deep'); var typeOf = require('kind-of'); module.exports = function mergeDeep(orig, objects) ...
vuln
Safe
JavaScript
int cap_get_flag(cap_t cap_d, cap_value_t value, cap_flag_t set, cap_flag_value_t *raised) { /* * Do we have a set and a place to store its value? * Is it a known capability? */ if (raised && good_cap_t(cap_d) && value >= 0 && value < __CAP_BITS && set >= 0 && set < NUMBER_OF_CAP_SETS) { __...
vuln
Vulnerable
C/C++
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.mixme = {})); }(this, (function (exp...
vuln
Safe
JavaScript
static int bcm_release(struct socket *sock) { struct sock *sk = sock->sk; struct net *net; struct bcm_sock *bo; struct bcm_op *op, *next; if (!sk) return 0; net = sock_net(sk); bo = bcm_sk(sk); /* remove bcm_ops, timer, rx_unregister(), etc. */ spin_lock(&bcm_notifier_lock); while (bcm_busy_notifier == ...
vuln
Vulnerable
Unknown
/* nbdkit * Copyright (C) 2013-2019 Red Hat Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the f...
vuln
Safe
C/C++
void DevToolsUIBindings::CallClientFunction(const std::string& function_name, const base::Value* arg1, const base::Value* arg2, const base::Value* arg3) { if (!web_contents_->GetURL()....
vuln
Vulnerable
C/C++
static uint64_t pl011_read(void *opaque, target_phys_addr_t offset, unsigned size) { pl011_state *s = (pl011_state *)opaque; uint32_t c; if (offset >= 0xfe0 && offset < 0x1000) { return s->id[(offset - 0xfe0) >> 2]; } switch (offset >> 2) { case 0: s->...
vuln
Vulnerable
C/C++
pvscsi_init_msi(PVSCSIState *s) { int res; PCIDevice *d = PCI_DEVICE(s); res = msi_init(d, PVSCSI_MSI_OFFSET(s), PVSCSI_MSIX_NUM_VECTORS, PVSCSI_USE_64BIT, PVSCSI_PER_VECTOR_MASK); if (res < 0) { trace_pvscsi_init_msi_fail(res); s->msi_used = false; } else { ...
vuln
Vulnerable
C/C++
struct omap_sdrc_s *omap_sdrc_init(MemoryRegion *sysmem, hwaddr base) { struct omap_sdrc_s *s = g_new0(struct omap_sdrc_s, 1); omap_sdrc_reset(s); memory_region_init_io(&s->iomem, NULL, &omap_sdrc_ops, s, "omap.sdrc", 0x1000); memory_region_add_subregion(sysmem, base, ...
vuln
Safe
C/C++
private static String getNextOrderedValue(final String currentValue, final boolean restart) { final Pattern numberPattern = Pattern.compile("\\d+"); final Pattern lowercaseLetterPattern = Pattern.compile("[a-z]"); final Pattern capitalLetterPattern = Pattern.compile("[A-z]"); if (number...
vuln
Safe
Java
static av_cold int ipvideo_decode_init(AVCodecContext *avctx) { IpvideoContext *s = avctx->priv_data; int ret; s->avctx = avctx; s->is_16bpp = avctx->bits_per_coded_sample == 16; avctx->pix_fmt = s->is_16bpp ? AV_PIX_FMT_RGB555 : AV_PIX_FMT_PAL8; ff_hpeldsp_init(&s->hdsp, avctx->flags); s->l...
vuln
Safe
C/C++
static void nsc_decode(NSC_CONTEXT* context) { UINT16 x; UINT16 y; UINT16 rw = ROUND_UP_TO(context->width, 8); BYTE shift = context->ColorLossLevel - 1; /* colorloss recovery + YCoCg shift */ BYTE* bmpdata = context->BitmapData; for (y = 0; y < context->height; y++) { const BYTE* yplane; const BYTE* c...
vuln
Vulnerable
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,...
vuln
Safe
Java
ipmi_sdr_print_sensor_fru_locator(struct sdr_record_fru_locator *fru) { char desc[17]; memset(desc, 0, sizeof (desc)); snprintf(desc, sizeof(desc), "%.*s", (fru->id_code & 0x1f) + 1, fru->id_string); if (!verbose) { if (csv_output) printf("%s,00h,ns,%d.%d\n", fru->id_code ? desc : "", fru...
vuln
Safe
Unknown
get_next_token(memarea_t *area, const char **s, const char *eos, token_rule_t *table) { /** Reject any object at least this big; it is probably an overflow, an * attack, a bug, or some other nonsense. */ #define MAX_UNPARSED_OBJECT_SIZE (128*1024) /** Reject any line at least this big; it is proba...
vuln
Safe
Unknown
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % ...
vuln
Vulnerable
C/C++
("/"==R.charAt(0)?"":u)+R);D.push('url("'+R+'"'+K[Q].substring(T))}else D.push(K[Q])}else D=[u]}return null!=D?D.join(""):null};Editor.prototype.mapFontUrl=function(u,D,K){/^https?:\/\//.test(D)&&!this.isCorsEnabledForUrl(D)&&(D=PROXY_URL+"?url="+encodeURIComponent(D));K(u,D)};Editor.prototype.embedCssFonts=function(u,...
vuln
Safe
JavaScript
static void grlib_apbuart_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { UART *uart = opaque; unsigned char c = 0; addr &= 0xff; switch (addr) { case DATA_OFFSET: case DATA_OFFSET + 3: if ((uart->chr) &&...
vuln
Vulnerable
C/C++
static TfLiteRegistration DelegateRegistration() { TfLiteRegistration reg = {nullptr, nullptr, nullptr, nullptr}; reg.prepare = [](TfLiteContext* context, TfLiteNode* node) { // If tensors are resized, the runtime should propagate shapes // automatically if correct flag is set. Ensure values are co...
vuln
Vulnerable
C/C++
import ast import re import sys if sys.version_info[0] < 3 or sys.version_info[1] < 3: sys.exit('Error: typed_ast only runs on Python 3.3 and above.') try: from setuptools import setup, Extension except ImportError: from distutils.core import setup, Extension _ast27 = Extension( '_ast27', include_...
vuln
Safe
Python
public Rect getBounds() { if (fullRect == null) { if (mState == State.FINISHING) { Log.e(TAG, "In finishing,do not interrupt"); } final Thread thread = Thread.currentThread(); workerHandler.post(new Runnable() { @Override ...
vuln
Safe
Java
void CMSEXPORT cmsFreeNamedColorList(cmsNAMEDCOLORLIST* v) { if (v ->List) _cmsFree(v ->ContextID, v ->List); if (v) _cmsFree(v ->ContextID, v); }
vuln
Vulnerable
Unknown
void unix_gc(void) { static bool gc_in_progress = false; struct unix_sock *u; struct unix_sock *next; struct sk_buff_head hitlist; struct list_head cursor; spin_lock(&unix_gc_lock); /* Avoid a recursive GC. */ if (gc_in_progress) goto out; gc_in_progress = true; /* * First, select candidates for garba...
vuln
Safe
Unknown
static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) { HEVCLocalContext *lc = s->HEVClc; GetBitContext *gb = &lc->gb; int ctb_addr_ts, ret; *gb = nal->gb; s->nal_unit_type = nal->type; s->temporal_id = nal->temporal_id; switch (s->nal_unit_type) { case HEVC...
vuln
Safe
C/C++
public function generateMessageFileName() { $time = microtime(true); return date('Ymd-His-', $time) . sprintf('%04d', (int) (($time - (int) $time) * 10000)) . '-' . sprintf('%04d', mt_rand(0, 10000)) . '.eml'; }
vuln
Vulnerable
PHP
static int hnm_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { AVFrame *frame = data; Hnm4VideoContext *hnm = avctx->priv_data; int ret; uint16_t chunk_id; if (avpkt->size < 8) { if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) ...
vuln
Vulnerable
C/C++
.5),!1));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,l-v,x));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,.5*(l-v),x-p));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,0,x-p));return c};z.prototype.getConstraints=function(c,l,x){c=[];var p=x*Math.max(0,Math.min(1,parseFloat(mxUt...
vuln
Safe
JavaScript
public void redirectProxy(RoutingContext ctx) { final String origPath = ctx.request().path(); String qry = ctx.request().query(); String tid = origPath .replaceFirst("^/_/invoke/tenant/([^/ ]+)/.*$", "$1"); String newPath = origPath .replaceFirst("^/_/invoke/tenant/[^/ ]+(/.*$)", "$1"); ...
vuln
Safe
Java
static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) { struct inet_sock *inet = inet_sk(sk); struct sockaddr_l2tpip *addr = (struct sockaddr_l2tpip *) uaddr; struct net *net = sock_net(sk); int ret; int chk_addr_ret; if (addr_len < sizeof(struct sockaddr_l2tpip)) return -EINVAL; ...
vuln
Safe
C/C++
/* * nf_nat_snmp_basic.c * * Basic SNMP Application Layer Gateway * * This IP NAT module is intended for use with SNMP network * discovery and monitoring applications where target networks use * conflicting private address realms. * * Static NAT is used to remap the networks from the view of the network * man...
vuln
Vulnerable
C/C++
public void startTracking(@NonNull Context context) { final IntentFilter filter = new IntentFilter(); filter.addAction(BatteryManager.ACTION_CHARGING); filter.addAction(BatteryManager.ACTION_DISCHARGING); context.registerReceiver(this, filter); // Initialise ...
vuln
Vulnerable
Java
configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone, const char *zname) { const cfg_obj_t *updatepolicy = NULL; const cfg_listelt_t *element, *element2; dns_ssutable_t *table = NULL; isc_mem_t *mctx = dns_zone_getmctx(zone); bool autoddns = false; isc_result_t result; (void)cfg_map_get(zconfig...
vuln
Vulnerable
C/C++
void AbstractSqlStorage::addConnectionToPool() { QMutexLocker locker(&_connectionPoolMutex); // we have to recheck if the connection pool already contains a connection for // this thread. Since now (after the lock) we can only tell for sure if (_connectionPool.contains(QThread::currentThread())) ...
vuln
Vulnerable
Unknown
fn calculate_iteration_count(exp_length: u64, exponent: &BigUint) -> u64 { let mut iteration_count: u64 = 0; if exp_length <= 32 && exponent.is_zero() { iteration_count = 0; } else if exp_length <= 32 { iteration_count = exponent.bits() - 1; } else if exp_length > 32 { // construct BigUint to represen...
vuln
Vulnerable
Rust
# -*- coding: utf-8 -*- import logging import pytz from odoo import _, api, fields, models from odoo.tools import format_datetime from odoo.exceptions import AccessError, UserError, ValidationError from odoo.tools.translate import html_translate from dateutil.relativedelta import relativedelta _logger = logging.get...
vuln
Vulnerable
Python
static ssize_t driver_override_store(struct device *_dev, struct device_attribute *attr, const char *buf, size_t count) { struct amba_device *dev = to_amba_device(_dev); char *driver_override, *old = dev->driver_override, *cp; /* We need to keep extra room for a newline */ if (count >= (PAGE_SIZE...
vuln
Vulnerable
Unknown
/* * Copyright (c) 2009-2012, Salvatore Sanfilippo <antirez at gmail dot com> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above co...
vuln
Safe
C/C++
/* Copyright (c) 2020 SUSE LLC * * 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, or (at your option) * any later version. * * This program is distributed in the hope tha...
vuln
Vulnerable
Python
private void addCertCaToTrustStore(String alias, Map<String, String> certData) { try { File certFile = Files.createTempFile("tls", "-cert").toFile(); Files.write(certFile.toPath(), Base64.getDecoder().decode(certData.get(CA_CRT))); try { File trustStoreFile = ...
vuln
Safe
Java
gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample, int width, int height) { guchar *buf; int channels; int rowstride; gsize bytes; g_return_val_if_fail (colorspace == GDK_COLO...
vuln
Vulnerable
Unknown
pimv2_print(netdissect_options *ndo, register const u_char *bp, register u_int len, const u_char *bp2) { register const u_char *ep; register const struct pim *pim = (const struct pim *)bp; int advance; enum checksum_status cksum_status; int pimv2_addr_len; ep = (const u_char *)ndo->ndo_snapend; if (...
vuln
Safe
Unknown
static void unzzip_mem_disk_cat_file(ZZIP_MEM_DISK* disk, char* name, FILE* out) { ZZIP_DISK_FILE* file = zzip_mem_disk_fopen (disk, name); if (file) { char buffer[1025]; int len; while (0 < (len = zzip_mem_disk_fread (buffer, 1, 1024, file))) { fwrite (buffer, 1, len, out); } zzip_mem_disk_fc...
vuln
Safe
C/C++
@Override public SignValidity validate(final byte[] sign, final Properties params) throws ConfirmationNeededException, IOException { AcroFields af; try { final PdfReader reader = new PdfReader(sign); af = reader.getAcroFields(); } catch (final Exception e) { return new SignValidity(SIGN_DETAIL_TYPE.KO...
vuln
Vulnerable
Java
PrintMsg_Print_Params::PrintMsg_Print_Params() : page_size(), content_size(), printable_area(), margin_top(0), margin_left(0), dpi(0), min_shrink(0), max_shrink(0), desired_dpi(0), document_cookie(0), selection_only(false), supports_alpha_blend(false), preview_ui_add...
vuln
Vulnerable
C/C++
public function native_unzip($zip_file, $target_dir = null, $preserve_filepath = true) { $file_locations = array(); if (function_exists('zip_open')) { $filename = $zip_file; try { if (!is_dir($target_dir)) { @mkdir_recursive($target_dir); ...
vuln
Vulnerable
PHP
query: _.bind(this._queryCirclesAutocomplete, this), id: function(circle) { return circle.unique_id; }, initSelection: function(element, callback) { var val = $(element).val().trim(); if (val) { var circleIds = val.split(','), circles = []; OCA.Circles.api.listCircles("a...
vuln
Vulnerable
JavaScript
dns_stricmp(const char* str1, const char* str2) { char c1, c2; *----------------------------------------------------------------------------*/ /* DNS variables */ static struct udp_pcb *dns_pcbs[DNS_MAX_SOURCE_PORTS]; #if ((LWIP_DNS_SECURE & LWIP_DNS_SECURE_RAND_SRC_PORT) != 0) static u8_t ...
vuln
Safe
C/C++
private void dispatchActivityConfigurationChanged() { // In case the new config comes before mApplication is assigned. if (getApplication() != null) { getApplication().dispatchActivityConfigurationChanged(this); } Object[] callbacks = collectActivityLifecycleCallbacks(); ...
vuln
Safe
Java
private void ensureAddressExist(String path) throws InvalidTransactionException { String code = Utilities.getCurrentSolAccount(context); SOLAccount account = SOLAccount.ofCode(code); path = path.toUpperCase(); SOLAccount target = SOLAccount.getAccountByPath(path); if (target == n...
vuln
Vulnerable
Java
int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr orig_vaddr, int rw, int mmu_idx) { S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; uint64_t asc = cpu_mmu_idx_to_asc(mmu_idx); target_ulong vaddr, raddr; int prot; DPRINTF("%s: address 0x%" VADDR_PRIx " ...
vuln
Vulnerable
C/C++
@Override protected ItemStack onItemUseSuccess(final ItemStack itemStack, final World world, final ServerPlayerEntity player) { itemStack.shrink(1); if (world.rand.nextInt(10) == 0) { // Fail chance player.sendStatusMessage(new TranslationTextComponent("minecolon...
vuln
Vulnerable
Java
void PackLinuxElf32::unpack(OutputFile *fo) { if (e_phoff != sizeof(Elf32_Ehdr)) {// Phdrs not contiguous with Ehdr throwCantUnpack("bad e_phoff"); } unsigned const c_phnum = get_te16(&ehdri.e_phnum); unsigned old_data_off = 0; unsigned old_data_len = 0; unsigned old_dtinit = 0; unsi...
vuln
Vulnerable
Unknown
@Override public Repository open(HttpServletRequest req, String projectName) throws RepositoryNotFoundException, ServiceNotAuthorizedException, ServiceNotEnabledException, ServiceMayNotContinueException { while (projectName.endsWith("/")) { projectName = projectName.substring(0, pr...
vuln
Vulnerable
Java
static Image *ReadVIFFImage(const ImageInfo *image_info, ExceptionInfo *exception) { #define VFF_CM_genericRGB 15 #define VFF_CM_ntscRGB 1 #define VFF_CM_NONE 0 #define VFF_DEP_DECORDER 0x4 #define VFF_DEP_NSORDER 0x8 #define VFF_DES_RAW 0 #define VFF_LOC_IMPLICIT 1 #define VFF_MAPTYP_NONE 0 #define VFF_MAPTY...
vuln
Vulnerable
C/C++
static inline void csrhci_fifo_wake(struct csrhci_s *s) { if (!s->enable || !s->out_len) return; /* XXX: Should wait for s->modem_state & CHR_TIOCM_RTS? */ if (s->chr.chr_can_read && s->chr.chr_can_read(s->chr.handler_opaque) && s->chr.chr_read) { s->chr.chr_read(s->chr....
vuln
Vulnerable
Unknown
int av_vsrc_buffer_add_video_buffer_ref(AVFilterContext *buffer_filter, AVFilterBufferRef *picref) { BufferSourceContext *c = buffer_filter->priv; AVFilterLink *outlink = buffer_filter->outputs[0]; int ret; if (c->picref) { av_log(buffer_filter, AV_LOG_ERROR, "Buffering several fr...
vuln
Vulnerable
C/C++
/* Copyright 2020 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...
vuln
Vulnerable
Python