code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
public void setWatchers(String[] watchers) { this.watchers = watchers != null ? watchers.clone() : null; }
vuln
Safe
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...
vuln
Safe
Python
public static String escapeJavaScriptStringHTML(String v) { return StringEscapeUtils.escapeEcmaScript(StringEscapeUtils.escapeHtml4(v)); }
vuln
Vulnerable
Java
@Override public void renderItem(MinecraftClient mc, MatrixStack matrices, Block item, int x, int y, int w, int h) { if (item == null || item.asItem() == Items.AIR) { super.renderItem(mc, matrices, item, x, y, w, h); } else { RenderSystem.getModelViewStack().push(); float scale = (h - 2) / 16f; float ...
vuln
Safe
Java
"""CILogon OAuthAuthenticator for JupyterHub Uses OAuth 2.0 with cilogon.org (override with CILOGON_HOST) Caveats: - For allowed user list /admin purposes, username will be the ePPN by default. This is typically an email address and may not work as a Unix userid. Normalization may be required to turn the Jupyter...
vuln
Vulnerable
Python
static void hmp_migrate_status_cb(void *opaque) { MigrationStatus *status = opaque; MigrationInfo *info; info = qmp_query_migrate(NULL); if (!info->has_status || strcmp(info->status, "active") == 0) { if (info->has_disk) { int progress; if (info->disk->remaining) { ...
vuln
Vulnerable
C/C++
def login(): """ Entry point for all the authentication sources. The user input will be validated and authenticated. """ form = _security.login_form() auth_obj = AuthSourceManager(form, copy.deepcopy( config.AUTHENTICATION_SOURCES)) if OAUTH2 in config.AUTHENTICATION_SOURCES \ ...
vuln
Vulnerable
Python
static MagickBooleanType WritePDBImage(const ImageInfo *image_info,Image *image) { const char *comment; int bits; MagickBooleanType status; PDBImage pdb_image; PDBInfo pdb_info; QuantumInfo *quantum_info; register const PixelPacket *p; register ssize_t x; regist...
vuln
Vulnerable
C/C++
// SPDX-License-Identifier: BSD-2-Clause /* * Copyright (c) 2016, Linaro Limited * Copyright (c) 2014, STMicroelectronics International N.V. */ #include <arm.h> #include <assert.h> #include <kernel/panic.h> #include <kernel/spinlock.h> #include <kernel/tee_common.h> #include <kernel/tee_misc.h> #include <kernel/tlb...
vuln
Vulnerable
C/C++
check_file_permissions_reduced(i_ctx_t *i_ctx_p, const char *fname, int len, gx_io_device *iodev, const char *permitgroup) { long i; ref *permitlist = NULL; /* an empty string (first character == 0) if '\' character is */ /* recognized as a file name separator as on DOS & Windows...
vuln
Safe
C/C++
@Nonnull @Override public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) { FeedthroughCacheKey key = getKey(state, side, rand, extraData); SpecificFeedthroughModel ret = CACHE.getIfPresent(key); if(ret==null) { ret = new ...
vuln
Safe
Java
static int decode_i_block(FourXContext *f, DCTELEM *block){ int code, i, j, level, val; if(get_bits_left(&f->gb) < 2){ av_log(f->avctx, AV_LOG_ERROR, "%d bits left before decode_i_block()\n", get_bits_left(&f->gb)); return -1; } val = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_...
vuln
Safe
C/C++
function zu(n,t){return new n.constructor(t?Ru(n.buffer):n.buffer,n.byteOffset,n.byteLength)}
vuln
Safe
JavaScript
/* Copyright 2018-2020 Accenture Technology 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 la...
vuln
Safe
Java
static uint16_t nvme_write_zeros(NvmeCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req) { NvmeRwCmd *rw = (NvmeRwCmd *)cmd; const uint8_t lba_index = NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas); const uint8_t data_shift = ns->id_ns.lbaf[lba_index].ds; uint64_t slba = le64_to_cpu(rw->slba); ...
vuln
Vulnerable
C/C++
public void handle(int packetId, Buffer event, NetSocket socket) { synchronized (MycatVertxMySQLHandler.this) { sequenceFuture = sequenceFuture.transform(unused -> handle0(packetId, event)); } }
vuln
Vulnerable
Java
static void assert_codec_experimental(AVCodecContext *c, int encoder) { const char *codec_string = encoder ? "encoder" : "decoder"; AVCodec *codec; if (c->codec->capabilities & CODEC_CAP_EXPERIMENTAL && c->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { av_log(NULL, AV_LOG_ERROR, "%s '...
vuln
Vulnerable
C/C++
const spawn = require('../../helpers/spawn'); /** * Reset current HEAD to the specified state * @param {String|Number} destination * @param {Boolean} options.hard * @return {void} */ module.exports = async function(destination, { hard = true } = {}) { if (destination && typeof destination === 'string') { tr...
vuln
Safe
JavaScript
MagickExport MagickBooleanType PersistPixelCache(Image *image, const char *filename,const MagickBooleanType attach,MagickOffsetType *offset, ExceptionInfo *exception) { CacheInfo *magick_restrict cache_info, *magick_restrict clone_info; Image clone_image; MagickBooleanType status; ssize_t...
vuln
Vulnerable
C/C++
static void call_bind_status(struct rpc_task *task) { int status = -EIO; if (task->tk_status >= 0) { dprint_status(task); task->tk_status = 0; task->tk_action = call_connect; return; } switch (task->tk_status) { case -ENOMEM: dprintk("RPC: %5u rpcbind out of memory\n", task->tk_pid); rpc_delay(task, ...
vuln
Safe
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
Vulnerable
Java
static int dns_parse_callback(void *c, int rr, const void *data, int len, const void *packet) { char tmp[256]; struct dpc_ctx *ctx = c; switch (rr) { case RR_A: if (len != 4) return -1; ctx->addrs[ctx->cnt].scopeid = 0; memcpy(ctx->addrs[ctx->cnt++].addr, data, 4); break; case RR_AAAA: if (len != 1...
vuln
Vulnerable
C/C++
int nfs_atomic_open(struct inode *dir, struct dentry *dentry, struct file *file, unsigned open_flags, umode_t mode) { DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq); struct nfs_open_context *ctx; struct dentry *res; struct iattr attr = { .ia_valid = ATTR_OPEN }; struct inode *inode; unsigned int lookup_flags = 0...
vuln
Vulnerable
C/C++
def fence_device_form(params, request, auth_user) if not allowed_for_local_cluster(auth_user, Permissions::READ) return 403, 'Permission denied' end @cur_resource = get_resource_by_id(params[:resource], get_cib_dom(auth_user)) if @cur_resource.instance_of?(ClusterEntity::Primitive) and @cur_resource.stoni...
vuln
Safe
Ruby
@Nullable private File getFile(String path) { if (path.startsWith("classpath:")) { try { URL resource = getClass() .getClassLoader() .getResource(path.substring("classpath:".length())); ...
vuln
Vulnerable
Java
function xml(options) { options = options || {}; options.type = options.type || DEFAULT_TYPES; const textParser = bodyParser.text(options); return function xmlParser(req, res, next) { // First, run the body through the text parser. textParser(req, res, function (err) { if (err) { ...
vuln
Vulnerable
JavaScript
fmgr_c_validator(PG_FUNCTION_ARGS) { Oid funcoid = PG_GETARG_OID(0); void *libraryhandle; HeapTuple tuple; bool isnull; Datum tmp; char *prosrc; char *probin; /* * It'd be most consistent to skip the check if !check_function_bodies, * but the purpose of that switch is to be helpful for pg_dump...
vuln
Vulnerable
Unknown
Py_ssize_t _PyBytes_Find(const char *haystack, Py_ssize_t len_haystack, const char *needle, Py_ssize_t len_needle, Py_ssize_t offset) { assert(len_haystack >= 0); assert(len_needle >= 0); // Extra checks because stringlib_find accesses haystack[len_haystack]. if (len_needle =...
vuln
Safe
C/C++
public void doIconSize( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { String qs = req.getQueryString(); if(qs==null) throw new ServletException(); Cookie cookie = new Cookie("iconSize", Functions.validateIconSize(qs)); cookie.setMaxAge(/* ~4...
vuln
Safe
Java
public static void unzipFile(String zipFile, String destDir) { File dir = new File(destDir); // create output directory if it doesn't exist if(!dir.exists()) dir.mkdirs(); //buffer for read and write data to file byte[] buffer = new byte[1024]; try (ZipInputStrea...
vuln
Vulnerable
Java
static av_cold void compute_alpha_vlcs(void) { uint16_t run_code[129], level_code[256]; uint8_t run_bits[129], level_bits[256]; int run, level; for (run = 0; run < 128; run++) { if (!run) { run_code[run] = 0; run_bits[run] = 1; } else if (run <= 4) { ...
vuln
Vulnerable
C/C++
def get_cman_version() begin stdout, stderror, retval = run_cmd( PCSAuth.getSuperuserSession, CMAN_TOOL, "-V" ) rescue stdout = [] end if retval == 0 match = /(\d+)\.(\d+)\.(\d+)/.match(stdout.join()) if match return match[1..3].collect { | x | x.to_i } end end return nil...
vuln
Vulnerable
Ruby
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % ...
vuln
Vulnerable
C/C++
@Override public void process(RequestEvent event) throws IOException { FeatureManager featureManager = event.getFeatureManager(); List<ActivationStrategy> strategies = featureManager.getActivationStrategies(); IndexPageTabView tabView = new IndexPageTabView(strategies); for (Feat...
vuln
Safe
Java
static pyc_object *get_complex_object(RzBinPycObj *pyc, RzBuffer *buffer) { pyc_object *ret = NULL; bool error = false; ut32 n1 = 0; ut32 n2 = 0; ret = RZ_NEW0(pyc_object); if (!ret) { return NULL; } if ((pyc->magic_int & 0xffff) <= 62061) { n1 = get_ut8(buffer, &error); } else { n1 = get_st32(buffer, ...
vuln
Safe
C/C++
void rand_seed(uint8_t *buf, int size) { ctx_t *ctx = core_get(); int len = (RLC_RAND_SIZE - 1) / 2; if (size <= 0) { RLC_THROW(ERR_NO_VALID); return; } if (sizeof(int) > 4 && size > (1 << 32)) { RLC_THROW(ERR_NO_VALID); return; } ctx->rand[0] = 0x0; if (ctx->seeded == 0) { /* V = hash_df(seed). */...
vuln
Vulnerable
C/C++
void jpc_qmfb_join_col(jpc_fix_t *a, int numrows, int stride, int parity) { int bufsize = JPC_CEILDIVPOW2(numrows, 1); jpc_fix_t joinbuf[QMFB_JOINBUFSIZE]; jpc_fix_t *buf = joinbuf; register jpc_fix_t *srcptr; register jpc_fix_t *dstptr; register int n; int hstartcol; /* Allocate memory for the join buffer ...
vuln
Vulnerable
Unknown
def __init__( self, web_path: Union[str, List[str]], header_template: Optional[dict] = None ): """Initialize with webpage path.""" # TODO: Deprecate web_path in favor of web_paths, and remove this # left like this because there are a number of loaders that expect single # ur...
vuln
Vulnerable
Python
private Either<RenderMaterial, String> findTexture(ResourceLocation resource) { return Either.left(new RenderMaterial(PlayerContainer.LOCATION_BLOCKS_TEXTURE, resource)); }
vuln
Vulnerable
Java
static void imx_eth_enable_rx(IMXFECState *s, bool flush) { IMXFECBufDesc bd; bool rx_ring_full; imx_fec_read_bd(&bd, s->rx_descriptor); rx_ring_full = !(bd.flags & ENET_BD_E); if (rx_ring_full) { FEC_PRINTF("RX buffer full\n"); } else if (flush) { qemu_flush_queued_packets(qemu_...
vuln
Safe
C/C++
# -*- coding: utf-8 -*- from django.contrib.auth.decorators import login_required from django.shortcuts import get_object_or_404 from django.shortcuts import redirect from django.views.decorators.http import require_POST from django.contrib import messages from .models import TopicFavorite from .forms import Favorite...
vuln
Vulnerable
Python
/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Copyright (C) 2004 - 2018 Red Hat, Inc. * Copyright (C) 2005 - 2008 Novell, Inc. */ #include "src/core/nm-default-daemon.h" #include "nm-core-utils.h" #include <fcntl.h> #include <fnmatch.h> #include <unistd.h> #include <stdlib.h> #include <resolv.h> #include <...
vuln
Safe
C/C++
static int perform_http_xact(void) { /* use free instead of g_free so that we can use xstr* functions from * libreport/lib/xfuncs.c */ GHashTable *problem_info = g_hash_table_new_full(g_str_hash, g_str_equal, free, free); /* Read header */ char *body_start ...
vuln
Safe
Unknown
package oci import ( "bytes" "fmt" "io" "io/ioutil" "net" "os" "os/exec" "path/filepath" "strconv" "syscall" "time" "github.com/containernetworking/plugins/pkg/ns" conmonconfig "github.com/containers/conmon/runner/config" "github.com/containers/storage/pkg/pools" "github.com/cri-o/cri-o/internal/config...
vuln
Vulnerable
Go
ServerSecurityFeature::ServerSecurityFeature(application_features::ApplicationServer& server) : ApplicationFeature(server, "ServerSecurity"), _enableFoxxApi(true), _enableFoxxStore(true), _hardenedRestApi(false), _foxxAllowInstallFromRemote(false) { setOptional(false); startsAfter<applic...
vuln
Safe
C/C++
def eval(self, string): """eval(string) -> value Evaluates a string in the context of values of this module. Example: >>> with context.local(arch = 'i386', os = 'linux'): ... print(13 == constants.eval('SYS_execve + PROT_WRITE')) True >>> wit...
vuln
Vulnerable
Python
STATIC ptr_t GC_alloc_large_and_clear(size_t lb, int k, unsigned flags) { ptr_t result; GC_ASSERT(I_HOLD_LOCK()); result = GC_alloc_large(lb, k, flags); if (result != NULL && (GC_debugging_started || GC_obj_kinds[k].ok_init)) { word n_blocks = OBJ_SZ_TO_BLOCKS(lb); /* Clear t...
vuln
Safe
Unknown
/* * Copyright 2016 Red Hat, Inc. and/or its affiliates * and other contributors as indicated by the @author tags. * * 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.apach...
vuln
Safe
Java
parse_update_subtlv(const unsigned char *a, int alen, unsigned char *channels) { int type, len, i = 0; while(i < alen) { type = a[i]; if(type == SUBTLV_PAD1) { i++; continue; } if(i + 1 >= alen) { flog_err(EC_BABEL_PACKET,...
vuln
Safe
Unknown
static struct property *dlpar_parse_cc_property(struct cc_workarea *ccwa) { struct property *prop; char *name; char *value; prop = kzalloc(sizeof(*prop), GFP_KERNEL); if (!prop) return NULL; name = (char *)ccwa + be32_to_cpu(ccwa->name_offset); prop->name = kstrdup(name, GFP_KERNEL); if (!prop->name) { dl...
vuln
Safe
C/C++
make_backsig (PKT_signature *sig, PKT_public_key *pk, PKT_public_key *sub_pk, PKT_public_key *sub_psk, u32 timestamp, const char *cache_nonce) { gpg_error_t err; PKT_signature *backsig; cache_public_key (sub_pk); err = make_keysig_packet (&backsig, pk, NULL, sub_pk, sub_psk, 0x19, ...
vuln
Safe
Unknown
/* * Swagger Petstore * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ * * OpenAPI spec version: 1.0.0 * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator p...
vuln
Safe
Java
void HTMLElement::insertAdjacentHTML(const String& where, const String& markup, ExceptionCode& ec) { RefPtr<DocumentFragment> fragment = document()->createDocumentFragment(); Element* contextElement = contextElementForInsertion(where, this, ec); if (!contextElement) return; if (document()->i...
vuln
Vulnerable
C/C++
static Image *ReadXWDImage(const ImageInfo *image_info,ExceptionInfo *exception) { #define CheckOverflowException(length,width,height) \ (((height) != 0) && ((length)/((size_t) height) != ((size_t) width))) char *comment; Image *image; int x_status; MagickBooleanType authentic_colormap; ...
vuln
Safe
C/C++
QemuOptsList *qemu_opts_append(QemuOptsList *dst, QemuOptsList *list) { size_t num_opts, num_dst_opts; QemuOptDesc *desc; bool need_init = false; if (!list) { return dst; } if (!dst) { need_init = true; } num_opts = count_opts_list(dst)...
vuln
Vulnerable
C/C++
uint16_t get_l2protocol(const u_char *pktdata, const int datalen, const int datalink) { uint16_t eth_hdr_offset = 0; if (!pktdata || !datalen) { errx(-1, "invalid l2 parameters: pktdata=0x%p len=%d", pktdata, datalen); return 0; } switch (datalink) { case DLT_RAW: ...
vuln
Safe
C/C++
static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_field *field, struct hid_usage *usage) { struct input_dev *input = hidinput->input; struct hid_device *device = input_get_drvdata(input); int max = 0, code; unsigned long *bit = NULL; field->hidinput = hidinput; if (field->flag...
vuln
Vulnerable
Unknown
static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data, unsigned int len) { struct rtl_priv *rtlpriv = rtl_priv(hw); struct ieee80211_mgmt *mgmt = data; struct rtl_p2p_ps_info *p2pinfo = &(rtlpriv->psc.p2p_ps_info); u8 *pos, *end, *ie; u16 noa_len; static u8 p2p_oui_ie_type[4] = {0x50, 0x6f, 0x9a, 0...
vuln
Vulnerable
C/C++
int ssl3_send_client_key_exchange(SSL *s) { unsigned char *p; int n; unsigned long alg_k; #ifndef OPENSSL_NO_RSA unsigned char *q; EVP_PKEY *pkey = NULL; #endif #ifndef OPENSSL_NO_KRB5 KSSL_ERR kssl_err; #endif /* OPENSSL_NO_KRB5 */ #ifndef OPENSSL_NO_ECDH EC_KEY *cl...
vuln
Safe
Unknown
@Nullable private static String findNonEmptyMapStart(XContentParser parser) throws IOException { Token token = parser.currentToken(); if (token == null) { token = parser.nextToken(); } if (token == XContentParser.Token.START_OBJECT) { return parser.nextFieldNa...
vuln
Safe
Java
static void load_xmt_done(GF_SceneLoader *load) { GF_XMTParser *parser = (GF_XMTParser *)load->loader_priv; if (!parser) return; while (1) { XMTNodeStack *st = (XMTNodeStack *)gf_list_last(parser->nodes); if (!st) break; gf_list_rem_last(parser->nodes); gf_node_register(st->node, NULL); gf_node_unregister...
vuln
Safe
C/C++
static int link_pipe(struct pipe_inode_info *ipipe, struct pipe_inode_info *opipe, size_t len, unsigned int flags) { struct pipe_buffer *ibuf, *obuf; int ret = 0, i = 0, nbuf; /* * Potential ABBA deadlock, work around it by ordering lock * grabbing by pipe info address. Otherwise two different pro...
vuln
Vulnerable
Unknown
private void moveToLastMeasurement() { Measurement lastMeasurement = MeasurementsDatabase.getInstance(MyApplication.getApplication()).getLastMeasurement(); if (lastMeasurement != null) { moveToLocation(lastMeasurement.getLatitude(), lastMeasurement.getLongitude()); } else { ...
vuln
Vulnerable
Java
/** * Semantic Release Config */ const fs = require('fs').promises; const path = require('path'); // Get env vars const ref = process.env.GITHUB_REF; const serverUrl = process.env.GITHUB_SERVER_URL; const repository = process.env.GITHUB_REPOSITORY; const repositoryUrl = serverUrl + '/' + repository; // Declare par...
vuln
Safe
JavaScript
static int vmdk_init_tables(BlockDriverState *bs, VmdkExtent *extent, Error **errp) { int ret; size_t l1_size; int i; l1_size = extent->l1_size * sizeof(uint32_t); extent->l1_table = g_try_malloc(l1_size); if (l1_size && extent->l1_table == NULL) { return...
vuln
Safe
C/C++
public static void onActionMenuItemSelected( final RedditPreparedPost post, final BaseActivity activity, final Action action) { switch(action) { case UPVOTE: post.action(activity, RedditAPI.ACTION_UPVOTE); break; case DOWNVOTE: post.action(activity, RedditAPI.ACTION_DOWNVOTE); break;...
vuln
Vulnerable
Java
pim_print(netdissect_options *ndo, register const u_char *bp, register u_int len, const u_char *bp2) { register const struct pim *pim = (const struct pim *)bp; #ifdef notyet /* currently we see only version and type */ ND_TCHECK(pim->pim_rsv); #endif ND_TCHECK(pim->pim_typever); switch (PIM_VER(pim->p...
vuln
Safe
C/C++
OMX_ERRORTYPE omx_video::empty_this_buffer(OMX_IN OMX_HANDLETYPE hComp, OMX_IN OMX_BUFFERHEADERTYPE* buffer) { OMX_ERRORTYPE ret1 = OMX_ErrorNone; unsigned int nBufferIndex ; DEBUG_PRINT_LOW("ETB: buffer = %p, buffer->pBuffer[%p]", buffer, buffer->pBuffer); if (m_state == OMX_State...
vuln
Vulnerable
C/C++
static av_cold void construct_perm_table(TwinContext *tctx,enum FrameType ftype) { int block_size; const ModeTab *mtab = tctx->mtab; int size; int16_t *tmp_perm = (int16_t *) tctx->tmp_buf; if (ftype == FT_PPC) { size = tctx->avctx->channels; block_size = mtab->ppc_shape_len; } ...
vuln
Safe
C/C++
static int accept_server_socket(int sfd) { struct sockaddr_un remote; struct pollfd pfd; int fd; socklen_t len = sizeof(struct sockaddr_un); BTIF_TRACE_EVENT("accept fd %d", sfd); /* make sure there is data to process */ pfd.fd = sfd; pfd.events = POLLIN; if (TEMP_FAILURE_RETRY(poll(&pfd, 1,...
vuln
Safe
C/C++
private String displayCategory(final String friendlyUrl, final String ref, Model model, HttpServletRequest request, HttpServletResponse response, Locale locale) throws Exception { MerchantStore store = (MerchantStore)request.getAttribute(Constants.MERCHANT_STORE); //set ref as request attribute String encoded...
vuln
Safe
Java
public AccountEntity loadArweaveAccount() { try { CoinEntity coinEntity = this.loadCoinSync(Coins.AR.coinId()); List<AccountEntity> accountEntityList = this.loadAccountsForCoin(coinEntity); if (accountEntityList.size() > 0) return accountEntityList.get(0); return ...
vuln
Safe
Java
package org.mozilla.jss.ssl.javax; import java.io.InputStream; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; import java.nio.ByteBuffer; import java.nio.channels.Channels; import java.nio.channels.WritableByteChannel; import java.security.PublicKey; import javax.net.ssl.SSLEngineR...
vuln
Vulnerable
Java
@Override public void abandon() { if (hasParentSessionId()) { throw new IllegalStateException( "Session " + sessionId + " is a child of multi-package session " + mParentSessionId + " and may not be abandoned directly."); } synchron...
vuln
Safe
Java
static int decode_seq_header(AVSContext *h) { MpegEncContext *s = &h->s; int frame_rate_code; int width, height; h->profile = get_bits(&s->gb,8); h->level = get_bits(&s->gb,8); skip_bits1(&s->gb); width = get_bits(&s->gb,14); height = get_bits(...
vuln
Vulnerable
C/C++
/* * Copyright IBM Corporation, 2010 * Author Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2.1 of the GNU Lesser General Public License * as published by the Free Software Foundation. * * This program ...
vuln
Safe
C/C++
func (rarFormat) Read(input io.Reader, destination string) error { rr, err := rardecode.NewReader(input, "") if err != nil { return fmt.Errorf("read: failed to create reader: %v", err) } for { header, err := rr.Next() if err == io.EOF { break } else if err != nil { return err } if header.IsDir {...
vuln
Vulnerable
Go
@Override protected XrootdResponse<StatRequest> doOnStat(ChannelHandlerContext ctx, StatRequest req) throws XrootdException { try { String path = req.getPath(); LoginSessionInfo loginSessionInfo = sessionInfo(); InetSocketAddress client = getSourceAddress(); ...
vuln
Safe
Java
public void write(ByteBuffer buffer) { if (isClosed.get()) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("it will not writeDirectly because of closed " + this + " " + isClosed); } if (buffer != null) { recycle(buffer); } ...
vuln
Vulnerable
Java
/* * Copyright 2002-2023 the original author or 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by a...
vuln
Safe
Java
/*jshint node:true*/ "use strict"; var exec = require("child_process").exec; function runCommand(command, args, done) { if(typeof args === "function") { done = args; args = ""; } exec("p4 " + command + " " + (args || ""), function(err, stdOut, stdErr) { if(err) return done(err); ...
vuln
Vulnerable
JavaScript
archive_acl_from_text_l(struct archive_acl *acl, const char *text, int want_type, struct archive_string_conv *sc) { struct { const char *start; const char *end; } field[6], name; const char *s, *st; int numfields, fields, n, r, sol, ret; int type, types, tag, permset, id; size_t len; char sep; switch ...
vuln
Vulnerable
C/C++
static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path, const char *name, V9fsPath *target) { if (ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(ctx, name)) { errno = EINVAL; return -1; } if (dir_path) { v9fs_...
vuln
Safe
Unknown
/* * 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
public void startTracking(@NonNull Context context) { final IntentFilter filter = new IntentFilter(); filter.addAction(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED); context.registerReceiver(this, filter); // Initialise tracker state. mPowerSaveModeEnabled = m...
vuln
Vulnerable
Java
void IptcData::printStructure(std::ostream& out, const Slice<byte*>& bytes, uint32_t depth) { if (bytes.size() < 3) { return; } size_t i = 0; while (i < bytes.size() - 3 && bytes.at(i) != 0x1c) i++; depth++; out << Internal::indent(depth) << "R...
vuln
Safe
C/C++
ngx_mail_read_command(ngx_mail_session_t *s, ngx_connection_t *c) { ssize_t n; ngx_int_t rc; ngx_str_t l; ngx_mail_core_srv_conf_t *cscf; if (s->buffer->last < s->buffer->end) { n = c->recv(c, s->buffer->last, s->buffer->end - s->buffer...
vuln
Safe
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
Safe
Java
#include "http.h" #include "arch.h" #include "base64.h" #include "log.h" #include "net.h" #include "ssi.h" #include "util.h" #include "version.h" #include "ws.h" // Multipart POST example: // --xyz // Content-Disposition: form-data; name="val" // // abcdef // --xyz // Content-Disposition: form-data; name="foo"; filena...
vuln
Safe
C/C++
def generateKeys(len=1024): fludkey = FludRSA.generate(len) return fludkey.publickey(), fludkey.privatekey()
vuln
Vulnerable
Python
int sql_trans_drop_column(sql_trans *tr, sql_table *t, sqlid id, int drop_action) { sqlstore *store = tr->store; node *n = NULL; sql_table *syscolumn = find_sql_table(tr, find_sql_schema(tr, isGlobal(t)?"sys":"tmp"), "_columns"); sql_column *col = NULL, *cid = find_sql_column(syscolumn, "id"), *cnr = find_sql_colum...
vuln
Vulnerable
C/C++
package com.databasir.core.infrastructure.connection; import com.databasir.core.domain.DomainErrors; import com.databasir.core.infrastructure.driver.DriverResources; import com.databasir.dao.impl.DatabaseTypeDao; import com.databasir.dao.tables.pojos.DatabaseTypePojo; import lombok.RequiredArgsConstructor; import lomb...
vuln
Safe
Java
@Override public boolean onUnbind(Intent intent) { // We must unbind from any overlay connection if we are unbound before finishing. if (mOverlayConnection != null) { mOverlayConnection.unbind(); } return super.onUnbind(intent); }
vuln
Safe
Java
int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *max) { struct page *page; struct address_space *mapping; __be32 *pptr, *curr, *end; u32 mask, start, len, n; __be32 val; int i; len = *max; if (!len) return size; dprint(DBG_BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len...
vuln
Vulnerable
Unknown
@NonNull public static String trim(CharSequence s) { if (s == null) { return ""; } // Just strip any sequence of whitespace or java space characters from the beginning and end Matcher m = sTrimPattern.matcher(s); return m.replaceAll("$1"); }
vuln
Safe
Java
package com.salesmanager.core.model.catalog.product.availability; import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Embedded; import javax.persistence.Entity; import javax.persistence.FetchType; import...
vuln
Safe
Java
static int packet_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags) { struct sock *sk = sock->sk; struct sk_buff *skb; int copied, err; struct sockaddr_ll *sll; int vnet_hdr_len = 0; err = -EINVAL; if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC|MSG_CMSG_COMPAT|MSG_E...
vuln
Vulnerable
C/C++
static int read_ts(const char *s, int64_t *start, int *duration) { int64_t end; int hh1, mm1, ss1, ms1; int hh2, mm2, ss2, ms2; if (sscanf(s, "%u:%u:%u.%u,%u:%u:%u.%u", &hh1, &mm1, &ss1, &ms1, &hh2, &mm2, &ss2, &ms2) == 8) { end = (hh2*3600LL + mm2*60LL + ss2) * 100LL + ms2; ...
vuln
Safe
C/C++
static int zrle_compress_data(VncState *vs, int level) { z_streamp zstream = &vs->zrle->stream; buffer_reset(&vs->zrle->zlib); if (zstream->opaque != vs) { int err; zstream->zalloc = vnc_zlib_zalloc; zstream->zfree = vnc_zlib_zfree; err = deflateInit2(zstream, level, Z_DE...
vuln
Safe
Unknown
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // HTTP reverse proxy handler package providers import ( logger "github.com/TykTechnologies/tyk-identity-broker/log" "github.com/sirupsen/logrus" "io" "ne...
vuln
Vulnerable
Go