code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
/* +----------------------------------------------------------------------+ | HipHop for PHP | +----------------------------------------------------------------------+ | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) | +---------...
cwe
CWE-200
C/C++
public function __construct($site) { // If the REST API Proxy Plugin isn't active, always use the current site. if(! PMB_REST_PROXY_EXISTS){ $site = ''; } $this->setSite($site); $this->getSiteInfo(); }
cwe
CWE-918
PHP
protected function driverRead(CacheItemInterface $item) { $this->driverConnect(); // return null if no caching // return value if in caching $keyword = self::PREFIX . $item->getKey(); $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ], true)) : ...
cwe
CWE-502
PHP
private String clean(String svg) { svg = svg.toLowerCase().replaceAll("\\s", ""); if (svg.contains("<script>")) return EMPTY_SVG; if (svg.contains("</script>")) return EMPTY_SVG; if (svg.contains("<foreignobject")) return EMPTY_SVG; if (svg.contains("</foreignobject>")) return EMPTY_SVG; return ...
cwe
CWE-79
Java
# -*- 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-306
Python
TPM_RC tpm_kdfa(TSS2_SYS_CONTEXT *sapi_context, TPMI_ALG_HASH hashAlg, TPM2B *key, char *label, TPM2B *contextU, TPM2B *contextV, UINT16 bits, TPM2B_MAX_BUFFER *resultKey ) { TPM2B_DIGEST tmpResult; TPM2B_DIGEST tpm2bLabel, tpm2bBits, tpm2b_i_2; UINT8 *tpm2bBitsPtr = &tpm2bBits.t.buffer[0];...
cwe
CWE-522
C/C++
yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; /* Number of token...
cwe
CWE-20
Unknown
static inline unsigned int ReadPropertyUnsignedLong(const EndianType endian, const unsigned char *buffer) { unsigned int value; if (endian == LSBEndian) { value=(unsigned int) ((buffer[3] << 24) | (buffer[2] << 16) | (buffer[1] << 8 ) | (buffer[0])); return((unsigned int) (value & 0xf...
cwe
CWE-190
Unknown
my_object_unstringify (MyObject *obj, const char *str, GValue *value, GError **error) { if (str[0] == '\0' || !g_ascii_isdigit (str[0])) { g_value_init (value, G_TYPE_STRING); g_value_set_string (value, str); } else { g_value_init (value, G_TYPE_INT); g_value_set_int (value, (int) g_ascii_strtoull (...
cwe
CWE-264
C/C++
//////////////////////////////////////////////////////////////////////////////// /// DISCLAIMER /// /// Copyright 2014-2021 ArangoDB GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// /// Licensed under the Apache License, Version 2.0 (the "License"); /// you may not use this file except...
cwe
CWE-613
C/C++
function add(text, sourcetype) { text = AjaxLife.Utils.LinkURLs(text); // Make a div to put this in. var line = Ext.get(document.createElement('div')); line.addClass("chatline"); // Give the line the appropriate class for the type of message it is. if(sourcetype == AjaxLife.Constants.MainAvatar.ChatSourceT...
cwe
CWE-79
JavaScript
/****************************************************** Copyright (c) 2011-2013 Percona LLC and/or its affiliates. Compressing datasink implementation for XtraBackup. 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 Soft...
cwe
CWE-404
C/C++
lquery_in(PG_FUNCTION_ARGS) { char *buf = (char *) PG_GETARG_POINTER(0); char *ptr; int num = 0, totallen = 0, numOR = 0; int state = LQPRS_WAITLEVEL; lquery *result; nodeitem *lptr = NULL; lquery_level *cur, *curqlevel, *tmpql; lquery_variant *lrptr = NULL; bool hasnot = fa...
cwe
CWE-189
C/C++
showDetailedConfig: function (grid, rowIndex) { var data = grid.getStore().getAt(rowIndex); var type = data.data.type; var definition = data.data.definition; if (definition) { definition = Ext.util.JSON.decode(definition); definition.name = data.data.name; ...
cwe
CWE-79
JavaScript
FindEmptyObjectSlot( TPMI_DH_OBJECT *handle // OUT: (optional) ) { UINT32 i; OBJECT *object; for(i = 0; i < MAX_LOADED_OBJECTS; i++) { object = &s_objects[i]; if(object->attributes.occupied == CLEAR) { if(handle) *handle = i + TRANSIENT_F...
cwe
CWE-119
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
public function pinCommentAction(ProjectComment $comment) { $comment->setPinned(!$comment->isPinned()); try { $this->repository->saveComment($comment); } catch (\Exception $ex) { $this->flashUpdateException($ex); } return $this->redirectToRoute('proje...
cwe
CWE-352
PHP
# -*- 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-770
Python
UNCURL_EXPORT int32_t uncurl_ws_accept(struct uncurl_conn *ucc, char **origins, int32_t n_origins) { int32_t e; e = uncurl_read_header(ucc); if (e != UNCURL_OK) return e; uncurl_set_header_str(ucc, "Upgrade", "websocket"); uncurl_set_header_str(ucc, "Connection", "Upgrade"); char *origin = NULL; e = uncurl_g...
cwe
CWE-352
C/C++
parse_rock_ridge_inode_internal(struct iso_directory_record *de, struct inode *inode, int regard_xa) { int symlink_len = 0; int cnt, sig; struct inode *reloc; struct rock_ridge *rr; int rootflag; struct rock_state rs; int ret = 0; if (!ISOFS_SB(inode->i_sb)->s_rock) return 0; init_rock_state(&rs, inode...
cwe
CWE-399
C/C++
/* * Copyright (C) the libgit2 contributors. All rights reserved. * * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ #include "delta.h" /* maximum hash entry list for the same hash bucket */ #define HASH_LIMIT 64 #defin...
cwe
CWE-681
C/C++
static int __init pf_init(void) { /* preliminary initialisation */ struct pf_unit *pf; int unit; if (disable) return -EINVAL; pf_init_units(); if (pf_detect()) return -ENODEV; pf_busy = 0; if (register_blkdev(major, name)) { for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) put_disk(pf->d...
cwe
CWE-125
Unknown
// mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. // +build riscv64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go package unix import "syscall" const ( B1000000 ...
cwe
CWE-287
Go
static int kvm_vm_ioctl_assign_device(struct kvm *kvm, struct kvm_assigned_pci_dev *assigned_dev) { int r = 0, idx; struct kvm_assigned_dev_kernel *match; struct pci_dev *dev; if (!(assigned_dev->flags & KVM_DEV_ASSIGN_ENABLE_IOMMU)) return -EINVAL; mutex_lock(&kvm->lock); idx = srcu_read_lo...
cwe
CWE-264
C/C++
QPDF::readHintStream(Pipeline& pl, qpdf_offset_t offset, size_t length) { int obj; int gen; QPDFObjectHandle H = readObjectAtOffset( false, offset, "linearization hint stream", -1, 0, obj, gen); ObjCache& oc = this->m->obj_cache[QPDFObjGen(obj, gen)]; qpdf_offset_t min_end_offset = oc.end_before_sp...
cwe
CWE-787
Unknown
function advancedFilterSearch($queue, $filter) { global $database_ged; $datas = array(); if($filter == "description"){ echo json_encode($datas); return false; } $gedsql_result1=sqlrequest($database_ged,"SELECT pkt_type_id,pkt_type_name FROM pkt_type WHERE pkt_type_id!='0' AND pkt_type_id<'100';"); while...
cwe
CWE-78
PHP
int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx) { int rv; rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx); if (rv <= 0) ASN1_item_ex_free(pval, ...
cwe
CWE-787
Unknown
_libssh2_channel_open(LIBSSH2_SESSION * session, const char *channel_type, uint32_t channel_type_len, uint32_t window_size, uint32_t packet_size, const unsigned char *message, size_t message_len) { static c...
cwe
CWE-787
Unknown
import re import warnings from typing import TYPE_CHECKING, Awaitable, Callable, Tuple, Type, TypeVar from .web_exceptions import HTTPMove, HTTPPermanentRedirect from .web_request import Request from .web_response import StreamResponse from .web_urldispatcher import SystemRoute __all__ = ( "middleware", "norm...
cwe
CWE-601
Python
private function _verify($public_key_or_secret, $expected_alg = null) { $segments = explode('.', $this->raw); $signature_base_string = implode('.', array($segments[0], $segments[1])); if (!$expected_alg) { # NOTE: might better to warn here $expected_alg = $this->header['a...
cwe
CWE-200
PHP
int snd_usb_pipe_sanity_check(struct usb_device *dev, unsigned int pipe) { static const int pipetypes[4] = { PIPE_CONTROL, PIPE_ISOCHRONOUS, PIPE_BULK, PIPE_INTERRUPT }; struct usb_host_endpoint *ep; ep = usb_pipe_endpoint(dev, pipe); if (usb_pipetype(pipe) != pipetypes[usb_endpoint_type(&ep->desc)]) return -...
cwe
CWE-476
C/C++
function H(ha){E&&(ya.scrollTop=0,da.innerHTML="",Ea.spin(da),U=!1,V=!0,fa.innerHTML=mxUtils.htmlEntities(mxResources.get("recentDiag")),ba=null,E(ua,function(){z(mxResources.get("cannotLoad"));ua([])},ha?null:u))}
cwe
CWE-94
JavaScript
/****************************************************************************** * * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing * parents and siblings and Scope manipulation * *****************************************************************************/ /* * C...
cwe
CWE-284
C/C++
static ssize_t _epoll_read(oe_fd_t* epoll_, void* buf, size_t count) { ssize_t ret = -1; epoll_t* file = _cast_epoll(epoll_); oe_errno = 0; if (!file) OE_RAISE_ERRNO(OE_EINVAL); /* Call the host. */ if (oe_syscall_read_ocall(&ret, file->host_fd, buf, count) != OE_OK) OE_RAISE_...
cwe
CWE-552
Unknown
async function runApp() { let app = express(); app.set('port', process.env.PORT ?? 8080); let sessionStore = new session.MemoryStore(); let secret = Math.random().toString(); app.use(session({store: sessionStore, resave: true, saveUninitialized: true, secret: secret, cookie: { maxAge: 10000 }, key: 'sid'})); l...
cwe
CWE-863
JavaScript
static PHP_MINIT_FUNCTION(zip) { #ifdef PHP_ZIP_USE_OO zend_class_entry ce; memcpy(&zip_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); zip_object_handlers.clone_obj = NULL; zip_object_handlers.get_property_ptr_ptr = php_zip_get_property_ptr_ptr; zip_object_handlers.get_prope...
cwe
CWE-416
C/C++
func ZeroTierLeaveNetwork(c *gin.Context) { networkId := c.Param("id") service.MyService.ZeroTier().ZeroTierLeaveNetwork(networkId) if len(networkId) == 0 { c.JSON(http.StatusOK, model.Result{Success: oasis_err2.INVALID_PARAMS, Message: oasis_err2.GetMsg(oasis_err2.INVALID_PARAMS)}) return } c.JSON(http.Status...
cwe
CWE-78
Go
mj_color_correct(gx_color_value *Rptr ,gx_color_value *Gptr , gx_color_value *Bptr ) /* R,G,B : 0 to 255 */ { short R,G,B; /* R,G,B : 0 to 255 */ short C,M,Y; /* C,M,Y : 0 to 1023 */ short H,D,Wa; /* ese-HSV */ ...
cwe
CWE-120
C/C++
/* * CCM: Counter with CBC-MAC * * (C) Copyright IBM Corp. 2007 - Joy Latten <latten@us.ibm.com> * * 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 ...
cwe
CWE-119
C/C++
#include "source/common/runtime/runtime_features.h" #include "absl/flags/commandlineflag.h" #include "absl/flags/flag.h" #include "absl/strings/match.h" #include "absl/strings/str_replace.h" #define RUNTIME_GUARD(name) ABSL_FLAG(bool, name, true, ""); // NOLINT #define FALSE_RUNTIME_GUARD(name) ABSL_FLAG(bool,...
cwe
CWE-400
C/C++
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"; import { mainPage } from "../../support/page_objects/mainPage"; let storedURL = ""; // 0: all enabled // 1: field hide // 2: field sort // 3: field filter // 4: default (address table): for view operation validation // 5: default (countr...
cwe
CWE-918
JavaScript
static void __vmx_load_host_state(struct vcpu_vmx *vmx) { unsigned long flags; if (!vmx->host_state.loaded) return; ++vmx->vcpu.stat.host_state_reload; vmx->host_state.loaded = 0; if (vmx->host_state.fs_reload_needed) kvm_load_fs(vmx->host_state.fs_sel); if (vmx->host_state.gs_ldt_reload_needed) { kvm_loa...
cwe
CWE-400
Unknown
h2v2_merged_upsample_565D_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample; register int y,...
cwe
CWE-476
Unknown
void MACH0_(iterate_chained_fixups)(struct MACH0_(obj_t) *bin, ut64 limit_start, ut64 limit_end, ut32 event_mask, RFixupCallback callback, void * context) { int i = 0; for (; i < bin->nsegs; i++) { if (!bin->chained_starts[i]) { continue; } int page_size = bin->chained_starts[i]->page_size; if (page_size <...
cwe
CWE-122
C/C++
/* * jdmrgext.c * * This file was part of the Independent JPEG Group's software: * Copyright (C) 1994-1996, Thomas G. Lane. * libjpeg-turbo Modifications: * Copyright (C) 2011, 2015, D. R. Commander. * For conditions of distribution and use, see the accompanying README.ijg * file. * * This file contains code ...
cwe
CWE-476
C/C++
void ax25_dev_device_down(struct net_device *dev) { ax25_dev *s, *ax25_dev; if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) return; ax25_unregister_dev_sysctl(ax25_dev); spin_lock_bh(&ax25_dev_lock); #ifdef CONFIG_AX25_DAMA_SLAVE ax25_ds_del_timer(ax25_dev); #endif /* * Remove any packet forwarding that ...
cwe
CWE-416
Unknown
/* * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo) * * This library 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 ...
cwe
CWE-20
Java
foreach ($aco_value_array as $aco_value) { $this->debug_text("shift_acl(): ACO Section Value: $aco_section_value ACO VALUE: $aco_value"); $aco_key = array_search($aco_value, $acl_array['aco'][$aco_section_value]); if ($aco_key !== FALSE) { $this->debug_text("shift_acl(): Removing ACO. ($aco_key)")...
cwe
CWE-863
PHP
snd_seq_oss_open(struct file *file, int level) { int i, rc; struct seq_oss_devinfo *dp; dp = kzalloc(sizeof(*dp), GFP_KERNEL); if (!dp) { snd_printk(KERN_ERR "can't malloc device info\n"); return -ENOMEM; } debug_printk(("oss_open: dp = %p\n", dp)); dp->cseq = system_client; dp->port = -1; dp->queue = -1...
cwe
CWE-415
Unknown
struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) { struct sctp_chunk *chunk; sctp_chunkhdr_t *ch = NULL; /* The assumption is that we are safe to process the chunks * at this time. */ if ((chunk = queue->in_progress)) { /* There is a packet that we have been working on. * Any post processing work ...
cwe
CWE-399
C/C++
/* 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-125
Python
package schema import ( "context" "fmt" "net/mail" "net/url" "github.com/answerdev/answer/internal/base/handler" "github.com/answerdev/answer/internal/base/reason" "github.com/answerdev/answer/internal/base/translator" "github.com/answerdev/answer/internal/base/validator" "github.com/segmentfault/pacman/erro...
cwe
CWE-79
Go
int TLSInStream::overrun(int itemSize, int nItems, bool wait) { if (itemSize > bufSize) throw Exception("TLSInStream overrun: max itemSize exceeded"); if (end - ptr != 0) memmove(start, ptr, end - ptr); offset += ptr - start; end -= ptr - start; ptr = start; while (end < start + itemSize) { i...
cwe
CWE-787
C/C++
(function(){var b=new mxObjectCodec(new ChangeGridColor,["ui"]);b.beforeDecode=function(e,f,c){c.ui=e.ui;return f};mxCodecRegistry.register(b)})();(function(){EditorUi.VERSION="18.0.5";EditorUi.compactUi="atlas"!=uiTheme;Editor.isDarkMode()&&(mxGraphView.prototype.gridColor=mxGraphView.prototype.defaultDarkGridColor);E...
cwe
CWE-918
JavaScript
gerbv_gdk_draw_amacro(GdkPixmap *pixmap, GdkGC *gc, gerbv_simplified_amacro_t *s, double scale, gint x, gint y) { dprintf("%s(): drawing simplified aperture macros:\n", __func__); while (s != NULL) { if (s->type >= GERBV_APTYPE_MACRO_CIRCLE && s->type <= GERBV_APTYPE_MACRO_LINE22) { dgk_dra...
cwe
CWE-703
Unknown
null!=na){ca=ia.getAttribute("section");aa=ia.getAttribute("subsection");if(null==ca&&(la=na.indexOf("/"),ca=na.substring(0,la),null==aa)){var qa=na.indexOf("/",la+1);-1<qa&&(aa=na.substring(la+1,qa))}la=ya[ca];null==la&&(xa++,la=[],ya[ca]=la);na=ia.getAttribute("clibs");null!=ra[na]&&(na=ra[na]);na={url:ia.getAttribut...
cwe
CWE-94
JavaScript
/* * (c) Copyright Ascensio System SIA 2010-2019 * * This program is a free software product. You can redistribute it and/or * modify it under the terms of the GNU Affero General Public License (AGPL) * version 3 as published by the Free Software Foundation. In accordance with * Section 7(a) of the GNU AGPL its S...
cwe
CWE-770
C/C++
pq_getbyte_if_available(unsigned char *c) { int r; if (PqRecvPointer < PqRecvLength) { *c = PqRecvBuffer[PqRecvPointer++]; return 1; } /* Put the socket into non-blocking mode */ socket_set_nonblocking(true); r = secure_read(MyProcPort, c, 1); if (r < 0) { /* * Ok if no data available without blo...
cwe
CWE-89
Unknown
/** * FreeRDP: A Remote Desktop Protocol Implementation * Update Data PDUs * * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com> * Copyright 2016 Armin Novak <armin.novak@thincast.com> * Copyright 2016 Thincast Technologies GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * ...
cwe
CWE-125
C/C++
async config(obj, args, context, info) { return { host: WIKI.config.host, title: WIKI.config.title, company: WIKI.config.company, contentLicense: WIKI.config.contentLicense, logoUrl: WIKI.config.logoUrl, ...WIKI.config.seo, ...WIKI.config.features, ....
cwe
CWE-79
JavaScript
status_t HevcParameterSets::addNalUnit(const uint8_t* data, size_t size) { uint8_t nalUnitType = (data[0] >> 1) & 0x3f; status_t err = OK; switch (nalUnitType) { case 32: // VPS err = parseVps(data + 2, size - 2); break; case 33: // SPS err = par...
cwe
CWE-476
C/C++
setTemplates: function() { var iconHTML = ''; if (this.options.suggestionIcon !== '') { iconHTML = '<span class="fa-' + this.options.suggestionIcon + ' icon"></span>'; } // suggestions if (this.options.fields.length) { this.sug...
cwe
CWE-79
JavaScript
export default function ansiRegex({onlyFirst = false} = {}) { const pattern = [ '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' ].join('|'); return new RegExp(pattern, onlyFirst ? undefined : 'g'); }
cwe
CWE-1333
JavaScript
image_render_color_thresh(gx_image_enum *penum_orig, const byte *buffer, int data_x, uint w, int h, gx_device * dev) { gx_image_enum *penum = penum_orig; /* const within proc */ image_posture posture = penum->posture; int vdi; /* amounts to replicate */ fixed xrun = 0; byt...
cwe
CWE-787
C/C++
/* . .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 888oo...
cwe
CWE-79
JavaScript
static s32 gf_avc_read_pps_bs_internal(GF_BitStream *bs, AVCState *avc, u32 nal_hdr) { s32 pps_id; AVC_PPS *pps; gf_bs_enable_emulation_byte_removal(bs, GF_TRUE); if (!nal_hdr) { gf_bs_read_int_log(bs, 1, "forbidden_zero_bit"); gf_bs_read_int_log(bs, 2, "nal_ref_idc"); gf_bs_read_int_log(bs, 5, "nal_unit_ty...
cwe
CWE-190
C/C++
_asn1_ltostr (long v, char *str) { long d, r; char temp[LTOSTR_MAX_SIZE]; int count, k, start; if (v < 0) { str[0] = '-'; start = 1; v = -v; } else start = 0; count = 0; do { d = v / 10; r = v - d * 10; temp[start + count] = '0' + (char) r; c...
cwe
CWE-119
C/C++
public void view(@RequestParam String filename, @RequestParam(required = false) String base, @RequestParam(required = false) Integer tailLines, HttpServletResponse response) throws IOException { securityCheck(filename); response.setContentTy...
cwe
CWE-22
Java
/* * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify i...
cwe
CWE-200
Java
/* USER ROUTES */ var express = require('express'); var router = express.Router(); var mysql = require('mysql'); /* GET home page. */ router.get('/:id(\\d+)', function(req, res, next) { res.json({hello: "world"}); }); /* GET all users */ router.get('/all', function(req, res, next) { res.json({hi: "there"}); }); ...
cwe
CWE-89
JavaScript
package server import ( "encoding/json" "fmt" "io" "net/http" "net/url" "strconv" "strings" "time" "github.com/usememos/memos/api" "github.com/usememos/memos/common" metric "github.com/usememos/memos/plugin/metrics" "github.com/labstack/echo/v4" ) const ( // The max file size is 32MB. maxFileSize = (3...
cwe
CWE-79
Go
- (WOResponse *) rawAction { NSMutableString *content; WOResponse *response; content = [NSMutableString string]; response = [context response]; [content appendFormat: @"%@", [[self clientObject] contentAsString]]; [response setHeader: @"text/plain; charset=utf-8" forKey: @"content-type"]; [...
cwe
CWE-79
JavaScript
var update_selected_labels = function() { var count = 0; $(".ui-selected", div_all_tags).not(".filtered").each(function() { var $this = $(this); if ($this.hasClass('alltags-tagset')) { count += $this.nextUntil(":not(.alltags-childtag)").not( "....
cwe
CWE-116
JavaScript
crypto_xmit( struct peer *peer, /* peer structure pointer */ struct pkt *xpkt, /* transmit packet pointer */ struct recvbuf *rbufp, /* receive buffer pointer */ int start, /* offset to extension field */ struct exten *ep, /* extension pointer */ keyid_t cookie /* session cookie */ ) { struct exten *fp; /* ext...
cwe
CWE-20
C/C++
int ssl3_connect(SSL *s) { BUF_MEM *buf=NULL; unsigned long Time=(unsigned long)time(NULL); void (*cb)(const SSL *ssl,int type,int val)=NULL; int ret= -1; int new_state,state,skip=0; RAND_add(&Time,sizeof(Time),0); ERR_clear_error(); clear_sys_error(); if (s->info_callback != NULL) cb=s->info_callback; e...
cwe
CWE-326
Unknown
static int decode_level3_header(LHAFileHeader **header, LHAInputStream *stream) { unsigned int header_len; if (lha_decode_uint16(&RAW_DATA(header, 0)) != 4) { return 0; } if (!extend_raw_data(header, stream, LEVEL_3_HEADER_LEN - RAW_DATA_LEN(header))) { return 0; } header_len = l...
cwe
CWE-190
C/C++
#ifndef JSI_LITE_ONLY #ifndef JSI_AMALGAMATION #include "jsiInt.h" #endif #define bits_set(who, mask) ((who) |= (mask)) #define bits_unset(who, mask) ((who) &= (~(mask))) #define bits_get(who, mask) ((who) & (mask)) #if JSI__MEMDEBUG void jsi_VALCHK(Jsi_Value *val) { SIGASSERTV(val,VALUE); assert(v...
cwe
CWE-190
C/C++
HeapObjectHeader* NormalPage::findHeaderFromAddress(Address address) { if (address < payload()) return nullptr; if (!m_objectStartBitMapComputed) populateObjectStartBitMap(); size_t objectOffset = address - payload(); size_t objectStartNumber = objectOffset / allocationGranularity; size_t mapIndex = o...
cwe
CWE-787
C/C++
/* Copyright 2019 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-122
C/C++
main(int argc, char **argv) { int i, gn; int test = 0; char *action = NULL, *cmd; char *output = NULL; #ifdef HAVE_EEZE_MOUNT Eina_Bool mnt = EINA_FALSE; const char *act; #endif gid_t gid, gl[65536], egid; for (i = 1; i < argc; i++) { if ((!strcmp(argv[i], "-h")) || ...
cwe
CWE-264
C/C++
static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const char **errptr) { SSL *ssl; X509 *server_cert; char *cp1, *cp2; char *buf; DBUG_ENTER("ssl_verify_server_cert"); DBUG_PRINT("enter", ("server_hostname: %s", server_hostname)); if (!(ssl= (SSL*)vio->ssl_arg)) { *errptr= "N...
cwe
CWE-254
Unknown
function ft(t){return q(t)?new et(t):B(t)?new it(t):F(t)?new rt(t):void 0}
cwe
CWE-601
JavaScript
void Compute(OpKernelContext* context) override { // boxes: [num_boxes, 4] const Tensor& boxes = context->input(0); // scores: [num_boxes] const Tensor& scores = context->input(1); // max_output_size: scalar const Tensor& max_output_size = context->input(2); OP_REQUIRES( context, Ten...
cwe
CWE-703
Unknown
void jpc_qmfb_split_col(jpc_fix_t *a, int numrows, int stride, int parity) { int bufsize = JPC_CEILDIVPOW2(numrows, 1); jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE]; jpc_fix_t *buf = splitbuf; register jpc_fix_t *srcptr; register jpc_fix_t *dstptr; register int n; register int m; int hstartcol; /* Get a buffer. *...
cwe
CWE-119
Unknown
header_put_le_3byte (SF_PRIVATE *psf, int x) { if (psf->headindex < SIGNED_SIZEOF (psf->header) - 3) { psf->header [psf->headindex++] = x ; psf->header [psf->headindex++] = (x >> 8) ; psf->header [psf->headindex++] = (x >> 16) ; } ; } /* header_put_le_3byte */
cwe
CWE-787
Unknown
static SDL_Surface* Create_Surface_Shaded(int width, int height, SDL_Color fg, SDL_Color bg, Uint32 *color) { const int alignment = Get_Alignement() - 1; SDL_Surface *textbuf; Sint64 size; Uint8 bg_alpha = bg.a; /* Create a surface with memory: * - pitch is rounded to alignment * - adress...
cwe
CWE-787
C/C++
/* +----------------------------------------------------------------------+ | HipHop for PHP | +----------------------------------------------------------------------+ | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) | +---------...
cwe
CWE-22
C/C++
snmp_ber_decode_string_len_buffer(unsigned char *buf, uint32_t *buff_len, const char **str, uint32_t *length) { uint8_t type, i, length_bytes; buf = snmp_ber_decode_type(buf, buff_len, &type); if(buf == NULL || type != BER_DATA_TYPE_OCTET_STRING) { /* * Sanity check * Invalid type in buffer *...
cwe
CWE-125
C/C++
XML_GetBuffer(XML_Parser parser, int len) { if (len < 0) { errorCode = XML_ERROR_NO_MEMORY; return NULL; } switch (ps_parsing) { case XML_SUSPENDED: errorCode = XML_ERROR_SUSPENDED; return NULL; case XML_FINISHED: errorCode = XML_ERROR_FINISHED; return NULL; default: ; } if (len...
cwe
CWE-119
C/C++
func (c *Client) Update() (data.TargetFiles, error) { if err := c.UpdateRoots(); err != nil { if _, ok := err.(verify.ErrExpired); ok { // For backward compatibility, we wrap the ErrExpired inside // ErrDecodeFailed. return nil, ErrDecodeFailed{"root.json", err} } return nil, err } // Get timestamp.j...
cwe
CWE-354
Go
#include "cache.h" #include "config.h" #include "commit.h" #include "utf8.h" #include "diff.h" #include "revision.h" #include "string-list.h" #include "mailmap.h" #include "log-tree.h" #include "notes.h" #include "color.h" #include "reflog-walk.h" #include "gpg-interface.h" #include "trailer.h" #include "run-command.h"...
cwe
CWE-190
C/C++
xxxx_do_check( PKT_secret_key *sk, const char *tryagain_text, int mode, int *canceled ) { gpg_error_t err; byte *buffer; u16 csum=0; int i, res; size_t nbytes; if( sk->is_protected ) { /* remove the protection */ DEK *dek = NULL; u32 keyid[4]; /* 4! because we need two of them ...
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-285
Java
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options) { int ret = 0; int codec_init_ok = 0; AVDictionary *tmp = NULL; const AVPixFmtDescriptor *pixdesc; if (avcodec_is_open(avctx)) return 0; if ((!codec && !avctx->codec)) { a...
cwe
CWE-476
Unknown
import dayjs from 'dayjs' import customParseFormat from 'dayjs/plugin/customParseFormat' import { t } from './i18n.js' import Projects from '../api/projects/projects.js' import projectUsers from '../api/users/users.js' import { periodToDates } from './periodHelpers.js' import { getGlobalSetting, getUserSetting } from '...
cwe
CWE-79
JavaScript
IMPEG2D_ERROR_CODES_T impeg2d_init_video_state(dec_state_t *ps_dec, e_video_type_t e_video_type) { /*-----------------------------------------------------------------------*/ /* Bit Stream that conforms to MPEG-1 <ISO/IEC 11172-2> standard */ /*----------------------------------------------------------------...
cwe
CWE-200
C/C++
int h2_make_htx_response(struct http_hdr *list, struct htx *htx, unsigned int *msgf, unsigned long long *body_len) { struct ist phdr_val[H2_PHDR_NUM_ENTRIES]; uint32_t fields; /* bit mask of H2_PHDR_FND_* */ uint32_t idx; int phdr; int ret; int i; uint32_t used = htx_used_space(htx); struct htx_sl *sl = NULL; ...
cwe
CWE-74
Unknown
clibs: node.getAttribute('clibs'), title: node.getAttribute('title')}); } } node = node.nextSibling; } fillNewDiagramCats(newDiagramCats); } }); var extDiagramsCallback = function(list, errorMsg, searchImportCats) { diagramsListBtns.style.display = ''; spinner.stop(); callIniti...
cwe
CWE-94
JavaScript
finish_newstyle_options (struct connection *conn) { int64_t r; r = backend->get_size (backend, conn); if (r == -1) return -1; if (r < 0) { nbdkit_error (".get_size function returned invalid value " "(%" PRIi64 ")", r); return -1; } conn->exportsize = (uint64_t) r; if (proto...
cwe
CWE-406
Unknown
block_filter (void *opaque, int control, iobuf_t chain, byte * buffer, size_t * ret_len) { block_filter_ctx_t *a = opaque; char *buf = (char *)buffer; size_t size = *ret_len; int c, needed, rc = 0; char *p; if (control == IOBUFCTRL_UNDERFLOW) { size_t n = 0; p = buf; assert (s...
cwe
CWE-20
Unknown