code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
// A RestWrite encapsulates everything we need to run an operation // that writes to the database. // This could be either a "create" or an "update". var SchemaController = require('./Controllers/SchemaController'); var deepcopy = require('deepcopy'); const Auth = require('./Auth'); var cryptoUtils = require('./crypt...
vuln
Vulnerable
JavaScript
R_API void r_anal_bb_free(RAnalBlock *bb) { if (!bb) { return; } r_anal_cond_free (bb->cond); R_FREE (bb->fingerprint); r_anal_diff_free (bb->diff); bb->diff = NULL; R_FREE (bb->op_bytes); r_anal_switch_op_free (bb->switch_op); bb->switch_op = NULL; bb->fingerprint = NULL; bb->cond = NULL; R_FREE (bb->lab...
vuln
Vulnerable
C/C++
static PHP_FUNCTION(gzopen) { char *filename; char *mode; int filename_len, mode_len; int flags = REPORT_ERRORS; php_stream *stream; long use_include_path = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &filename, &filename_len, &mode, &mode_len, &use_include_path) == FAIL...
cwe
CWE-254
C/C++
@Override public void onRequiemInitialize() { registerEtherealEventHandlers(); registerPossessionEventHandlers(); ReclamationStatusEffect.registerEventHandlers(); CanCurePossessedCallback.EVENT.register((body) -> { CurableEntityComponent curableEntityComponent = CurableEn...
vuln
Safe
Java
static void copy_recurse_data(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend, int type, int stackptr, int stacktop, BOOL has_quit) { delayed_mem_copy_status status; PCRE2_SPTR alternative; sljit_sw private_srcw[2]; sljit_sw shared_srcw[3]; sljit_sw kept_shared_srcw[2]; int private_count, shared_count, kept_...
cwe
CWE-703
Unknown
get_ruser(pam_handle_t *pamh, char *ruserbuf, size_t ruserbuflen) { const void *ruser; struct passwd *pwd; if (ruserbuf == NULL || ruserbuflen < 1) return -2; /* Get the name of the source user. */ if (pam_get_item(pamh, PAM_RUSER, &ruser) != PAM_SUCCESS) { ruser = NULL; } if ((ruser == NULL) || (strlen(rus...
vuln
Safe
C/C++
crypto_retrieve_X509_sans(krb5_context context, pkinit_plg_crypto_context plgctx, pkinit_req_crypto_context reqctx, X509 *cert, krb5_principal **princs_ret, krb5_principal **upn_ret, ...
cwe
CWE-287
C/C++
static int ocsp_verify_signer(X509 *signer, int response, X509_STORE *st, unsigned long flags, STACK_OF(X509) *untrusted, STACK_OF(X509) **chain) { X509_STORE_CTX *ctx = X509_STORE_CTX_new(); X509_VERIFY_PARAM *vp; int ret = -1; if (ctx == NUL...
vuln
Vulnerable
Unknown
/* * 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
function selectRelativeTime() { var quantityField = new Ext.form.TextField({ fieldLabel: 'Show the past', width: 90, allowBlank: false, regex: /\d+/, regexText: 'Please enter a number', value: TimeRange.relativeStartQuantity }); var unitField = new Ext.form.ComboBox({ fieldLabel: '', ...
vuln
Vulnerable
JavaScript
static inline void write_IRQreg (openpic_t *opp, int n_IRQ, uint32_t reg, uint32_t val) { uint32_t tmp; switch (reg) { case IRQ_IPVP: opp->src[n_IRQ].ipvp = (opp->src[n_IRQ].ipvp & 0x40000000) | (val & 0x800F00FF); op...
vuln
Safe
C/C++
def get_ports(self): # First get the active FC ports out = self._cli_run('showport', None) # strip out header # N:S:P,Mode,State,----Node_WWN----,-Port_WWN/HW_Addr-,Type, # Protocol,Label,Partner,FailoverState out = out[1:len(out) - 2] ports = {'FC': [], 'iSCSI'...
cwe
CWE-78
Python
/* * Copyright (C) Alexander Borisov * Copyright (C) Nginx, Inc. */ #include <njs_main.h> static void njs_async_context_free(njs_vm_t *vm, njs_async_ctx_t *ctx); njs_int_t njs_async_function_frame_invoke(njs_vm_t *vm, njs_value_t *retval) { njs_int_t ret; njs_value_t ctor;...
vuln
Safe
C/C++
static grub_disk_addr_t grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock) { struct grub_ext2_data *data = node->data; struct grub_ext2_inode *inode = &node->inode; int blknr = -1; unsigned int blksz = EXT2_BLOCK_SIZE (data); int log2_blksz = LOG2_EXT2_BLOCK_SIZE (data); if (grub_le...
vuln
Safe
C/C++
public RechnungCostEditTablePanel(final String id) { super(id); feedbackPanel = new FeedbackPanel("feedback"); ajaxComponents.register(feedbackPanel); add(feedbackPanel); this.form = new Form<AbstractRechnungsPositionDO>("form"); add(form); rows = new RepeatingView("rows"); form.add(ro...
vuln
Vulnerable
Java
public boolean checkUrlParameter(String url) { if (url != null) { try { URL parsedUrl = new URL(url); String protocol = parsedUrl.getProtocol(); String host = parsedUrl.getHost().toLowerCase(); return (protocol.equals("http") || protocol.equals("https")) && !host.endsWith(".internal") ...
vuln
Vulnerable
Java
int MDC2_Update(MDC2_CTX *c, const unsigned char *in, size_t len) { size_t i, j; i = c->num; if (i != 0) { if (i + len < MDC2_BLOCK) { /* partial block */ memcpy(&(c->data[i]), in, len); c->num += (int)len; return 1; } else { ...
vuln
Vulnerable
Unknown
static int decomp(unsigned char *srcBuf, unsigned char **jpegBuf, unsigned long *jpegSize, unsigned char *dstBuf, int w, int h, int subsamp, int jpegQual, char *fileName, int tilew, int tileh) { char tempStr[1024], sizeStr[24] = "\0", qualStr[13] = "\0", *ptr; F...
vuln
Vulnerable
C/C++
int tcpdump_open(tcpdump_t *tcpdump, pcap_t *pcap) { assert(tcpdump); assert(pcap); if (tcpdump->pid != 0) { warn("tcpdump process already running"); return FALSE; } /* is tcpdump executable? */ if (! can_exec(TCPDUMP_BINARY)) { errx(-1, "Unable to execute tcpdump binar...
vuln
Safe
C/C++
public void prepare() { if(sections != null) { return; } sections = new LevelChunkSection[totalLength]; int i = 0; for(int z = minZ; z <= maxZ; z++) { for(int y = minY; y <= maxY; y++) { for(int x = minX; x <= maxX; x++) { ...
vuln
Vulnerable
Java
WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info, const int argc,const char **argv,Image **images,ExceptionInfo *exception) { ChannelType channel; const char *option; ImageInfo *mogrify_info; MagickStatusType status; QuantizeInfo *quantize_info; register ssize_t...
cwe
CWE-399
C/C++
static int decomp(unsigned char *srcBuf, unsigned char **jpegBuf, unsigned long *jpegSize, unsigned char *dstBuf, int w, int h, int subsamp, int jpegQual, char *fileName, int tilew, int tileh) { char tempStr[1024], sizeStr[24] = "\0", qualStr[13] = "\0", *ptr; F...
cwe
CWE-787
C/C++
MagickExport Image *SpliceImage(const Image *image, const RectangleInfo *geometry,ExceptionInfo *exception) { #define SpliceImageTag "Splice/Image" CacheView *image_view, *splice_view; Image *splice_image; MagickBooleanType status; MagickOffsetType progress; RectangleInfo spli...
cwe
CWE-125
C/C++
def self.publish_unread(post) return unless post.topic.regular? # TODO at high scale we are going to have to defer this, # perhaps cut down to users that are around in the last 7 days as well group_ids = if post.post_type == Post.types[:whisper] [Group::AUTO_GROUPS[:staff]] else ...
cwe
CWE-200
Ruby
/* * Copyright (C) 2003, 2004, 2005, 2006 Joe Walnes. * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2020, 2021 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD * style license a copy of which has bee...
cwe
CWE-400
Java
null!=u.showRemoteCursors&&(EditorUi.prototype.showRemoteCursors=u.showRemoteCursors)}};Editor.configureFontCss=function(u){if(null!=u){Editor.prototype.fontCss=u;var D=document.getElementsByTagName("script")[0];if(null!=D&&null!=D.parentNode){var K=document.createElement("style");K.setAttribute("type","text/css");K.ap...
vuln
Safe
JavaScript
static ssize_t usbnet_receive(VLANClientState *nc, const uint8_t *buf, size_t size) { USBNetState *s = DO_UPCAST(NICState, nc, nc)->opaque; struct rndis_packet_msg_type *msg; if (is_rndis(s)) { msg = (struct rndis_packet_msg_type *) s->in_buf; if (s->rndis_state != RNDIS_DATA_INITIALIZED) { ...
vuln
Safe
C/C++
xmlParseReference(xmlParserCtxtPtr ctxt) { xmlEntityPtr ent; xmlChar *val; int was_checked; xmlNodePtr list = NULL; xmlParserErrors ret = XML_ERR_OK; if (RAW != '&') return; /* * Simple case of a CharRef */ if (NXT(1) == '#') { int i = 0; xmlChar out[10]; int hex ...
vuln
Safe
Unknown
int main(int argc, char **argv) { char bin_log_name[FN_REFLEN]; int exit_code, md_result_fd; MY_INIT("mysqldump"); compatible_mode_normal_str[0]= 0; default_charset= (char *)mysql_universal_client_charset; memset(&ignore_table, 0, sizeof(ignore_table)); exit_code= get_options(&argc, &argv); if (exit_c...
vuln
Safe
Unknown
Datum ts_hypertable_get_open_dim_max_value(const Hypertable *ht, int dimension_index, bool *isnull) { StringInfo command; const Dimension *dim; int res; bool max_isnull; Datum maxdat; dim = hyperspace_get_open_dimension(ht->space, dimension_index); if (NULL == dim) elog(ERROR, "invalid open dimension index %...
vuln
Vulnerable
C/C++
# -*- coding: utf-8 -*- # This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web) # Copyright (C) 2018-2019 OzzieIsaacs, cervinko, jkrehm, bodybybuddha, ok11, # andy29485, idalin, Kyosfonica, wuqi, Kennyl, lemmsh, # falgh1, grunjol, csitk...
cwe
CWE-352
Python
/* * 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...
cwe
CWE-287
Java
static void qcow2_close(BlockDriverState *bs) { BDRVQcowState *s = bs->opaque; g_free(s->l1_table); s->l1_table = NULL; if (!(bs->open_flags & BDRV_O_INCOMING)) { qcow2_cache_flush(bs, s->l2_table_cache); qcow2_cache_flush(bs, s->refcount_block_cache); qcow2_mark_clean(bs); ...
vuln
Vulnerable
C/C++
import graphene from django.contrib.auth import password_validation from django.contrib.auth.tokens import default_token_generator from django.core.exceptions import ObjectDoesNotExist, ValidationError from ....account import events as account_events from ....account import models from ....account.error_codes import A...
vuln
Safe
Python
SPL_METHOD(Array, unserialize) { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *buf; int buf_len; const unsigned char *p, *s; php_unserialize_data_t var_hash; zval *pmembers, *pflags = NULL; long flags; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC...
vuln
Vulnerable
Unknown
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node, bool is_arg_max) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); const TfLiteTensor* axis = GetInput(context, node, kAxis); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); if (IsDynamicTensor(output)) { TF_LITE_...
cwe
CWE-787
C/C++
static ssize_t cpu_capacity_show(struct device *dev, struct device_attribute *attr, char *buf) { struct cpu *cpu = container_of(dev, struct cpu, dev); return sprintf(buf, "%lu\n", topology_get_cpu_scale(cpu->dev.id)); }
vuln
Vulnerable
Unknown
public BETiles getNeighbour(Facing facing) { if (neighboursBEs == null) neighboursBEs = new HashMap<>(); else if (neighboursBEs.containsKey(facing)) return neighboursBEs.get(facing); BlockEntity be = this.be.getLevel().getBlockEntity(this.be.getBlockPos().relative(facing....
vuln
Safe
Java
void OpenSSL_add_all_ciphers(void) { #ifndef OPENSSL_NO_DES EVP_add_cipher(EVP_des_cfb()); EVP_add_cipher(EVP_des_cfb1()); EVP_add_cipher(EVP_des_cfb8()); EVP_add_cipher(EVP_des_ede_cfb()); EVP_add_cipher(EVP_des_ede3_cfb()); EVP_add_cipher(EVP_des_ede3_cfb1()); EVP_add_cipher(EVP_des_ede3_cfb8()); EVP_add_c...
vuln
Vulnerable
C/C++
function Ws(e){Us=e}
cwe
CWE-79
JavaScript
public NodeContext writeLine(String line) throws IOException { if (line.contains("\n")) { synchronized (debugOutput) { debugOutput.println("Writing multiple lines to NodeJS context:"); debugOutput.println("START >>>>>>>>>"); } int lineNumber = ...
vuln
Vulnerable
Java
init: function (editor) { if (editor.addFeature) { editor.addFeature({ allowedContent: 'img[alt,id,!src]{width,height};' }); } editor.on('paste', (event, a, b) => { this.onPaste(event); }); const pluginName = 'base64image-dialog'; editor.ui.addToolbarGroup('base64image', 'insert'); editor.ui....
vuln
Safe
JavaScript
// mkerrors.sh // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm,darwin // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- _const.go package unix import "syscall" const ( AF_APPLETALK = 0x10 AF_CCITT = 0xa AF_CHAOS ...
vuln
Safe
Go
static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, bool reconnect, bool suppress_warnings) { int slave_was_killed= 0; int last_errno= -2; // impossible error ulong err_count=0; char llbuff[22]; char password[MAX_PASSWORD_LENGTH + 1]; ...
cwe
CWE-295
C/C++
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { TfLiteType output_type = GetOutput(context, node, kOutputTensor)->type; switch (output_type) { // Already know in/outtypes are same. case kTfLiteFloat32: EvalUnquantized<float>(context, node); break; case kTfLiteInt32: EvalUnq...
cwe
CWE-787
C/C++
void ImageLoader::DoUpdateFromElement(BypassMainWorldBehavior bypass_behavior, UpdateFromElementBehavior update_behavior, const KURL& url, ReferrerPolicy referrer_policy, ...
cwe
CWE-19
C/C++
static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509_CRL **pdcrl, X509 **pissuer, int *pscore, unsigned int *preasons, STACK_OF(X509_CRL) *crls) { int i, crl_score, best_score = *pscore; unsigned int reasons, best_reasons = 0; X509 *x = ctx->current_ce...
cwe
CWE-476
Unknown
/* * FreeRTOS Kernel V10.4.2 * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * 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, includ...
cwe
CWE-190
C/C++
GF_Err ParseScriptField(ScriptParser *parser) { GF_ScriptField *field; GF_Err e; u32 eventType, fieldType; char name[1000]; GF_FieldInfo info; eventType = gf_bs_read_int(parser->bs, 2); fieldType = gf_bs_read_int(parser->bs, 6); gf_bifs_dec_name(parser->bs, name, 1000); field = gf_sg_script_field_new(parser->...
vuln
Safe
C/C++
private static boolean checkParMatrixMultRightInputRows( MatrixBlock m1, MatrixBlock m2, int k ) { //parallelize over rows in rhs matrix if number of rows in lhs/output is very small return (m1.rlen==1 && LOW_LEVEL_OPTIMIZATION && m2.clen>1 && !(m1.isUltraSparse()||m2.isUltraSparse())) || (m1.rlen<=16 && LOW_LEV...
vuln
Vulnerable
Java
int fuse_set_acl(struct inode *inode, struct posix_acl *acl, int type) { struct fuse_conn *fc = get_fuse_conn(inode); const char *name; int ret; if (!fc->posix_acl || fc->no_setxattr) return -EOPNOTSUPP; if (type == ACL_TYPE_ACCESS) name = XATTR_NAME_POSIX_ACL_ACCESS; else if (type == ACL_TYPE_DEFAULT) na...
cwe
CWE-459
Unknown
/******************************************************************************* * Copyright 2018 The MIT Internet Trust Consortium * * Portions copyright 2011-2013 The MITRE Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the L...
cwe
CWE-915
Java
public void onClose() { if (selection != -1 && itemSelection[selection] != Items.AIR) { List<Slot> slots = ItemUtil.findSlotsMatchingItem(itemSelection[selection], true); if (!slots.isEmpty()) { Slot slot = slots.get(0); if (slot.inventory() == -1) { ...
vuln
Vulnerable
Java
hash_link_ref(const uint8_t *link_ref, size_t length) { size_t i; unsigned int hash = 0; for (i = 0; i < length; ++i) hash = tolower(link_ref[i]) + (hash << 6) + (hash << 16) - hash; return hash; }
cwe
CWE-327
C/C++
public ProductServletConfigurator(ServerConfig serverConfig, ShiroFilter shiroFilter, GitFilter gitFilter, GitPreReceiveCallback preReceiveServlet, GitPostReceiveCallback postReceiveServlet, WicketServlet wicketServlet, WebSocketManager webSocketManager, AttachmentUploadServlet attachmentUploadServlet, Serv...
cwe
CWE-502
JavaScript
static void *ff_avio_child_next(void *obj, void *prev) { AVIOContext *s = obj; AVIOInternal *internal = s->opaque; return prev ? NULL : internal->h; }
vuln
Vulnerable
C/C++
int qcrypto_cipher_decrypt(QCryptoCipher *cipher, const void *in, void *out, size_t len, Error **errp) { QCryptoCipherBuiltin *ctxt = cipher->opaque; if (len % ctxt->blocksize) { error_setg(errp, ...
vuln
Safe
C/C++
function H(ia){if(ba!=ia||P!=da)A(),Aa.scrollTop=0,ea.innerHTML="",ha.innerHTML=mxUtils.htmlEntities(mxResources.get("searchResults"))+' "'+mxUtils.htmlEntities(ia)+'"',va=null,Z?F(ia):d&&(ia?(Ha.spin(ea),U=!1,V=!0,d(ia,ua,function(){z(mxResources.get("searchFailed")); ua([])},P?null:n)):I(P)),ba=ia,da=P}
cwe
CWE-94
JavaScript
void Compute(OpKernelContext* ctx) override { StagingMap<Ordered>* map = nullptr; OP_REQUIRES_OK(ctx, GetStagingMap(ctx, def(), &map)); core::ScopedUnref scope(map); typename StagingMap<Ordered>::OptionalTuple tuple; const Tensor* key_tensor; const Tensor* indices_tensor; OpInputList values...
vuln
Vulnerable
Unknown
/* Library for accessing X3F Files ---------------------------------------------------------------- BSD-style License ---------------------------------------------------------------- * Copyright (c) 2010, Roland Karlsson (roland@proxel.se) * All rights reserved. * * Redistribution and use in source and binary forms, w...
cwe
CWE-125
C/C++
Status InferenceContext::Multiply(DimensionHandle first, DimensionOrConstant second, DimensionHandle* out) { const int64_t first_value = Value(first); const int64_t second_value = Value(second); // Special cases. if (first_value == 0) { *ou...
cwe
CWE-190
C/C++
static int renameUnmapSelectCb(Walker *pWalker, Select *p){ Parse *pParse = pWalker->pParse; int i; if( pParse->nErr ) return WRC_Abort; if( ALWAYS(p->pEList) ){ ExprList *pList = p->pEList; for(i=0; i<pList->nExpr; i++){ if( pList->a[i].zName ){ sqlite3RenameTokenRemap(pParse, 0, (void*)p...
cwe
CWE-787
Unknown
public StubServer run() { simpleServer.getServerConfiguration().addHttpHandler(stubsToHandler(), "/"); simpleServer.getListeners().forEach(l -> l.getKeepAlive().setMaxRequestsCount(0)); try { if (secured) { for (NetworkListener networkListener : simpleServer.getListen...
vuln
Vulnerable
Java
void psf_asciiheader_printf (SF_PRIVATE *psf, const char *format, ...) { va_list argptr ; int maxlen ; char *start ; maxlen = strlen ((char*) psf->header) ; start = ((char*) psf->header) + maxlen ; maxlen = sizeof (psf->header) - maxlen ; va_start (argptr, format) ; vsnprintf (start, maxlen, format, argptr) ;...
vuln
Vulnerable
C/C++
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onUnclaimed(ClaimDeletedEvent event) { if (!deleteOnUnClaim) { return; } Claim claim = event.getClaim(); for (Chunk chunk : claim.getChunks()) { Map<Location, Shop> shops = plu...
vuln
Vulnerable
Java
kadm5_ret_t kadm5_create_principal_3(void *server_handle, kadm5_principal_ent_t entry, long mask, int n_ks_tuple, krb5_key_salt_tuple *ks_tuple, char *password) { krb5_db_entry *kdb; osa_princ_ent_rec adb; kad...
vuln
Safe
C/C++
int GetU8 (int nPos, bool *pbSuccess) { //*pbSuccess = true; if ( nPos < 0 || nPos >= m_nLen ) { *pbSuccess = false; return 0; } return m_sFile[ nPos ]; }
cwe
CWE-787
C/C++
/** @odoo-module **/ import { registry } from "@web/core/registry"; import { Many2OneAvatarUserField, KanbanMany2OneAvatarUserField, many2OneAvatarUserField, kanbanMany2OneAvatarUserField, } from "@mail/web/fields/many2one_avatar_user_field/many2one_avatar_user_field"; export class Many2OneAvatarEmplo...
cwe
CWE-20
C/C++
static void can_can_gw_rcv(struct sk_buff *skb, void *data) { struct cgw_job *gwj = (struct cgw_job *)data; struct can_frame *cf; struct sk_buff *nskb; int modidx = 0; /* * Do not handle CAN frames routed more than 'max_hops' times. * In general we should never catch this delimiter which is intended * to co...
cwe
CWE-787
C/C++
function(){A()}),1E3)});mxEvent.addListener(q,"click",mxUtils.bind(this,function(L){var M=mxEvent.getSource(L);M!=v&&M!=x?(null!=g&&g(),A(),mxEvent.consume(L)):z()}));window.setTimeout(mxUtils.bind(this,function(){mxUtils.setPrefixedStyle(q.style,"transform","translate(-50%,0%)")}),500);window.setTimeout(z,3E4);m=!0}re...
cwe
CWE-20
JavaScript
$this->run('rm', $item, '-r'); } return $this; }
cwe
CWE-88
PHP
/* * 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-119
C/C++
static void common_unbind(struct common *c) { xen_be_unbind_evtchn(&c->xendev); if (c->page) { munmap(c->page, XC_PAGE_SIZE); c->page = NULL; } }
vuln
Vulnerable
C/C++
hufUncompress (const char compressed[], int nCompressed, unsigned short raw[], int nRaw) { // // need at least 20 bytes for header // if (nCompressed < 20 ) { if (nRaw != 0) notEnoughData(); return; } int im = readUInt (compressed); int iM = readUInt (com...
cwe
CWE-190
Unknown
default boolean definition$onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving) { if (!worldIn.isRemote) { if ((double) state.getBlockHardness(worldIn, pos) != 0.0D) { ToolHelper.damageItem(stack, entityLiving, getToolStats(...
vuln
Safe
Java
/* $Id$ */ /* * The crypt_blowfish homepage is: * * http://www.openwall.com/crypt/ * * This code comes from John the Ripper password cracker, with reentrant * and crypt(3) interfaces added, but optimizations specific to password * cracking removed. * * Written by Solar Designer <solar at openwall.com> in 1998...
vuln
Vulnerable
C/C++
/* * iso_presentation.c * * Copyright 2013-2022 Michael Zillgith * * This file is part of libIEC61850. * * libIEC61850 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 3 of the Lic...
vuln
Safe
C/C++
static inline uint32_t celt_icwrsi(uint32_t N, uint32_t K, const int *y) { int i, idx = 0, sum = 0; for (i = N - 1; i >= 0; i--) { const uint32_t i_s = CELT_PVQ_U(N - i, sum + FFABS(y[i]) + 1); idx += CELT_PVQ_U(N - i, sum) + (y[i] < 0)*i_s; sum += FFABS(y[i]); } return idx; }
vuln
Safe
C/C++
"""Reading/writing Beancount files.""" from __future__ import annotations import datetime import re import threading from codecs import decode from codecs import encode from hashlib import sha256 from operator import attrgetter from typing import Generator from typing import TYPE_CHECKING from beancount.core.data imp...
vuln
Vulnerable
Python
static int scsi_disk_emulate_command(SCSIDiskReq *r, uint8_t *outbuf) { SCSIRequest *req = &r->req; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev); uint64_t nb_sectors; int buflen = 0; switch (req->cmd.buf[0]) { case TEST_UNIT_READY: if (s->tray_open || !bdrv_is_in...
cwe
CWE-119
C/C++
static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVQcowState *s = bs->opaque; int len, i, ret = 0; QCowHeader header; QemuOpts *opts; Error *local_err = NULL; uint64_t ext_end; uint64_t l1_vm_state_index; const char *opt_overl...
vuln
Safe
C/C++
WebNavigationPolicy RenderViewImpl::decidePolicyForNavigation( WebFrame* frame, const WebURLRequest& request, WebNavigationType type, const WebNode&, WebNavigationPolicy default_policy, bool is_redirect) { if (is_swapped_out_) { if (request.url() != GURL("about:swappedout")) return WebKit::WebNaviga...
vuln
Safe
C/C++
import namedavatar from 'namedavatar' import { QuillDeltaToHtmlConverter } from 'quill-delta-to-html' import './projectchart.html' import Projects, { ProjectStats } from '../../api/projects/projects.js' import projectUsers from '../../api/users/users.js' import { getUserSetting, getUserTimeUnitVerbose } from '../../uti...
cwe
CWE-79
JavaScript
Compute(OpKernelContext* context, bool sorted, int k, const typename TTypes<T, 2>::ConstTensor& input, const int64 num_rows, const int64 num_cols, typename TTypes<T, 2>::Tensor values, typename TTypes<int, 2>::Tensor indices) { const CPUDevice& d = context->eigen_device<CPUDevice>(); ...
cwe
CWE-197
Unknown
zundef(i_ctx_t *i_ctx_p) { os_ptr op = osp; os_ptr op1 = op - 1; int code; check_type(*op1, t_dictionary); if (i_ctx_p->in_superexec == 0) check_dict_write(*op1); code = idict_undef(op1, op); if (code < 0 && code != gs_error_undefined) /* ignore undefined error */ return cod...
vuln
Vulnerable
Unknown
public function deleteByName(){ $item_id = I("post.item_id/d"); $env_id = I("post.env_id/d"); $var_name = I("post.var_name"); $login_user = $this->checkLogin(); $uid = $login_user['uid'] ; if(!$this->checkItemEdit($uid , $item_id)){ $this->sendError(1030...
vuln
Safe
PHP
write_message( RenderState state ) { ADisplay adisplay = (ADisplay)state->display.disp; if ( state->message == NULL ) { FontFace face = &state->faces[state->face_index]; int idx, total; idx = face->index; total = 1; while ( total + state->face_index < state->nu...
cwe
CWE-120
C/C++
_Unpickler_MemoGet(UnpicklerObject *self, Py_ssize_t idx) { if (idx < 0 || idx >= self->memo_size) return NULL; return self->memo[idx]; }
cwe
CWE-190
C/C++
static int tls_open(URLContext *h, const char *uri, int flags) { TLSContext *c = h->priv_data; int ret; int port; char buf[200], host[200]; int numerichost = 0; struct addrinfo hints = { 0 }, *ai = NULL; const char *proxy_path; int use_proxy; ff_tls_init(); av_url_split(NULL, 0, ...
vuln
Safe
C/C++
jp2_box_t *jp2_box_create(int type) { jp2_box_t *box; jp2_boxinfo_t *boxinfo; if (!(box = jas_malloc(sizeof(jp2_box_t)))) { return 0; } memset(box, 0, sizeof(jp2_box_t)); box->type = type; box->len = 0; if (!(boxinfo = jp2_boxinfolookup(type))) { return 0; } box->info = boxinfo; box->ops = &boxinfo->ops...
vuln
Vulnerable
C/C++
@PostMapping("/assigners") @ApiOperation(value = "Assigns specified profiles to user or role", produces = MediaType.APPLICATION_JSON_VALUE) @ApiResponses(value = {@ApiResponse(code = HTTP_STATUS_OK, message = API_STATUS_DESCRIPTION)}) public Result<List<? extends AbstractCloudProfileCredentials>...
vuln
Vulnerable
Java
COMPAT_SYSCALL_DEFINE5(waitid, int, which, compat_pid_t, pid, struct compat_siginfo __user *, infop, int, options, struct compat_rusage __user *, uru) { struct rusage ru; struct waitid_info info = {.status = 0}; long err = kernel_waitid(which, pid, &info, options, uru ? &ru : NULL); int signo = 0; if (err > ...
cwe
CWE-20
Unknown
/* * The copyright in this software is being made available under the 2-clauses * BSD License, included below. This software may be subject to other third * party and contributor rights, including patent rights, and no such rights * are granted under this license. * * Copyright (c) 2002-2014, Universite catholiqu...
cwe
CWE-119
C/C++
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...
vuln
Vulnerable
Python
WebstoreBindings::WebstoreBindings(ScriptContext* context) : ObjectBackedNativeHandler(context) { RouteFunction("Install", base::Bind(&WebstoreBindings::Install, base::Unretained(this))); }
cwe
CWE-284
C/C++
/* p_lx_elf.cpp -- This file is part of the UPX executable compressor. Copyright (C) 1996-2019 Markus Franz Xaver Johannes Oberhumer Copyright (C) 1996-2019 Laszlo Molnar Copyright (C) 2000-2019 John F. Reiser All Rights Reserved. UPX and the UCL library are free software; you can redistribute them...
vuln
Vulnerable
C/C++
void WebPageSerializerImpl::openTagToString(Element* element, SerializeDomParam* param) { bool needSkip; StringBuilder result; result.append(preActionBeforeSerializeOpenTag(element, param, &needSkip)); if (needSkip) return; result.append('<'); ...
cwe
CWE-20
C/C++
def delete(self, request, **kwargs): playbook_id = kwargs.get('pk') playbook = get_object_or_404(Playbook, id=playbook_id) work_path = playbook.work_dir file_key = request.query_params.get('key', '') if not file_key: return Response({'msg': 'key is required'}, status=...
vuln
Vulnerable
Python
snmp_ber_encode_type(snmp_packet_t *snmp_packet, uint8_t type) { if(snmp_packet->used == snmp_packet->max) { return 0; } *snmp_packet->out-- = type; snmp_packet->used++; return 1; }
vuln
Safe
C/C++
/* * SPDX-License-Identifier: Apache-2.0 */ // Copyright (c) ONNX Project Contributors. // Licensed under the MIT license. #include "onnx/common/path.h" namespace ONNX_NAMESPACE { std::string path_join(const std::string& origin, const std::string& append) { if (origin.find_last_of(k_preferred_path_separator) !=...
cwe
CWE-22
Python