code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
/* * Copyright 2015 Red Hat, Inc. and/or its affiliates. * * 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 a...
cwe
CWE-89
Java
/* * Unsquash a squashfs filesystem. This is a highly compressed read only * filesystem. * * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2019, 2021 * Phillip Lougher <phillip@squashfs.org.uk> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public...
cwe
CWE-59
C/C++
bool ParseAttrValue(StringPiece type, StringPiece text, AttrValue* out) { // Parse type. string field_name; bool is_list = absl::ConsumePrefix(&type, "list("); if (absl::ConsumePrefix(&type, "string")) { field_name = "s"; } else if (absl::ConsumePrefix(&type, "int")) { field_name = "i"; } else if (a...
cwe
CWE-674
C/C++
void shut(pid_t pid) { EUID_ASSERT(); EUID_ROOT(); char *comm = pid_proc_comm(pid); EUID_USER(); if (comm) { if (strcmp(comm, "firejail") != 0) { fprintf(stderr, "Error: this is not a firejail sandbox\n"); exit(1); } free(comm); } else { fprintf(stderr, "Error: cannot find process %d\n", pid); e...
cwe
CWE-269
Unknown
gst_flxdec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { GstCaps *caps; guint avail; GstFlowReturn res = GST_FLOW_OK; GstFlxDec *flxdec; FlxHeader *flxh; g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR); flxdec = (GstFlxDec *) parent; g_return_val_if_fail (flxdec != NULL, GST_FLOW_ERRO...
cwe
CWE-125
C/C++
httpPrintf(http_t *http, /* I - HTTP connection */ const char *format, /* I - printf-style format string */ ...) /* I - Additional args as needed */ { ssize_t bytes; /* Number of bytes to write */ char buf[16384]; /* Buffer for formatted string */ va_list ap; /* Variable argument poi...
cwe
CWE-120
Unknown
/* * Copyright (c) by Jaroslav Kysela <perex@perex.cz> * Copyright (c) 2009 by Krzysztof Helt * Routines for control of MPU-401 in UART mode * * MPU-401 supports UART mode which is not capable generate transmit * interrupts thus output is done via polling. Also, if irq < 0, then * input is done also via po...
cwe
CWE-125
C/C++
static ssize_t WritePSDChannels(const PSDInfo *psd_info, const ImageInfo *image_info,Image *image,Image *next_image, MagickOffsetType size_offset,const MagickBooleanType separate) { Image *mask; MagickOffsetType rows_offset; size_t channels, count, length, offset_length; unsigned ...
cwe
CWE-787
C/C++
TEST_F(OAuth2Test, OAuthBearerTokenFlowFromQueryParameters) { Http::TestRequestHeaderMapImpl request_headers_before{ {Http::Headers::get().Path.get(), "/test?role=bearer&token=xyz-queryparam-token"}, {Http::Headers::get().Host.get(), "traffic.example.com"}, {Http::Headers::get().Method.get(), Http::...
cwe
CWE-416
Unknown
amgtar_selfcheck( application_argument_t *argument) { char *option; if (argument->dle.disk) { char *qdisk = quote_string(argument->dle.disk); fprintf(stdout, "OK disk %s\n", qdisk); amfree(qdisk); } printf("OK amgtar version %s\n", VERSION); amgtar_build_exinclude(&argument->dle, 1, NULL, N...
cwe
CWE-264
Unknown
static int sd_isoc_init(struct gspca_dev *gspca_dev) { struct usb_host_interface *alt; int max_packet_size; switch (gspca_dev->pixfmt.width) { case 160: max_packet_size = 450; break; case 176: max_packet_size = 600; break; default: max_packet_size = 1022; break; } /* Start isoc bandwidth "negotiat...
cwe
CWE-476
Unknown
/* * Copyright (c) 2018-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ #include <fizz/record/RecordLayer.h> namespace fizz { using HandshakeTypeType = typename std::underly...
cwe
CWE-770
C/C++
public function delete($id) { $ret = $this->get($id); if (!$ret) { /* get() already logged */ return self::ID_NOT_EXITS; } if ($this->isUsed($id)) { $this->errors[] = _T("Cannot delete this label: it's still used"); return false; ...
cwe
CWE-89
PHP
package io.swagger.codegen.languages; import java.io.File; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.Map; import java.util.regex.Pattern; import io.swagger.codegen.languages.features.No...
cwe
CWE-200
Java
Status ValidateShapes(OpKernelContext* ctx, const Tensor& hypothesis_indices, const Tensor& hypothesis_values, const Tensor& hypothesis_shape, const Tensor& truth_indices, const Tensor& truth_values, const Tensor& truth_shape) { i...
cwe
CWE-369
Unknown
it 'does not include user or group archived messages' do UserArchivedMessage.archive!(user.id, group_message) UserArchivedMessage.archive!(user.id, private_message) topics = TopicQuery.new(nil).list_private_messages_all(user).topics expect(topics).to eq([]) GroupArchivedMessage.archive!...
cwe
CWE-863
Ruby
xsltChoose(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr inst, xsltStylePreCompPtr comp ATTRIBUTE_UNUSED) { xmlNodePtr cur; if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL)) return; /* * TODO: Content model checks should be done only at compilation * time. ...
cwe
CWE-119
C/C++
void virtio_config_writeb(VirtIODevice *vdev, uint32_t addr, uint32_t data) { VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); uint8_t val = data; if (addr > (vdev->config_len - sizeof(val))) return; stb_p(vdev->config + addr, val); if (k->set_config) { k->set_config(vdev, vd...
cwe
CWE-269
C/C++
def read_plist(pathname) transformed_pathname = pathname.gsub!(%r{[^0-9A-Za-z. \-'/]}, '') transformed_pathname = pathname if transformed_pathname.nil? JSON.parse(`plutil -convert json -o - '#{transformed_pathname}'`) end
cwe
CWE-78
Ruby
void Compute(OpKernelContext* context) override { const Tensor& indices = context->input(0); const Tensor& values = context->input(1); const Tensor& shape = context->input(2); const Tensor& weights = context->input(3); bool use_weights = weights.NumElements() > 0; OP_REQUIRES(context, TensorSha...
cwe
CWE-125
C/C++
PHP_METHOD(Phar, createDefaultStub) { char *index = NULL, *webindex = NULL, *error; zend_string *stub; size_t index_len = 0, webindex_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "|ss", &index, &index_len, &webindex, &webindex_len) == FAILURE) { return; } stub = phar_create_default_stub(index, webindex...
cwe
CWE-20
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...
cwe
CWE-862
Java
asn1_get_bit_der (const unsigned char *der, int der_len, int *ret_len, unsigned char *str, int str_size, int *bit_len) { int len_len, len_byte; if (der_len <= 0) return ASN1_GENERIC_ERROR; len_byte = asn1_get_length_der (der, der_len, &len_len) - 1; if (len_byte < 0) return ASN1_DER_ERROR...
cwe
CWE-131
C/C++
ssize_t __weak cpu_show_spectre_v1(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf, "Not affected\n"); }
cwe
CWE-787
Unknown
extern "C" void *malloc_wrapper(struct _reent *r, size_t size, void *caller) { void *ptr = NULL; #if MBED_MEM_TRACING_ENABLED mbed_mem_trace_lock(); #endif #if MBED_HEAP_STATS_ENABLED malloc_stats_mutex->lock(); alloc_info_t *alloc_info = (alloc_info_t *)__real__malloc_r(r, size + sizeof(alloc_info_t));...
cwe
CWE-190
Unknown
public static function login() { user::login(expString::sanitize($_POST['username']),expString::sanitize($_POST['password'])); if (!isset($_SESSION[SYS_SESSION_KEY]['user'])) { // didn't successfully log in flash('error', gt('Invalid Username / Password')); if (expSession::is_set('redirecturl_error')) { ...
cwe
CWE-89
PHP
v8::Local<v8::Object> V8SchemaRegistry::GetSchema(const std::string& api) { if (schema_cache_ != NULL) { v8::Local<v8::Object> cached_schema = schema_cache_->Get(api); if (!cached_schema.IsEmpty()) { return cached_schema; } } v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::EscapableHan...
cwe
CWE-200
C/C++
function update() { for (const line of regexField.value.split('\n')) { // Don't allow delimiters in RegExp string if (delimiters.test(line)) { return setValidity(`Use <code>${line.replace(/^\/|\/$/g, '')}</code> instead of <code>${line}</code>. Slashes are not required.`); } // Fully test each RegExp try...
cwe
CWE-79
JavaScript
""" Systemd service utilities. Contains functions to start, stop & poll systemd services. Probably not very useful outside this spawner. """ import asyncio import shlex async def start_transient_service( unit_name, cmd, args, working_dir, environment_variables=None, properties=None, uid=N...
cwe
CWE-668
Python
static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) { BN_CTX *ctx = NULL; BIGNUM *k = NULL, *r = NULL, *order = NULL, *X = NULL; EC_POINT *tmp_point=NULL; const EC_GROUP *group; int ret = 0; if (eckey == NULL || (group = EC_KEY_get0_group(eckey)) == NULL) { ECDSAerr(...
cwe
CWE-320
Unknown
static inline bool is_flush_request(struct request *rq, struct blk_flush_queue *fq, unsigned int tag) { return ((rq->cmd_flags & REQ_FLUSH_SEQ) && fq->flush_rq->tag == tag); }
cwe
CWE-362
C/C++
static void network_init_gcrypt (void) /* {{{ */ { /* http://lists.gnupg.org/pipermail/gcrypt-devel/2003-August/000458.html * Because you can't know in a library whether another library has * already initialized the library */ if (gcry_control (GCRYCTL_ANY_INITIALIZATION_P)) return; /* http://www.gnupg....
cwe
CWE-119
Unknown
/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2016 The PHP Group | +---------...
cwe
CWE-79
C/C++
public static SecretKey decryptCEK(final SecretKey kek, final byte[] iv, final AuthenticatedCipherText authEncrCEK, final int keyLength, final Provider provider) throws JOSEException { byte[] keyBytes = AESGCM.decrypt(kek, iv, authEncrCEK.getCipherText(), new byte[0], authEncrCEK.ge...
cwe
CWE-345
Java
gostdsa_vko (const struct ecc_scalar *priv, const struct ecc_point *pub, size_t ukm_length, const uint8_t *ukm, uint8_t *out) { const struct ecc_curve *ecc = priv->ecc; unsigned bsize = (ecc_bit_size (ecc) + 7) / 8; mp_size_t size = ecc->p.size; mp_size_t itch = 4*size + ecc->mul_itch; mp_limb_t *scratc...
cwe
CWE-787
Unknown
static struct kvm_vcpu_hv_synic *synic_get(struct kvm *kvm, u32 vpidx) { struct kvm_vcpu *vcpu; struct kvm_vcpu_hv_synic *synic; vcpu = get_vcpu_by_vpidx(kvm, vpidx); if (!vcpu) return NULL; synic = to_hv_synic(vcpu); return (synic->active) ? synic : NULL; }
cwe
CWE-476
C/C++
func writeErrorResponse(rw *http.ResponseWriter, status int, body string) { (*rw).WriteHeader(status) (*rw).Write([]byte(body)) }
cwe
CWE-79
Go
HandleRFBServerMessage(rfbClient* client) { rfbServerToClientMsg msg; if (client->serverPort==-1) client->vncRec->readTimestamp = TRUE; if (!ReadFromRFBServer(client, (char *)&msg, 1)) return FALSE; switch (msg.type) { case rfbSetColourMapEntries: { /* TODO: int i; uint16_t rgb[3]; ...
cwe
CWE-770
Unknown
std::string utf16ToUtf8(const StringPiece16& utf16) { ssize_t utf8Length = utf16_to_utf8_length(utf16.data(), utf16.length()); if (utf8Length <= 0) { return {}; } std::string utf8; utf8.resize(utf8Length); utf16_to_utf8(utf16.data(), utf16.length(), &*utf8.begin()); return utf8; }
cwe
CWE-264
C/C++
externalParEntProcessor(XML_Parser parser, const char *s, const char *end, const char **nextPtr) { const char *next = s; int tok; tok = XmlPrologTok(parser->m_encoding, s, end, &next); if (tok <= 0) { if (! parser->m_parsingStatus.finalBuffer && tok != XML_TOK_INVALID) { *next...
cwe
CWE-125
C/C++
std::string HttpConnection::eraseConfidentialInfo(const std::string& request) { std::istringstream istr(request); std::string result; std::string line; while (getline(istr, line)) { if (util::startsWith(line, "Authorization: Basic")) { result += "Authorization: Basic ********\n"; } else if (ut...
cwe
CWE-532
Unknown
static int readOHDRHeaderMessageDataLayout(struct READER *reader, struct DATAOBJECT *data) { int i, err; unsigned size; uint8_t dimensionality, layout_class; uint32_t dataset_element_size; uint64_t data_address, store, data_size; UNUSED(dataset_element_size); ...
cwe
CWE-787
C/C++
void Cues::PreloadCuePoint(long& cue_points_size, long long pos) const { assert(m_count == 0); if (m_preload_count >= cue_points_size) { const long n = (cue_points_size <= 0) ? 2048 : 2 * cue_points_size; CuePoint** const qq = new CuePoint* [n]; CuePoint** q = qq; // beginning of target C...
cwe
CWE-20
C/C++
@auth.public def get(self, build_id): try: build_id = int(build_id) except ValueError as ex: self.response.write(ex.message) self.abort(400) build = model.Build.get_by_id(build_id) can_view = build and user.can_view_build_async(build).get_result() if not can_view: if auth...
cwe
CWE-79
Python
# This file is part of Radicale Server - Calendar Server # Copyright © 2008 Nicolas Kandel # Copyright © 2008 Pascal Halter # Copyright © 2008-2016 Guillaume Ayoub # # This library 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 S...
cwe
CWE-362
Python
MOBI_RET mobi_trie_insert_infl(MOBITrie **root, const MOBIIndx *indx, size_t i) { MOBIIndexEntry e = indx->entries[i]; char *inflected = e.label; for (size_t j = 0; j < e.tags_count; j++) { MOBIIndexTag t = e.tags[j]; if (t.tagid == INDX_TAGARR_INFL_PARTS_V1) { for (size_t k = 0;...
cwe
CWE-476
C/C++
// Code generated by MockGen. DO NOT EDIT. // Source: github.com/ory/fosite (interfaces: Requester) // Package internal is a generated GoMock package. package internal import ( url "net/url" reflect "reflect" time "time" gomock "github.com/golang/mock/gomock" fosite "github.com/ory/fosite" ) // MockRequester ...
cwe
CWE-287
Go
#include "Python.h" #include <stdbool.h> /* Defined in tracemalloc.c */ extern void _PyMem_DumpTraceback(int fd, const void *ptr); /* Python's malloc wrappers (see pymem.h) */ #undef uint #define uint unsigned int /* assuming >= 16 bits */ /* Forward declaration */ static void* _PyMem_DebugRawMalloc(void ...
cwe
CWE-125
Python
GLboolean WebGLRenderingContextBase::isRenderbuffer( WebGLRenderbuffer* renderbuffer) { if (!renderbuffer || isContextLost()) return 0; if (!renderbuffer->HasEverBeenBound()) return 0; if (renderbuffer->IsDeleted()) return 0; return ContextGL()->IsRenderbuffer(renderbuffer->Object()); }
cwe
CWE-787
C/C++
# cython: language_level=3str """A cleanup tool for HTML. Removes unwanted tags and content. See the `Cleaner` class for details. """ from __future__ import absolute_import import copy import re import sys try: from urlparse import urlsplit from urllib import unquote_plus except ImportError: # Python 3...
cwe
CWE-74
Python
static bool do_write_pids(pid_t tpid, const char *contrl, const char *cg, const char *file, const char *buf) { int sock[2] = {-1, -1}; pid_t qpid, cpid = -1; FILE *pids_file = NULL; bool answer = false, fail = false; pids_file = open_pids_file(contrl, cg); if (!pids_file) return false; /* * write the pi...
cwe
CWE-264
C/C++
protected function _validateSecretKey() { if (is_array($this->_publicActions) && in_array($this->getRequest()->getActionName(), $this->_publicActions)) { return true; } if (!($secretKey = $this->getRequest()->getParam(Mage_Adminhtml_Model_Url::SECRET_KEY_PARAM_NAME, null)) ...
cwe
CWE-203
PHP
# Copyright 2022 The HuggingFace Team. 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 applicabl...
cwe
CWE-377
Python
fmt_entry(TERMTYPE2 *tterm, PredFunc pred, int content_only, int suppress_untranslatable, int infodump, int numbers) { PredIdx i, j; char buffer[MAX_TERMINFO_LENGTH + EXTRA_CAP]; char *capability; NCURSES_CONST char *name; int predval, len; PredIdx num_bools = 0; PredIdx num_v...
cwe
CWE-125
C/C++
/** * Scans an object for all keys that are either objects or arrays * and returns an array of those keys only. * @param {Object|Array} obj The object to scan. * @returns {[string]} An array of string keys. * @private */ const _iterableKeys = (obj) => { return Object.entries(obj).reduce((arr, [key, val]) => { ...
cwe
CWE-1321
JavaScript
private boolean extract(ArrayList<String> errors, URL source, File target) { FileOutputStream os = null; InputStream is = null; boolean extracting = false; try { if (!target.exists() || isStale(source, target) ) { is = source.openStream(); if (...
cwe
CWE-94
Java
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % ...
cwe
CWE-772
C/C++
App.Actions.DB.update_db_databasename_hint = function(elm, hint) { if (hint.trim() == '') { $(elm).parent().find('.hint').html(''); } $(elm).parent().find('.hint').text(GLOBAL.DB_DBNAME_PREFIX + hint); }
cwe
CWE-79
JavaScript
}, function (statusCode, body) { if (statusCode !== 200) { // request a new login key first this._steamUser.requestWebAPIAuthenticateUserNonce(function (nonce) { this._webLoginKey = nonce.webapi_authenticate_user_nonce; this.webLogOn(callback); }.bind(this)); return; } ...
cwe
CWE-338
JavaScript
static UINT serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp) { DWORD DesiredAccess; DWORD SharedAccess; DWORD CreateDisposition; UINT32 PathLength; if (Stream_GetRemainingLength(irp->input) < 32) return ERROR_INVALID_DATA; Stream_Read_UINT32(irp->input, DesiredAccess); /* DesiredAccess (4 bytes)...
cwe
CWE-125
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...
cwe
CWE-732
Java
IndexedDBCursor::~IndexedDBCursor() { Close(); }
cwe
CWE-416
C/C++
int socket_create(uint16_t port) { int sfd = -1; int yes = 1; #ifdef WIN32 WSADATA wsa_data; if (!wsa_init) { if (WSAStartup(MAKEWORD(2,2), &wsa_data) != ERROR_SUCCESS) { fprintf(stderr, "WSAStartup failed!\n"); ExitProcess(-1); } wsa_init = 1; } #endif struct sockaddr_in saddr; if (0 > (sfd = socke...
cwe
CWE-284
C/C++
public function indexAction(Request $request) { $referer = $request->server->get('HTTP_REFERER', ''); // We need to display message about visited page only if the visitor // really change it. $new_page = empty($_SESSION[SESSION_PREFIX . 'last_visited_page']) || $_SESSION...
cwe
CWE-79
PHP
static int write_entry(struct mailbox *mailbox, unsigned int uid, const char *entry, const char *userid, const struct buf *value, int ignorequota, int silent, ...
cwe
CWE-732
C/C++
AccessibilityExpanded AXNodeObject::isExpanded() const { if (getNode() && isHTMLSummaryElement(*getNode())) { if (getNode()->parentNode() && isHTMLDetailsElement(getNode()->parentNode())) return toElement(getNode()->parentNode())->hasAttribute(openAttr) ? ExpandedExpanded ...
cwe
CWE-254
C/C++
function vdef_item_edit() { global $vdef_functions, $vdef_item_types, $custom_vdef_data_source_types; /* ================= input validation ================= */ get_filter_request_var('id'); get_filter_request_var('vdef_id'); get_filter_request_var('type_select'); /* =============================================...
cwe
CWE-79
PHP
package oci import ( "bytes" "io" "io/ioutil" "os" "path/filepath" "strconv" "strings" "sync" "syscall" "time" cgroups "github.com/containerd/cgroups/stats/v1" tasktypes "github.com/containerd/containerd/api/types/task" ctrio "github.com/containerd/containerd/cio" "github.com/containerd/containerd/names...
cwe
CWE-400
Go
"""Tornado handlers for the contents web service.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import json from tornado import gen, web from IPython.html.utils import url_path_join, url_escape from IPython.utils.jsonutil import date_default from IPython.ht...
cwe
CWE-79
Python
/** 12 * <a href="http://www.openolat.org"> * OpenOLAT - Online Learning and Training</a><br> * <p> * Licensed under the Apache License, Version 2.0 (the "License"); <br> * you may not use this file except in compliance with the License.<br> * You may obtain a copy of the License at the * <a href="http://www.apac...
cwe
CWE-91
Java
gdImagePtr gdImageCreateTrueColor (int sx, int sy) { int i; gdImagePtr im; if (overflow2(sx, sy)) { return NULL; } if (overflow2(sizeof(unsigned char *), sy)) { return NULL; } if (overflow2(sizeof(int) + sizeof(unsigned char), sx * sy)) { return NULL; } // Check for OOM before doing a ...
cwe
CWE-22
C/C++
static zend_always_inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend_long elements, int objprops) { while (elements-- > 0) { zval key, *data, d, *old_data; zend_ulong idx; ZVAL_UNDEF(&key); if (!php_var_unserialize_internal(&key, p, max, NULL, classes)) { zval_dtor(&key); return...
cwe
CWE-416
C/C++
smbhash(unsigned char *out, const unsigned char *in, unsigned char *key) { int rc; unsigned char key2[8]; struct crypto_skcipher *tfm_des; struct scatterlist sgin, sgout; struct skcipher_request *req; str_to_key(key, key2); tfm_des = crypto_alloc_skcipher("ecb(des)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm...
cwe
CWE-119
C/C++
function get_allowed_mime_types( $user = null ) { $t = wp_get_mime_types(); unset( $t['swf'], $t['exe'] ); if ( function_exists( 'current_user_can' ) ) $unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' ); if ( empty( $unfiltered ) ) unset( $t['htm|html'] ); /**...
cwe
CWE-79
PHP
am_cache_entry_t *am_get_request_session_by_nameid(request_rec *r, char *nameid) { return am_cache_lock(r->server, AM_CACHE_NAMEID, nameid); }
cwe
CWE-79
Unknown
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # 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 ...
cwe
CWE-613
Python
self._getForwarded = function(message) { try { var forwarded_message = $(message.getNode()).find('forwarded[xmlns="' + NS_URN_FORWARD + '"]:first message:first'); if(forwarded_message[0]) { return JSJaCPacket.wrapNode(forwarded_message[0]); } re...
cwe
CWE-346
JavaScript
/* * Copyright (c) 2017, Graz University of Technology * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, th...
cwe
CWE-125
C/C++
TEE_Result syscall_obj_generate_key(unsigned long obj, unsigned long key_size, const struct utee_attribute *usr_params, unsigned long param_count) { TEE_Result res; struct tee_ta_session *sess; const struct tee_cryp_obj_type_props *type_props; struct tee_obj *o; struct tee_cryp_obj_secret *key; size_t byte_...
cwe
CWE-190
C/C++
CreateCommentResponse saveComment() { CreateCommentRequest createCommentRequest = ZrLogUtil.convertRequestParam(getRequest().getParameterMap(), CreateCommentRequest.class); createCommentRequest.setIp(WebTools.getRealIp(getRequest())); createCommentRequest.setUserAgent(getHeader("User-Agent")); ...
cwe
CWE-79
Java
static int check_chain_extensions(X509_STORE_CTX *ctx) { int i, must_be_ca, plen = 0; X509 *x; int proxy_path_length = 0; int purpose; int allow_proxy_certs; int num = sk_X509_num(ctx->chain); /*- * must_be_ca can have 1 of 3 values: * -1: we accept both CA and non-CA certificate...
cwe
CWE-295
Unknown
void AcceptRoutingHandler<Pipeline, R>::onRoutingData( uint64_t connId, typename RoutingDataHandler<R>::RoutingData& routingData) { // Get the routing pipeline corresponding to this connection auto routingPipelineIter = routingPipelines_.find(connId); if (routingPipelineIter == routingPipelines_.end()) { ...
cwe
CWE-19
C/C++
void Compute(OpKernelContext* context) override { const Tensor& diagonal = context->input(0); // MatrixDiag and MatrixDiagV2 both use this OpKernel. MatrixDiag only has // one input, so we have to check the number of inputs before reading // additional parameters in MatrixDiagV2. int32 lower_diag_i...
cwe
CWE-476
C/C++
function wp_http_validate_url( $url ) { $original_url = $url; $url = wp_kses_bad_protocol( $url, array( 'http', 'https' ) ); if ( ! $url || strtolower( $url ) !== strtolower( $original_url ) ) { return false; } $parsed_url = @parse_url( $url ); if ( ! $parsed_url || empty( $parsed_url['host'] ) ) { ...
cwe
CWE-918
PHP
# -*- coding: utf-8 -*- import json from django.contrib.auth.decorators import login_required from django.shortcuts import render, redirect, get_object_or_404 from django.views.decorators.http import require_POST from django.http import Http404, HttpResponse from django.contrib import messages from django.utils.html ...
cwe
CWE-601
Python
read_gif(Gif_Reader *grr, int read_flags, const char* landmark, Gif_ReadErrorHandler handler) { Gif_Stream *gfs; Gif_Image *gfi; Gif_Context gfc; int unknown_block_type = 0; if (gifgetc(grr) != 'G' || gifgetc(grr) != 'I' || gifgetc(grr) != 'F') return 0; (void)gifgetc(grr); (void)gifget...
cwe
CWE-415
C/C++
static void v9fs_read(void *opaque) { int32_t fid; uint64_t off; ssize_t err = 0; int32_t count = 0; size_t offset = 7; uint32_t max_count; V9fsFidState *fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; err = pdu_unmarshal(pdu, offset, "dqd", &fid, &off, &max_count); if (...
cwe
CWE-772
Unknown
rndr_quote(struct buf *ob, const struct buf *text, void *opaque) { if (!text || !text->size) return 0; BUFPUTSL(ob, "<q>"); bufput(ob, text->data, text->size); BUFPUTSL(ob, "</q>"); return 1; }
cwe
CWE-74
C/C++
TPM_GENERATED_Unmarshal(TPM_GENERATED *target, BYTE **buffer, INT32 *size) { TPM_RC rc = TPM_RC_SUCCESS; if (rc == TPM_RC_SUCCESS) { rc = UINT32_Unmarshal(target, buffer, size); } if (rc == TPM_RC_SUCCESS) { if (*target != TPM_GENERATED_VALUE) { rc = TPM_RC_VALUE; } } return rc; }
cwe
CWE-787
Unknown
func (p *HTTPClient) RemainingBytes() (num_bytes uint64) { len := p.response.ContentLength if len >= 0 { return uint64(len) } return UnknownRemaining // the truth is, we just don't know unless framed is used }
cwe
CWE-770
Go
tChecksumCheckResult ParaNdis_CheckRxChecksum( PARANDIS_ADAPTER *pContext, ULONG virtioFlags, tCompletePhysicalAddress *pPacketPages, ULONG ulPa...
cwe
CWE-20
C/C++
import time from pydoc import locate from django.conf import settings DEFAULT_CONFIG = { 'config_version': 4, 'flag_prefix': 'ractf', 'graph_members': 10, 'register_end_time': -1, 'end_time': time.time() + 7 * 24 * 60 * 60, 'start_time': time.time(), 'register_start_time': time.time(), ...
cwe
CWE-200
Python
public static void usual() throws IOException { ZipFile zf = new ZipFile("demo.zip"); try { Enumeration en = zf.entries(); while (en.hasMoreElements()) { ZipEntry e = (ZipEntry) en.nextElement(); InputStream in = null; OutputStream out = null; try { in = z...
cwe
CWE-22
Java
print_attr_string(netdissect_options *ndo, register const u_char *data, u_int length, u_short attr_code) { register u_int i; ND_TCHECK2(data[0],length); switch(attr_code) { case TUNNEL_PASS: if (length < 3) { ND_PRINT((ndo, "%s", tstr)); ...
cwe
CWE-125
C/C++
package io.hawt.web.plugin.karaf.terminal; import io.hawt.system.Helpers; import org.apache.felix.service.command.CommandProcessor; import org.apache.felix.service.command.CommandSession; import org.apache.felix.service.threadio.ThreadIO; import org.apache.karaf.shell.console.jline.Console; import org.slf4j.Logger; im...
cwe
CWE-352
Java
// Copyright (C) Extensible Service Proxy 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 re...
cwe
CWE-290
C/C++
function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_setPrototypeOf(...
cwe
CWE-79
JavaScript
static Variant HHVM_FUNCTION(simplexml_import_dom, const Object& node, const String& class_name /* = "SimpleXMLElement" */) { auto domnode = Native::data<DOMNode>(node); xmlNodePtr nodep = domnode->nodep(); if (nodep) { if (nodep->doc == nullptr) { raise_warning("Imported Node must have associated ...
cwe
CWE-345
C/C++
accountsController.uploadImage = function (req, res) { const fs = require('fs') const path = require('path') const Busboy = require('busboy') const busboy = Busboy({ headers: req.headers, limits: { files: 1, fileSize: 1024 * 1024 * 3 // 3mb limit } }) const object = {} let error ...
cwe
CWE-434
JavaScript
/* * 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...
cwe
CWE-732
Java