code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
keepalived_main(int argc, char **argv) { bool report_stopped = true; struct utsname uname_buf; char *end; /* Ensure time_now is set. We then don't have to check anywhere * else if it is set. */ set_time_now(); /* Save command line options in case need to log them later */ save_cmd_line_options(argc, argv); ...
cwe
CWE-200
C/C++
static ssize_t drop_sync(QIOChannel *ioc, size_t size) { ssize_t ret = 0; char small[1024]; char *buffer; buffer = sizeof(small) < size ? small : g_malloc(MIN(65536, size)); while (size > 0) { ssize_t count = read_sync(ioc, buffer, MIN(65536, size)); if (count <= 0) { g...
cwe
CWE-119
C/C++
'use strict'; const { clone, cloneDeep } = require('./clone'); const SMALL_ARRAY_SIZE = 10; function isEmpty(item) { if (Array.isArray(item) || Buffer.isBuffer(item)) { return item.length === 0; } else if (isObject(item)) { return Object.keys(item).length === 0; } else { return true; } } function...
cwe
CWE-1321
JavaScript
public function testGetDropdownConnect($params, $expected, $session_params = []) { $this->login(); $bkp_params = []; //set session params if any if (count($session_params)) { foreach ($session_params as $param => $value) { if (isset($_SESSION[$param])) { $bkp...
cwe
CWE-862
PHP
int __close_fd_get_file(unsigned int fd, struct file **res) { struct files_struct *files = current->files; struct file *file; struct fdtable *fdt; spin_lock(&files->file_lock); fdt = files_fdtable(files); if (fd >= fdt->max_fds) goto out_unlock; file = fdt->fd[fd]; if (!file) goto out_unlock; rcu_assign_p...
cwe
CWE-416
C/C++
TPMI_DH_PERSISTENT_Unmarshal(TPMI_DH_PERSISTENT *target, BYTE **buffer, INT32 *size) { TPM_RC rc = TPM_RC_SUCCESS; if (rc == TPM_RC_SUCCESS) { rc = TPM_HANDLE_Unmarshal(target, buffer, size); } if (rc == TPM_RC_SUCCESS) { BOOL isNotPersistent = (*target < PERSISTENT_FIRST) || (*target > PERSISTENT_...
cwe
CWE-787
Unknown
def node_restart(params, request, session) if params[:name] code, response = send_request_with_token( session, params[:name], 'node_restart', true ) else if not allowed_for_local_cluster(session, Permissions::WRITE) return 403, 'Permission denied' end $logger.info "Restarting Node" ...
cwe
CWE-384
Ruby
int read_file(struct sc_card *card, char *str_path, unsigned char **data, size_t *data_len) { struct sc_path path; struct sc_file *file; unsigned char *p; int ok = 0; int r; size_t len; sc_format_path(str_path, &path); if (SC_SUCCESS != sc_select_file(card, &path, &file)) { goto err; } len = file ? file->...
cwe
CWE-415
Unknown
static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) { int r; struct kvm_vcpu *vcpu, *v; vcpu = kvm_arch_vcpu_create(kvm, id); if (IS_ERR(vcpu)) return PTR_ERR(vcpu); preempt_notifier_init(&vcpu->preempt_notifier, &kvm_preempt_ops); r = kvm_arch_vcpu_setup(vcpu); if (r) goto vcpu_destroy; ...
cwe
CWE-20
C/C++
package envoyconfig import ( "context" "encoding/base64" "fmt" "net" "net/url" "sort" "time" envoy_config_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" envoy_config_listener_v3 "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" envoy_config_route_v3 "github.com/envoypr...
cwe
CWE-200
Go
def node_status(params, request, session) if params[:node] and params[:node] != '' and params[:node] != $cur_node_name and !params[:redirected] return send_request_with_token( session, params[:node], 'status?redirected=1', false, params.select { |k,_| [:version, :operatio...
cwe
CWE-384
Ruby
void NaClProcessHost::OnPpapiChannelCreated( const IPC::ChannelHandle& channel_handle) { DCHECK(enable_ipc_proxy_); ReplyToRenderer(channel_handle); }
cwe
CWE-399
C/C++
phys_addr_t swiotlb_tbl_map_single(struct device *dev, phys_addr_t orig_addr, size_t mapping_size, size_t alloc_size, unsigned int alloc_align_mask, enum dma_data_direction dir, unsigned long attrs) { struct io_tlb_mem *mem = dev->dma_io_tlb_mem; unsigned int offset = swiotlb_align_offset(dev, orig_addr); unsi...
cwe
CWE-401
Unknown
PHP_XML_API zend_string *xml_utf8_encode(const char *s, size_t len, const XML_Char *encoding) { size_t pos = len; zend_string *str; unsigned int c; unsigned short (*encoder)(unsigned char) = NULL; xml_encoding *enc = xml_get_encoding(encoding); if (enc) { encoder = enc->encoding_function; } else { /* If the...
cwe
CWE-190
C/C++
static Image *XMagickCommand(Display *display,XResourceInfo *resource_info, XWindows *windows,const CommandType command_type,Image **image, MagickStatusType *state,ExceptionInfo *exception) { Image *nexus; MagickBooleanType proceed; MagickStatusType status; XTextProperty window_name; /...
cwe
CWE-772
Unknown
/* This work is licensed under a Creative Commons CCZero 1.0 Universal License. * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. * * Copyright 2017 (c) Fraunhofer IOSB (Author: Julius Pfrommer) * Copyright 2017 (c) Julian Grothoff * Copyright 2017-2018 (c) Mark Giraud, Fraunho...
cwe
CWE-770
C/C++
""" LTI Consumer related Signal handlers """ import logging from django.db.models.signals import post_save from django.dispatch import receiver, Signal from lti_consumer.models import LtiAgsScore from lti_consumer.plugin import compat log = logging.getLogger(__name__) @receiver(post_save, sender=LtiAgsScore, disp...
cwe
CWE-862
Python
static inline void switch_to_bitmap(unsigned long tifp) { /* * Invalidate I/O bitmap if the previous task used it. This prevents * any possible leakage of an active I/O bitmap. * * If the next task has an I/O bitmap it will handle it on exit to * user mode. */ if (tifp & _TIF_IO_BITMAP) tss_invalidate_i...
cwe
CWE-276
Unknown
def isValidAdmToken(adm_token): conn, c = connectDB() req = "SELECT * from {} where adm_token='{}'".format(CFG("admintoken_table_name"), adm_token) answer = bool(queryOne(c, req)) closeDB(conn) return answer
cwe
CWE-89
Python
// SPDX-License-Identifier: GPL-2.0-or-later /* * SPI master driver using generic bitbanged GPIO * * Copyright (C) 2006,2008 David Brownell * Copyright (C) 2017 Linus Walleij */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/gpio/consumer.h> #include <linux/o...
cwe
CWE-400
C/C++
void snd_usb_mixer_disconnect(struct usb_mixer_interface *mixer) { usb_kill_urb(mixer->urb); usb_kill_urb(mixer->rc_urb); }
cwe
CWE-416
Unknown
/* * Copyright (c) 2004-2021, University of Oslo * 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 copyright notice, this * list of cond...
cwe
CWE-89
Java
static int nsv_parse_NSVf_header(AVFormatContext *s) { NSVContext *nsv = s->priv_data; AVIOContext *pb = s->pb; unsigned int av_unused file_size; unsigned int size; int64_t duration; int strings_size; int table_entries; int table_entries_used; nsv->state = NSV_UNSYNC; /* in case we ...
cwe
CWE-834
Unknown
// SPDX-License-Identifier: GPL-3.0-or-later #include "../libnetdata.h" // ---------------------------------------------------------------------------- // URL encode / decode // code from: http://www.geekhideout.com/urlcode.shtml /* Converts a hex character to its integer value */ char from_hex(char ch) { return...
cwe
CWE-74
C/C++
this.idx.search(query, function(success, content) { if (!success) { console.log(content); return; } if (originalQuery == $('#inputfield input').val().trim()) { if (content.nbHits == 0) { self.$noresults.html('<p>No results matching your query:<code>' + o...
cwe
CWE-79
JavaScript
SplashError Splash::fillImageMask(SplashImageMaskSource src, void *srcData, int w, int h, SplashCoord *mat, GBool glyphMode) { SplashPipe pipe; GBool rot; SplashCoord xScale, yScale, xShear, yShear, yShear1; int tx, tx2, ty, ty2, scaledWidth, scaledHeight, xSign, ySign; int ulx, uly, llx, lly, urx...
cwe
CWE-189
C/C++
function restart($sMessage = '') { $_COOKIE['sessionID'] = phpAds_SessionStart(); OA_Auth::displayLogin($sMessage, $_COOKIE['sessionID']); }
cwe
CWE-384
PHP
static ssize_t firmware_loading_show(struct device *dev, struct device_attribute *attr, char *buf) { struct fw_sysfs *fw_sysfs = to_fw_sysfs(dev); int loading = 0; mutex_lock(&fw_lock); if (fw_sysfs->fw_priv) loading = fw_sysfs_loading(fw_sysfs->fw_priv); mutex_unlock(&fw_lock); return sprintf(buf, "...
cwe
CWE-787
Unknown
void svc_rdma_send_error(struct svcxprt_rdma *xprt, struct rpcrdma_msg *rmsgp, int status) { struct ib_send_wr err_wr; struct page *p; struct svc_rdma_op_ctxt *ctxt; enum rpcrdma_errcode err; __be32 *va; int length; int ret; ret = svc_rdma_repost_recv(xprt, GFP_KERNEL); if (ret) return; p = alloc_page(G...
cwe
CWE-404
C/C++
import discourseComputed, { on } from "discourse-common/utils/decorators"; import { NotificationLevels } from "discourse/lib/notification-levels"; import PermissionType from "discourse/models/permission-type"; import RestModel from "discourse/models/rest"; import Site from "discourse/models/site"; import User from "dis...
cwe
CWE-200
JavaScript
HandleUltraBPP (rfbClient* client, int rx, int ry, int rw, int rh) { rfbZlibHeader hdr; int toRead=0; int inflateResult=0; lzo_uint uncompressedBytes = (( rw * rh ) * ( BPP / 8 )); if (!ReadFromRFBServer(client, (char *)&hdr, sz_rfbZlibHeader)) return FALSE; toRead = rfbClientSwap32IfLE(hdr.nBytes); ...
cwe
CWE-476
Unknown
die(SIGNAL_ARGS) { int save_errno = errno; /* Don't joggle the elbow of proc_exit */ if (!proc_exit_inprogress) { InterruptPending = true; ProcDiePending = true; /* * If it's safe to interrupt, and we're waiting for input or a lock, * service the interrupt immediately */ if (ImmediateInterruptO...
cwe
CWE-89
Unknown
/* * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at * http://www.eclipse.org/legal/epl-2.0. * * This Source Code may also be made available...
cwe
CWE-22
Java
VaapiVideoDecodeAccelerator::VaapiH264Accelerator::CreateH264Picture() { scoped_refptr<VaapiDecodeSurface> va_surface = vaapi_dec_->CreateSurface(); if (!va_surface) return nullptr; return new VaapiH264Picture(std::move(va_surface)); }
cwe
CWE-362
C/C++
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Config Utils. """ import yaml from collections import namedtuple WorldConfig = namedtuple( "WorldConfig", [...
cwe
CWE-502
Python
static int local_link(FsContext *ctx, V9fsPath *oldpath, V9fsPath *dirpath, const char *name) { char *odirpath = g_path_get_dirname(oldpath->data); char *oname = g_path_get_basename(oldpath->data); int ret = -1; int odirfd, ndirfd; odirfd = local_opendir_nofollow(ctx, odirpath...
cwe
CWE-732
Unknown
static unsigned int sfq_hash(const struct sfq_sched_data *q, const struct sk_buff *skb) { return skb_get_hash_perturb(skb, q->perturbation) & (q->divisor - 1); }
cwe
CWE-330
Unknown
static int reencrypt_init(struct crypt_device *cd, const char *name, struct luks2_hdr *hdr, const char *passphrase, size_t passphrase_size, int keyslot_old, int keyslot_new, const char *cipher, const char *cipher_mode, const struct crypt_params_reencrypt *params, struct volume_key **vks) { bool mov...
cwe
CWE-345
Unknown
int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias, int alias_len, phar_archive_data** pphar, int is_data, php_uint32 compression, char **error TSRMLS_DC) /* {{{ */ { char buf[512], *actual_alias = NULL, *p; phar_entry_info entry = {0}; size_t pos = 0, read, totalsize; tar_header *hdr; ...
cwe
CWE-824
Unknown
get_principal_2_svc(gprinc_arg *arg, struct svc_req *rqstp) { static gprinc_ret ret; char *prime_arg, *funcname; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t han...
cwe
CWE-772
C/C++
// Copyright Istio 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 wri...
cwe
CWE-287
Go
int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle) { struct super_block *sb; int err; int rc; if (!ext4_handle_valid(handle)) { ext4_put_nojournal(handle); return 0; } if (!handle->h_transaction) { err = jbd2_journal_stop(handle); return handle->h_err ? handle->h_err : e...
cwe
CWE-416
C/C++
package model; import object.Region; import object.Variant; import util.DBManager; import java.sql.ResultSet; import java.util.ArrayList; /** * * @author Nick */ public class Output { public static ArrayList<Variant> variantList = new ArrayList<Variant>(); public static Variant variant; public static ...
cwe
CWE-89
JavaScript
int ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_TEMPLATE *tt) { ASN1_TLC c; asn1_tlc_clear_nc(&c); return asn1_template_ex_d2i(pval, in, len, tt, 0, &c); }
cwe
CWE-674
Unknown
static void Sp_match(js_State *J) { js_Regexp *re; const char *text; int len; const char *a, *b, *c, *e; Resub m; text = checkstring(J, 0); if (js_isregexp(J, 1)) js_copy(J, 1); else if (js_isundefined(J, 1)) js_newregexp(J, "", 0); else js_newregexp(J, js_tostring(J, 1), 0); re = js_toregexp(J, -1);...
cwe
CWE-674
C/C++
channel_x11_req(LIBSSH2_CHANNEL *channel, int single_connection, const char *auth_proto, const char *auth_cookie, int screen_number) { LIBSSH2_SESSION *session = channel->session; unsigned char *s; static const unsigned char reply_codes[3] = { SSH_MSG_CHANNEL_SUCCESS,...
cwe
CWE-787
Unknown
/************************************************************************ * Copyright (c) 2019, Gil Treibush * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * This program...
cwe
CWE-120
C/C++
read_header(struct archive_read *a, struct archive_entry *entry, char head_type) { const void *h; const char *p, *endp; struct rar *rar; struct rar_header rar_header; struct rar_file_header file_header; int64_t header_size; unsigned filename_size, end; char *filename; char *strp; char pa...
cwe
CWE-193
C/C++
static int jas_cmshapmatlut_invert(jas_cmshapmatlut_t *invlut, jas_cmshapmatlut_t *lut, int n) { int i; int j; int k; jas_cmreal_t ax; jas_cmreal_t ay; jas_cmreal_t bx; jas_cmreal_t by; jas_cmreal_t sx; jas_cmreal_t sy; assert(n >= 2); if (invlut->data) { jas_free(invlut->data); invlut->data = 0; } /...
cwe
CWE-189
Unknown
/* * Copyright © 2015-2018 Aeneas Rekkas <aeneas+oss@aeneas.io> * * 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...
cwe
CWE-754
Go
status_t CameraService::dump(int fd, const Vector<String16>& args) { String8 result; if (checkCallingPermission(String16("android.permission.DUMP")) == false) { result.appendFormat("Permission Denial: " "can't dump CameraService from pid=%d, uid=%d\n", getCallingPid(), getCall...
cwe
CWE-264
C/C++
function configure(config, layouts) { let layout = layouts.basicLayout; if (config.layout) { layout = layouts.layout(config.layout.type, config.layout); } return fileAppender( config.filename, layout, config.maxLogSize, config.backups, config, config.timezoneOffset ); }
cwe
CWE-276
JavaScript
bool ContentSettingsObserver::AllowScript(bool enabled_per_settings) { if (!enabled_per_settings) return false; if (IsScriptDisabledForPreview(render_frame())) return false; if (is_interstitial_page_) return true; blink::WebLocalFrame* frame = render_frame()->GetWebFrame(); const auto it = cached...
cwe
CWE-20
C/C++
static void dbEvalSetColumn(DbEvalContext *p, int iCol, Jsi_DString *dStr) { Jsi_Interp *interp = p->jdb->interp; char nbuf[200]; sqlite3_stmt *pStmt = p->pPreStmt->pStmt; switch( sqlite3_column_type(pStmt, iCol) ) { case SQLITE_BLOB: { int bytes = sqlite3_column_bytes(pStmt, iCol); ...
cwe
CWE-120
C/C++
/* # probe.c: Code for probing protocols # # Copyright (C) 2007-2021 Yves Rutschle # # 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 of the License, or (at your option) any ...
cwe
CWE-134
C/C++
# coding=utf-8 # Author: Nic Wolfe <nic@wolfeden.ca> # URL: https://sickrage.github.io # # This file is part of SickRage. # # SickRage 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 Li...
cwe
CWE-522
Python
bool RenderFrameDevToolsAgentHost::AttachSession(DevToolsSession* session) { if (session->restricted() && !IsFrameHostAllowedForRestrictedSessions()) return false; session->SetRenderer(frame_host_ ? frame_host_->GetProcess()->GetID() : ChildProcessHost::kInvalidUniqueID, ...
cwe
CWE-20
C/C++
/* $Id: tif_ojpeg.c,v 1.24.2.6 2010-06-08 23:29:51 bfriesen Exp $ */ /* WARNING: The type of JPEG encapsulation defined by the TIFF Version 6.0 specification is now totally obsolete and deprecated for new applications and images. This file was was created solely in order to read unconverted images still prese...
cwe
CWE-787
C/C++
public function print_section_subnets_table($User, $sectionId, $showSupernetOnly = false) { $html = array(); # set custom fields $Tools = new Tools ($this->Database); $custom = $Tools->fetch_custom_fields ("subnets"); # set hidden fields $hidden_fields = json_decode($User->settings->hiddenCustomFields, tr...
cwe
CWE-79
PHP
this.sidebar.showEntries("search")):(this.sidebar.showPalette("search",mxSettings.settings.search),this.editor.chromeless&&!this.editor.editable||!(mxSettings.settings.isNew||8>=parseInt(mxSettings.settings.version||0))||(this.toggleScratchpad(),mxSettings.save())));this.addListener("formatWidthChanged",function(){mxSe...
cwe
CWE-94
JavaScript
module.exports = function(path, opts, cb) { if (!cb) { cb = opts; opts = {}; } var cmd = module.exports.cmd(path, opts); opts.timeout = opts.timeout || 5000; exec(cmd, opts, function(e, stdout, stderr) { if (e) { return cb(e); } if (stderr) { return cb(new Error(stderr)); } return cb(nu...
cwe
CWE-78
JavaScript
package com.salesmanager.core.business.services.catalog.product.attribute; import java.util.List; import javax.inject.Inject; import org.springframework.stereotype.Service; import com.salesmanager.core.business.exception.ServiceException; import com.salesmanager.core.business.repositories.catalog.product.attribute....
cwe
CWE-79
Java
private function _addlasteditor( $option ) { //Addlasteditor can not be used with addauthor. if ( !isset( $this->parametersProcessed['addauthor'] ) || !$this->parametersProcessed['addauthor'] ) { $this->addTable( 'revision_actor_temp', 'rev' ); $this->addWhere( [ $this->tableNames['page'] . '.page_id...
cwe
CWE-400
PHP
ExecConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, EState *estate) { Relation rel = resultRelInfo->ri_RelationDesc; TupleDesc tupdesc = RelationGetDescr(rel); TupleConstr *constr = tupdesc->constr; Assert(constr); if (constr->has_not_null) { int natts = tupdesc->natts; int attrChk; ...
cwe
CWE-209
Unknown
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
cwe
CWE-908
Python
/* . .o8 oooo .o8 "888 `888 .o888oo oooo d8b oooo oooo .oooo888 .ooooo. .oooo.o 888 oooo 888 `888""8P `888 `888 d88' `888 d88' `88b d88( "8 888 .8P' 888 888 888 888 888 888 888o...
cwe
CWE-434
JavaScript
bool PlatformSensorProviderBase::CreateSharedBufferIfNeeded() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (shared_buffer_handle_.is_valid()) return true; shared_buffer_handle_ = mojo::SharedBufferHandle::Create(kSharedBufferSizeInBytes); return shared_buffer_handle_.is_valid(); }
cwe
CWE-732
C/C++
/** * Copyright (c) 2008, SnakeYAML * * 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...
cwe
CWE-400
Java
func Handler(configFns ...func(*Config)) http.HandlerFunc { var once sync.Once config := &Config{ URL: "doc.json", DeepLinking: true, DocExpansion: "list", DomID: "#swagger-ui", } for _, configFn := range configFns { configFn(config) } // create a template with name t := template.New...
cwe
CWE-755
Go
// 话题(帖子)相关js功能 (function(){ emojify.setConfig({ // emojify_tag_type : 'span', only_crawl_id : null, img_dir : SG.EMOJI_DOMAIN, ignored_tags : { //忽略以下几种标签内的emoji识别 'SCRIPT' : 1, 'TEXTAREA': 1, 'A' : 1, 'PRE' : 1, 'CODE' : 1 } }); SG.Topics = function(){} SG....
cwe
CWE-74
Go
extract_header_length(uint16_t fc) { int len = 0; switch ((fc >> 10) & 0x3) { case 0x00: if (fc & (1 << 6)) /* intra-PAN with none dest addr */ return -1; break; case 0x01: return -1; case 0x02: len += 4; break; case 0x03: len += 10; break; } switch ((fc >> 14) & 0x3) { case 0x00: break; ca...
cwe
CWE-125
C/C++
sign (gcry_mpi_t r, gcry_mpi_t s, gcry_mpi_t input, DSA_secret_key *skey, int flags, int hashalgo) { gpg_err_code_t rc; gcry_mpi_t hash; gcry_mpi_t k; gcry_mpi_t kinv; gcry_mpi_t tmp; const void *abuf; unsigned int abits, qbits; int extraloops = 0; qbits = mpi_get_nbits (skey->q); /* Convert...
cwe
CWE-203
Unknown
E);null!=T&&J.setAttribute("backgroundImage",JSON.stringify(T));J.setAttribute("math",this.graph.mathEnabled?"1":"0");J.setAttribute("shadow",this.graph.shadowVisible?"1":"0");null!=this.graph.extFonts&&0<this.graph.extFonts.length&&(T=this.graph.extFonts.map(function(N){return N.name+"^"+N.url}),J.setAttribute("extFon...
cwe
CWE-20
JavaScript
QuicErrorCode QuicStreamSequencerBuffer::OnStreamData( QuicStreamOffset starting_offset, QuicStringPiece data, QuicTime timestamp, size_t* const bytes_buffered, std::string* error_details) { CHECK_EQ(destruction_indicator_, 123456) << "This object has been destructed"; *bytes_buffered = 0; Qui...
cwe
CWE-787
C/C++
i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data, struct drm_file *file) { struct drm_i915_gem_execbuffer2 *args = data; struct drm_i915_gem_exec_object2 *exec2_list; struct drm_syncobj **fences = NULL; const size_t count = args->buffer_count; int err; if (!check_buffer_count(count)) { DRM_D...
cwe
CWE-20
Unknown
export function suspendUser(userId: UserId, numDays: number, reason: string, success: () => void) {
cwe
CWE-613
Scala
static int decompTest(char *fileName) { FILE *file = NULL; tjhandle handle = NULL; unsigned char **jpegBuf = NULL, *srcBuf = NULL; unsigned long *jpegSize = NULL, srcSize, totalJpegSize; tjtransform *t = NULL; double start, elapsed; int ps = tjPixelSize[pf], tile, row, col, i, iter, retval = 0, decompsrc ...
cwe
CWE-787
Unknown
import vyper.utils as util from vyper.address_space import MEMORY from vyper.codegen.abi_encoder import abi_encode from vyper.codegen.core import ( calculate_type_for_external_return, check_assign, check_external_call, dummy_node_for_type, get_element_ptr, ) from vyper.codegen.ir_node import Encodin...
cwe
CWE-120
Python
TfLiteStatus PreluPrepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input = GetInput(context, node, 0); TfLiteTensor* output = GetOutput(context, node, 0); const TfLiteTensor* alpha = GetInpu...
cwe
CWE-125
C/C++
bool DecodeResourceHandleList(std::unique_ptr<port::StringListDecoder> d, ResourceHandle* ps, int64_t n) { std::vector<uint32> sizes(n); if (!d->ReadSizes(&sizes)) return false; ResourceHandleProto proto; for (int i = 0; i < n; ++i) { if (!proto.ParseFromArray(d->Data(sizes[i]...
cwe
CWE-617
C/C++
def update_headers(self, request_headers: HTTPHeadersDict): """ Update the session headers with the request ones while ignoring certain name prefixes. """ headers = self.headers for name, value in request_headers.copy().items(): if value is None: ...
cwe
CWE-200
Python
int mongo_env_write_socket( mongo *conn, const void *buf, int len ) { const char *cbuf = buf; int flags = 0; while ( len ) { int sent = send( conn->sock, cbuf, len, flags ); if ( sent == -1 ) { __mongo_set_error( conn, MONGO_IO_ERROR, NULL, WSAGetLastError() ); conn-...
cwe
CWE-190
C/C++
XOpenDevice( register Display *dpy, register XID id) { register long rlen; /* raw length */ xOpenDeviceReq *req; xOpenDeviceReply rep; XDevice *dev; XExtDisplayInfo *info = XInput_find_display(dpy); LockDisplay(dpy); if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1) ...
cwe
CWE-284
C/C++
long Cluster::CreateBlock(long long id, long long pos, // absolute pos of payload long long size, long long discard_padding) { assert((id == 0x20) || (id == 0x23)); // BlockGroup or SimpleBlock if (m_entries_count < 0) { // haven't parsed anything yet assert(m_entries == NULL); assert(m_entries_size == ...
cwe
CWE-20
C/C++
static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, enum hrtimer_mode mode) { struct hrtimer_cpu_base *cpu_base; int base; memset(timer, 0, sizeof(struct hrtimer)); cpu_base = raw_cpu_ptr(&hrtimer_bases); if (clock_id == CLOCK_REALTIME && mode != HRTIMER_MODE_ABS) clock_id = CLOCK_MONO...
cwe
CWE-200
Unknown
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /* Copyright (C) 2017-2018 Netronome Systems, Inc. */ #include <linux/etherdevice.h> #include <linux/lockdep.h> #include <linux/pci.h> #include <linux/skbuff.h> #include <linux/vmalloc.h> #include <net/devlink.h> #include <net/dst_metadata.h> #include "main.h...
cwe
CWE-400
C/C++
def rename(self, ref, to_name): """Rename a local file or folder Return the actualized info object. """ new_name = safe_filename(to_name) source_os_path = self._abspath(ref) parent = ref.rsplit(u'/', 1)[0] old_name = ref.rsplit(u'/', 1)[1] parent = u'/' ...
cwe
CWE-377
Python
/* **** GENERATED CODE **** This code has been generated by resources/buildConfigDefinitions.js Do not edit manually, but update Options/index.js */ var parsers = require('./parsers'); module.exports.ParseServerOptions = { accountLockout: { env: 'PARSE_SERVER_ACCOUNT_LOCKOUT', help: 'account lockout policy f...
cwe
CWE-1321
JavaScript
fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env) { int r, num; OnigCodePoint c; OnigEncoding enc = env->enc; const OnigSyntaxType* syn = env->syntax; UChar* prev; UChar* p = *src; PFETCH_READY; start: if (PEND) { tok->type = TK_EOT; return tok->type; } tok->type = TK_ST...
cwe
CWE-476
C/C++
json_t *json_object(void) { json_object_t *object = jsonp_malloc(sizeof(json_object_t)); if(!object) return NULL; json_init(&object->json, JSON_OBJECT); if(hashtable_init(&object->hashtable)) { jsonp_free(object); return NULL; } object->serial = 0; object...
cwe
CWE-310
C/C++
TfLiteStatus Relu6Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, 0); TfLiteTensor* output = GetOutput(context, node, 0); ReluOpData* data = reinterpret_cast<ReluOpData*>(node->user_data); switch (input->type) { case kTfLiteFloat32: { size_t element...
cwe
CWE-125
C/C++
public function sendData($data) { // don't throw exceptions for 4xx errors $this->httpClient->getEventDispatcher()->addListener( 'request.error', function ($event) { if ($event['response']->isClientError()) { $event->stopPropagation(); ...
cwe
CWE-89
JavaScript
"""Tornado handlers for the sessions web service.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import json from tornado import web from ...base.handlers import IPythonHandler, json_errors from IPython.utils.jsonutil import date_default from IPython.html.uti...
cwe
CWE-79
Python
apprentice_load(struct magic_set *ms, const char *fn, int action) { int errs = 0; uint32_t i, j; size_t files = 0, maxfiles = 0; char **filearr = NULL; struct stat st; struct magic_map *map; struct magic_entry_set mset[MAGIC_SETS]; php_stream *dir; php_stream_dirent d; TSRMLS_FETCH(); memset(mset, 0, size...
cwe
CWE-17
C/C++
function validateBaseUrl(url: string) { // from this MIT-licensed gist: https://gist.github.com/dperini/729294 return /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-...
cwe
CWE-1333
JavaScript
function ui(t){var e=parseInt(t,10);if(e)return"$event.keyCode!=="+e;var i=Xo[t];return"_k($event.keyCode,"+JSON.stringify(t)+(i?","+JSON.stringify(i):"")+")"}
cwe
CWE-79
JavaScript
void DocumentLoader::responseReceived(CachedResource* resource, const ResourceResponse& response) { ASSERT_UNUSED(resource, m_mainResource == resource); RefPtr<DocumentLoader> protect(this); bool willLoadFallback = m_applicationCacheHost->maybeLoadFallbackForMainResponse(request(), response); bool shou...
cwe
CWE-399
C/C++
func (f MigrateRepo) ParseRemoteAddr(user *db.User) (string, error) { remoteAddr := strings.TrimSpace(f.CloneAddr) // Remote address can be HTTP/HTTPS/Git URL or local path. if strings.HasPrefix(remoteAddr, "http://") || strings.HasPrefix(remoteAddr, "https://") || strings.HasPrefix(remoteAddr, "git://") { u,...
cwe
CWE-918
Go
void ip4_datagram_release_cb(struct sock *sk) { const struct inet_sock *inet = inet_sk(sk); const struct ip_options_rcu *inet_opt; __be32 daddr = inet->inet_daddr; struct flowi4 fl4; struct rtable *rt; if (! __sk_dst_get(sk) || __sk_dst_check(sk, 0)) return; rcu_read_lock(); inet_opt = rcu_dereferen...
cwe
CWE-416
C/C++
OMX_ERRORTYPE SoftMPEG4Encoder::internalSetParameter( OMX_INDEXTYPE index, const OMX_PTR params) { int32_t indexFull = index; switch (indexFull) { case OMX_IndexParamVideoBitrate: { OMX_VIDEO_PARAM_BITRATETYPE *bitRate = (OMX_VIDEO_PARAM_BITRATETYPE *) params; ...
cwe
CWE-119
C/C++