code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
call_qftf_func(qf_list_T *qfl, int qf_winid, long start_idx, long end_idx) { callback_T *cb = &qftf_cb; list_T *qftf_list = NULL; // If 'quickfixtextfunc' is set, then use the user-supplied function to get // the text to display. Use the local value of 'quickfixtextfunc' if it is // set. if (qf...
vuln
Vulnerable
C/C++
function PMA_getHtmlForForeignKey($save_row, $i, $existrel_foreign, $myfield, $db, $myfield_md5, $tbl_storage_engine, $options_array ) { $html_output = '<td>'; if (! empty($save_row[$i]['Key'])) { $foreign_db = false; $foreign_table = false; $foreign_column = false; // fore...
vuln
Safe
PHP
int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){ AVInputFormat *avif= s->iformat; int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit; int64_t ts_min, ts_max, ts; int index; AVStream *st; if (stream_index < 0) return -1; #ifdef DEBU...
vuln
Vulnerable
C/C++
void Compute(OpKernelContext* const context) override { // node_id_range const Tensor* node_id_range_t; OP_REQUIRES_OK(context, context->input("node_id_range", &node_id_range_t)); const auto node_id_range = node_id_range_t->vec<int32>(); OP_REQUIRES( context, node_id_range_t->dims() == 1, ...
cwe
CWE-476
C/C++
static Image *ReadYUVImage(const ImageInfo *image_info,ExceptionInfo *exception) { Image *chroma_image, *image, *resize_image; InterlaceType interlace; MagickBooleanType status; register const Quantum *chroma_pixels; register ssize_t x; register Quantum *q; register u...
cwe
CWE-772
C/C++
'use strict'; const _ = require('lodash'); const UPDATE_THROTTLE = 5000; function boot (env, language) { function startBoot(ctx, next) { console.log('Executing startBoot'); ctx.runtimeState = 'booting'; ctx.settings = env.settings; ctx.bus = require('../bus')(env.settings, ctx); ctx.adminnoti...
cwe
CWE-79
JavaScript
static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image, ExceptionInfo *exception) { const char *value; const StringInfo *profile; DPXInfo dpx; GeometryInfo geometry_info; MagickBooleanType status; MagickOffsetType offset; MagickStatusType flags;...
cwe
CWE-401
C/C++
/* * Copyright 2021 ThoughtWorks, Inc. * * 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 agr...
cwe
CWE-77
Java
void Compute(OpKernelContext* context) override { // Here's the basic idea: // Batch and depth dimension are independent from row and col dimension. And // because FractionalAvgPool currently only support pooling along row and // col, we can basically think of this 4D tensor backpropagation as // op...
cwe
CWE-787
Unknown
public static boolean validateCertificate(PGPSignature signature, PGPPublicKeyRing signingKeyRing, Policy policy) throws SignatureValidationException { Map<PGPSignature, Exception> rejections = new ConcurrentHashMap<>(); long keyId = SignatureUtils.determineIssuerKeyId(signature); P...
vuln
Vulnerable
Java
static void openrisc_pic_cpu_handler(void *opaque, int irq, int level) { OpenRISCCPU *cpu = (OpenRISCCPU *)opaque; CPUState *cs = CPU(cpu); uint32_t irq_bit = 1 << irq; if (irq > 31 || irq < 0) { return; } if (level) { cpu->env.picsr |= irq_bit; } else { cpu->env.pics...
vuln
Vulnerable
C/C++
static void smtp_log_to_file(smtp_t *smtp) { FILE *fp = fopen_safe("/tmp/smtp-alert.log", "a"); time_t now; struct tm tm; char time_buf[25]; int time_buf_len; time(&now); localtime_r(&now, &tm); time_buf_len = strftime(time_buf, sizeof time_buf, "%a %b %e %X %Y", &tm); fprintf(fp, "%s: %s -> %s\n" "%*s...
vuln
Safe
C/C++
void jpc_qmfb_split_colgrp(jpc_fix_t *a, int numrows, int stride, int parity) { int bufsize = JPC_CEILDIVPOW2(numrows, 1); jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE * JPC_QMFB_COLGRPSIZE]; jpc_fix_t *buf = splitbuf; jpc_fix_t *srcptr; jpc_fix_t *dstptr; register jpc_fix_t *srcptr2; register jpc_fix_t *dstptr2; r...
cwe
CWE-119
C/C++
static int pop_fetch_headers (CONTEXT *ctx) { int i, ret, old_count, new_count, deleted; unsigned short hcached = 0, bcached; POP_DATA *pop_data = (POP_DATA *)ctx->data; progress_t progress; #ifdef USE_HCACHE header_cache_t *hc = NULL; void *data; hc = pop_hcache_open (pop_data, ctx->path); #endif ti...
cwe
CWE-119
Unknown
def move(request, topic_id): topic = get_object_or_404(Topic, pk=topic_id) form = CommentMoveForm(topic=topic, data=request.POST) if form.is_valid(): comments = form.save() for comment in comments: comment_posted(comment=comment, mentions=None) topic.decrease_commen...
cwe
CWE-601
Python
static void rc4030_write(void *opaque, hwaddr addr, uint64_t data, unsigned int size) { rc4030State *s = opaque; uint32_t val = data; addr &= 0x3fff; trace_rc4030_write(addr, val); switch (addr & ~0x3) { case 0x0000: s->config = val; break; ...
vuln
Vulnerable
C/C++
def allowed_for_local_cluster(session, action) pcs_config = PCSConfig.new(Cfgsync::PcsdSettings.from_file('{}').text()) return pcs_config.permissions_local.allows?( session[:username], session[:usergroups], action ) end
cwe
CWE-384
Ruby
function readKey() { let length = src[position++] if (length >= 0xa0 && length < 0xc0) { // fixstr, potentially use key cache length = length - 0xa0 if (srcStringEnd >= position) // if it has been extracted, must use it (and faster anyway) return srcString.slice(position - srcStringStart, (position += length...
cwe
CWE-754
JavaScript
gdk_pixbuf__gif_image_load_increment (gpointer data, const guchar *buf, guint size, GError **error) { gint retval; GifContext *context = (GifContext *) data; context->error = error; if (context->amount_needed == 0) { /* w...
cwe
CWE-20
Unknown
function init_args() { $args = new stdClass(); $args->req_id = isset($_REQUEST['requirement_id']) ? $_REQUEST['requirement_id'] : 0; $args->compare_selected_versions = isset($_REQUEST['compare_selected_versions']); $args->left_item_id = isset($_REQUEST['left_item_id']) ? intval($_REQUEST['left_item_id']) : -1;...
cwe
CWE-89
PHP
package com.salesmanager.shop.admin.model.secutity; import com.salesmanager.core.model.user.User; import java.io.Serializable; /** * Entity used in the cahange passord page * @author csamson777 * */ public class Password implements Serializable { /** * */ private static final long serialVersionUID = 1L;...
cwe
CWE-639
Java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may n...
vuln
Vulnerable
Java
def _map_vol_to_host(self, volume_name, host_name): """Create a mapping between a volume to a host.""" LOG.debug(_('enter: _map_vol_to_host: volume %(volume_name)s to ' 'host %(host_name)s') % {'volume_name': volume_name, 'host_name': host_name}) # Check i...
cwe
CWE-78
Python
/******************************************************************************* * This file is part of OpenNMS(R). * * Copyright (C) 2002-2014 The OpenNMS Group, Inc. * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * * OpenNMS(...
vuln
Vulnerable
Java
int TLSWrap::DoWrite(std::unique_ptr<WriteWrap>& w, uv_buf_t* bufs, size_t count, uv_stream_t* send_handle) { CHECK_NULL(send_handle); Debug(this, "DoWrite()"); if (ssl_ == nullptr) { ClearError(); error_ = "Write after DestroySSL"; retur...
vuln
Safe
Unknown
int HevcVpsUnit::deserialize() { int rez = HevcUnit::deserialize(); if (rez) return rez; if (m_reader.getBitsLeft() < 128) return NOT_ENOUGH_BUFFER; try { vps_id = m_reader.getBits(4); m_reader.skipBits(2); // reserved vps_max_layers = m_reader.getBits(6) +...
cwe
CWE-22
Unknown
nfsd4_encode_layoutget(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_layoutget *lgp) { struct xdr_stream *xdr = &resp->xdr; const struct nfsd4_layout_ops *ops = nfsd4_layout_ops[lgp->lg_layout_type]; __be32 *p; dprintk("%s: err %d\n", __func__, nfserr); if (nfserr) goto out; nfserr = nfserr_...
cwe
CWE-129
Unknown
private Participant sanityCheckOfSession(RpcConnection rpcConnection, String methodName) throws OpenViduException { String participantPrivateId = rpcConnection.getParticipantPrivateId(); String sessionId = rpcConnection.getSessionId(); String errorMsg; if (sessionId == null) { // null when afterConnectionClose...
vuln
Vulnerable
Java
void LibRaw::parse_exif(int base) { unsigned entries, tag, type, len, save, c; double expo, ape; unsigned kodak = !strncmp(make, "EASTMAN", 7) && tiff_nifds < 3; entries = get2(); if (!strncmp(make, "Hasselblad", 10) && (tiff_nifds > 3) && (entries > 512)) return; INT64 fsize = ifp->size(); while (e...
cwe
CWE-787
C/C++
int ZlibInStream::pos() { return offset + ptr - start; }
cwe
CWE-787
C/C++
header_put_be_8byte (SF_PRIVATE *psf, sf_count_t x) { if (psf->headindex < SIGNED_SIZEOF (psf->header) - 8) { psf->header [psf->headindex++] = 0 ; psf->header [psf->headindex++] = 0 ; psf->header [psf->headindex++] = 0 ; psf->header [psf->headindex++] = 0 ; psf->header [psf->headindex++] = (x >> 24) ; psf->h...
cwe
CWE-119
C/C++
static int mp_dss_print(netdissect_options *ndo, const u_char *opt, u_int opt_len, u_char flags) { const struct mp_dss *mdss = (const struct mp_dss *) opt; if ((opt_len != mp_dss_len(mdss, 1) && opt_len != mp_dss_len(mdss, 0)) || flags & TH_SYN) return 0; ...
vuln
Vulnerable
C/C++
/** * A simple, static http GET server. * * (C) 2015 TekMonks. All rights reserved. * License: See enclosed file. */ const extensions = []; const fs = require("fs"); const zlib = require("zlib"); const path = require("path"); const http = require("http"); const https = require("https"); let access; let error; ...
cwe
CWE-79
JavaScript
def __process_key_event_internal2(self, keyval, keycode, state): if self.__has_input_purpose and \ self.__input_purpose == IBus.InputPurpose.PASSWORD: return False if Engine.__typing_mode == jastring.TYPING_MODE_THUMB_SHIFT and \ Engine.__input_mode not in [INPUT_MODE_...
vuln
Safe
Python
void SoftG711::onQueueFilled(OMX_U32 /* portIndex */) { if (mSignalledError) { return; } List<BufferInfo *> &inQueue = getPortQueue(0); List<BufferInfo *> &outQueue = getPortQueue(1); while (!inQueue.empty() && !outQueue.empty()) { BufferInfo *inInfo = *inQueue.begin(); OMX_BUFFERHEADERTYPE *inHeader =...
cwe
CWE-119
C/C++
BGD_DECLARE(void) gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOCtx * out) { int x, y, c, b, sx, sy, p; char *name, *f; size_t i, l; name = file_name; if ((f = strrchr(name, '/')) != NULL) name = f+1; if ((f = strrchr(name, '\\')) != NULL) name = f+1; name = strdup(name); if ((f = strrchr(name, ...
cwe
CWE-119
Unknown
#include <mruby.h> #include <mruby/array.h> #include <mruby/class.h> #include <mruby/proc.h> #define fiber_ptr(o) ((struct RFiber*)mrb_ptr(o)) #define FIBER_STACK_INIT_SIZE 64 #define FIBER_CI_INIT_SIZE 8 #define CI_ACC_RESUMED -3 /* * call-seq: * Fiber.new{...} -> obj * * Creates a fiber, whose execution ...
vuln
Vulnerable
C/C++
private def authenticateWebSocket(site: SiteBrief, request: RequestHeader) : AuthnReqHeaderImpl Or Result = { import tyCtx.security val dao = globals.siteDao(site.id) val requestOrigin = request.headers.get(play.api.http.HeaderNames.ORIGIN) val siteCanonicalOrigin = globals.originOfSiteId(site....
vuln
Vulnerable
Scala
spnego_gss_complete_auth_token( OM_uint32 *minor_status, const gss_ctx_id_t context_handle, gss_buffer_t input_message_buffer) { OM_uint32 ret; spnego_gss_ctx_id_t sc = (spnego_gss_ctx_id_t)context_handle; if (sc->ctx_handle == GSS_C_NO_CONTEXT) return (GSS_S_UNAVAILABLE); ret = gss_complete_auth_token(mi...
vuln
Safe
C/C++
remove: function (from, callback) { var that = this, cmd = ''; fs.lstat(from, function (err, stats) { if (err) { callback(err); } else { if (that._win32) { // windows if (stats.isDirectory()) { cmd = 'rd /s /q "' + from + '"'; } else if...
cwe
CWE-77
JavaScript
/* radare - LGPL - Copyright 2015-2018 - Dax89, pancake */ #include <string.h> #include <r_types.h> #include <r_lib.h> #include <r_bin.h> #include "../i/private.h" #include "psxexe/psxexe.h" static bool check_buffer(RBinFile *bf, RBuffer *b) { ut8 magic[PSXEXE_ID_LEN]; if (r_buf_read_at (b, 0, magic, sizeof (magic)...
cwe
CWE-400
C/C++
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */ /* * lsquic_mm.c -- Memory manager. */ #include <assert.h> #include <errno.h> #include <stddef.h> #include <stdlib.h> #include <string.h> #include <sys/queue.h> #include "fiu-local.h" #include "lsquic.h" #include "lsquic_int_types.h" #includ...
vuln
Vulnerable
C/C++
static Image *ReadAAIImage(const ImageInfo *image_info,ExceptionInfo *exception) { Image *image; MagickBooleanType status; register ssize_t x; register Quantum *q; register unsigned char *p; size_t height, length, width; ssize_t count, y; unsigned char ...
vuln
Safe
C/C++
function insertAdult(firstName, lastName, username, password, packNumber, leaderType, rankType, phoneNumber, connection) { var temp= selectAdult(username, connection); if(temp.databaseObject.adult_id<1) { return temp; } var strQuery = "INSERT INTO adult VALUES('"+firstName+"', '"+lastName+"', '"+ username +...
cwe
CWE-89
JavaScript
static av_cold int ape_decode_init(AVCodecContext * avctx) { APEContext *s = avctx->priv_data; int i; if (avctx->extradata_size != 6) { av_log(avctx, AV_LOG_ERROR, "Incorrect extradata\n"); return -1; } if (avctx->bits_per_coded_sample != 16) { av_log(avctx, AV_LOG_ERROR, "On...
vuln
Safe
C/C++
u_int fr_print(netdissect_options *ndo, register const u_char *p, u_int length) { int ret; uint16_t extracted_ethertype; u_int dlci; u_int addr_len; uint16_t nlpid; u_int hdr_len; uint8_t flags[4]; ret = parse_q922_addr(ndo, p, &dlci, &addr_len, flags, length); if (ret == -1) goto trunc; if (ret =...
vuln
Safe
C/C++
configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone, const char *zname) { const cfg_obj_t *updatepolicy = NULL; const cfg_listelt_t *element, *element2; dns_ssutable_t *table = NULL; isc_mem_t *mctx = dns_zone_getmctx(zone); bool autoddns = false; isc_result_t result; (void)cfg_map_get(zconfig...
vuln
Safe
C/C++
/* * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2002-2016, 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 ...
vuln
Safe
Java
static int __ip6_append_data(struct sock *sk, struct flowi6 *fl6, struct sk_buff_head *queue, struct inet_cork *cork, struct inet6_cork *v6_cork, struct page_frag *pfrag, int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), v...
vuln
Safe
C/C++
xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt) { const xmlChar *elemName; const xmlChar *attrName; xmlEnumerationPtr tree; if (CMP9(CUR_PTR, '<', '!', 'A', 'T', 'T', 'L', 'I', 'S', 'T')) { xmlParserInputPtr input = ctxt->input; SKIP(9); if (!IS_BLANK_CH(CUR)) { xmlFatalErrMsg(ctxt, XML_ERR_S...
cwe
CWE-119
C/C++
QPDF::isEncrypted(int& R, int& P, int& V, encryption_method_e& stream_method, encryption_method_e& string_method, encryption_method_e& file_method) { if (this->m->encp->encrypted) { QPDFObjectHandle trailer = getTrailer(); QPDFObjectHandle encrypt = traile...
cwe
CWE-787
Unknown
@frappe.whitelist(allow_guest=True) def send_message(subject="Website Query", message="", sender="", status="Open"): from frappe.www.contact import send_message as website_send_message lead = customer = None website_send_message(subject, message, sender) customer = frappe.db.sql("""select distinct dl.link_name fr...
cwe
CWE-89
Python
static void cpu_ioreq_pio(ioreq_t *req) { int i, sign; sign = req->df ? -1 : 1; if (req->dir == IOREQ_READ) { if (!req->data_is_ptr) { req->data = do_inp(req->addr, req->size); } else { uint32_t tmp; for (i = 0; i < req->count; i++) { tmp =...
vuln
Vulnerable
C/C++
protected final View prepareDecorView(View v) { v = FontLoader.apply(v); if (!getConfig().isDisableContextMenu() && v != null) { v = new ContextMenuDecorView(this, v, this); } return v; }
vuln
Safe
Java
LOG_FileWrite(LOG_FileID id, const char *format, ...) { va_list other_args; int banner; if (id < 0 || id >= n_filelogs || !logfiles[id].name) return; if (!logfiles[id].file) { char filename[PATH_MAX], *logdir = CNF_GetLogDir(); if (logdir[0] == '\0') { LOG(LOGS_WARN, "logdir not specified")...
cwe
CWE-59
Unknown
void SimpleSoftOMXComponent::onPortEnable(OMX_U32 portIndex, bool enable) { CHECK_LT(portIndex, mPorts.size()); PortInfo *port = &mPorts.editItemAt(portIndex); CHECK_EQ((int)port->mTransition, (int)PortInfo::NONE); CHECK(port->mDef.bEnabled == !enable); if (!enable) { port->mDef.bEnable...
vuln
Vulnerable
C/C++
package api type Shortcut struct { ID int `json:"id"` // Standard fields RowStatus RowStatus `json:"rowStatus"` CreatorID int `json:"creatorId"` CreatedTs int64 `json:"createdTs"` UpdatedTs int64 `json:"updatedTs"` // Domain specific fields Title string `json:"title"` Payload string `json:"p...
cwe
CWE-285
Go
# -*- 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
function getUserPartForHeader() { global $i18n; if (!$this->id) return null; $user_part = htmlspecialchars($this->name); $user_part .= ' - '.htmlspecialchars($this->role_name); if ($this->behalf_id) { $user_part .= ' <span class="onBehalf">'.$i18n->get('label.on_behalf').' '.htmlspecialchars(...
vuln
Safe
PHP
spell_move_to( win_T *wp, int dir, // FORWARD or BACKWARD int allwords, // TRUE for "[s"/"]s", FALSE for "[S"/"]S" int curline, hlf_T *attrp) // return: attributes of bad word or NULL // (only when "dir" is FORWARD) { linenr_T lnum; pos_T found_pos; int found_len = 0; char_...
cwe
CWE-416
C/C++
int ndpi_netbios_name_interpret(char *in, size_t in_len, char *out, u_int out_len) { u_int ret = 0, len, idx = in_len, out_idx = 0; len = (*in++)/2; out_len--; out[out_idx] = 0; if((len > out_len) || (len < 1) || ((2*len) > in_len)) return(-1); while((len--) && (out_idx < out_len)) { if((idx < 2)...
cwe
CWE-787
Unknown
zimage3(i_ctx_t *i_ctx_p) { os_ptr op = osp; gs_image3_t image; int interleave_type; ref *pDataDict; ref *pMaskDict; image_params ip_data, ip_mask; int ignored; int code, mcode; check_type(*op, t_dictionary); check_dict_read(*op); if ((code = dict_int_param(op, "InterleaveTy...
vuln
Vulnerable
Unknown
Init_ossl_cipher(void) { #if 0 mOSSL = rb_define_module("OpenSSL"); eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError); #endif /* Document-class: OpenSSL::Cipher * * Provides symmetric algorithms for encryption and decryption. The * algorithms that are available dep...
cwe
CWE-310
Unknown
static void do_show_pages(QPDF& pdf, Options& o) { QPDFPageDocumentHelper dh(pdf); std::vector<QPDFPageObjectHelper> pages = dh.getAllPages(); int pageno = 0; for (std::vector<QPDFPageObjectHelper>::iterator iter = pages.begin(); iter != pages.end(); ++iter) { QPDFPageObjectHelper& ...
cwe
CWE-787
Unknown
public int getUnreadMessageCount() { Cursor cursor = null; try { SQLiteDatabase db = dbHelper.getReadableDatabase(); cursor = db.rawQuery("SELECT COUNT(1) FROM sms WHERE read = 0 ", null); cursor.moveToFirst(); int unreadMessageCount = 0; if (c...
vuln
Vulnerable
Java
bool CModules::GetModPathInfo(CModInfo& ModInfo, const CString& sModule, const CString& sModPath, CString& sRetMsg) { ModInfo.SetName(sModule); ModInfo.SetPath(sModPath); ModHandle p = OpenModule(sModule, sModPath, ModInfo, sRetMsg); if (!p) return false; dlclose(p); ...
cwe
CWE-264
Unknown
success: function(_result, _request){ var nodeData = Ext.util.JSON.decode(_result.responseText); node.setText(Ext.util.Format.htmlEncode(_text)); this.scope.fireE...
vuln
Safe
JavaScript
static int php_iconv_stream_filter_append_bucket( php_iconv_stream_filter *self, php_stream *stream, php_stream_filter *filter, php_stream_bucket_brigade *buckets_out, const char *ps, size_t buf_len, size_t *consumed, int persistent TSRMLS_DC) { php_stream_bucket *new_bucket; char *out_buf = NULL; size_t o...
cwe
CWE-835
C/C++
function reducer(result, arg) { arg = arg.split('=') // Get key node const keypath = arg.shift().split('.') // Get value let val = true if(arg.length) { val = arg.join('=').split(',') if(val.length === 1) val = val[0] } let key = keypath.shift() if(!keypath.length) return {...result, [ke...
vuln
Safe
JavaScript
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
vuln
Safe
Python
sph_enc16le(void *dst, unsigned val) { ((unsigned char *)dst)[0] = val; ((unsigned char *)dst)[1] = val >> 8; }
cwe
CWE-787
Unknown
bool DDeviceDiskInfoPrivate::openDataStream(int index) { if (process) { process->deleteLater(); } process = new QProcess(); QObject::connect(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), process, [this] (int code, QProcess::ExitS...
cwe
CWE-59
C/C++
static void mcf_uart_do_tx(mcf_uart_state *s) { if (s->tx_enabled && (s->sr & MCF_UART_TxEMP) == 0) { if (s->chr) qemu_chr_fe_write_all(s->chr, (unsigned char *)&s->tb, 1); s->sr |= MCF_UART_TxEMP; } if (s->tx_enabled) { s->sr |= MCF_UART_TxRDY; } else { ...
vuln
Safe
C/C++
private void sendAllJSON(HttpExchange pExchange, ParsedUri pParsedUri, JSONAware pJson) throws IOException { OutputStream out = null; try { Headers headers = pExchange.getResponseHeaders(); if (pJson != null) { headers.set("Content-Type", getMimeType(pParsedUri) +...
cwe
CWE-79
Java
const bootbox = require('bootbox'); const Requisition = require('../model/Requisition'); require('../services/Requisitions'); require('../services/Synchronize'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (function() { 'use strict'; angular.module('onms-req...
cwe
CWE-352
Java
/* * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main director...
cwe
CWE-416
C/C++
const fs = require('fs') const fsProm = require('fs/promises'); const os = require('os'); const path = require('path') const url = require('url') const {Menu: menu, shell, dialog, clipboard, nativeImage, ipcMain, app, BrowserWindow} = require('electron') const crc = require('crc'); const zlib = require('zlib'); const...
cwe
CWE-20
JavaScript
import Controller from "@ember/controller"; import { action } from "@ember/object"; import { getAbsoluteURL } from "discourse-common/lib/get-url"; import discourseComputed, { afterRender, } from "discourse-common/utils/decorators"; import { longDateNoYear } from "discourse/lib/formatter"; import Sharing from "discour...
cwe
CWE-276
JavaScript
public static function loadFrom(Db $zdb, $id, $mailing, $new = true) { try { $select = $zdb->select(self::TABLE); $select->where('mailing_id = ' . $id); $results = $zdb->execute($select); $result = $results->current(); return $mailing->loadFromHi...
cwe
CWE-89
PHP
private static X509Certificate extractCertificate(final Object[] certs) { if (certs != null) { for (final Object cert : certs) { if (cert instanceof X509Certificate) { return (X509Certificate) cert; } } } return null; ...
vuln
Safe
Java
static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt, const uint8_t *buf, int len) { unsigned int ssrc, h; int payload_type, seq, ret, flags = 0; int ext; AVStream *st; uint32_t timestamp; int rv = 0; ext = buf[0] & 0x10; pa...
vuln
Safe
C/C++
int lpEncodeGetType(unsigned char *ele, uint32_t size, unsigned char *intenc, uint64_t *enclen) { int64_t v; if (lpStringToInt64((const char*)ele, size, &v)) { if (v >= 0 && v <= 127) { /* Single byte 0-127 integer. */ intenc[0] = v; *enclen = 1; } else if (v ...
cwe
CWE-190
Unknown
/* Copyright JS Foundation and other contributors, http://js.foundation * * 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 r...
cwe
CWE-476
C/C++
public static SecurityAnalysisReport analyse(Contract contract){ SecurityAnalysisReport report = new SecurityAnalysisReport(contract); StoreAccessAfterUnsafeCall.analyse(contract, report); report.stopTimer(); return report; }
vuln
Vulnerable
Java
"""Tornado handlers for kernels.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import json import logging from tornado import gen, web from tornado.concurrent import Future from tornado.ioloop import IOLoop from IPython.utils.jsonutil import date_default from...
cwe
CWE-79
Python
static void umount_tree(struct mount *mnt, enum umount_tree_flags how) { LIST_HEAD(tmp_list); struct mount *p; if (how & UMOUNT_PROPAGATE) propagate_mount_unlock(mnt); /* Gather the mounts to umount */ for (p = mnt; p; p = next_mnt(p, mnt)) { p->mnt.mnt_flags |= MNT_UMOUNT; list_move(&p->mnt_list, &tmp_lis...
vuln
Vulnerable
Unknown
static void xen_netbk_fill_frags(struct xen_netbk *netbk, struct sk_buff *skb) { struct skb_shared_info *shinfo = skb_shinfo(skb); int nr_frags = shinfo->nr_frags; int i; for (i = 0; i < nr_frags; i++) { skb_frag_t *frag = shinfo->frags + i; struct xen_netif_tx_request *txp; struct page *page; u16 pending_...
cwe
CWE-399
C/C++
/************************************************************************ * This file is part of EspoCRM. * * EspoCRM - Open Source CRM application. * Copyright (C) 2014-2019 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko * Website: https://www.espocrm.com * * EspoCRM is free software: you can redistribute i...
vuln
Vulnerable
JavaScript
R_API void r_core_fini(RCore *c) { if (!c) { return; } r_core_task_break_all (&c->tasks); r_core_task_join (&c->tasks, NULL, -1); r_core_wait (c); /* TODO: it leaks as shit */ //update_sdb (c); // avoid double free r_list_free (c->ropchain); r_event_free (c->ev); free (c->cmdlog); free (c->lastsearch); R...
cwe
CWE-703
C/C++
void impeg2d_dec_pic_data_thread(dec_state_t *ps_dec) { WORD32 i4_continue_decode; WORD32 i4_cur_row, temp; UWORD32 u4_bits_read; WORD32 i4_dequeue_job; IMPEG2D_ERROR_CODES_T e_error; i4_cur_row = ps_dec->u2_mb_y + 1; i4_continue_decode = 1; i4_dequeue_job = 1; do { if(i4_cur_row ...
vuln
Vulnerable
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...
vuln
Safe
C/C++
static void *__ns_get_path(struct path *path, struct ns_common *ns) { struct vfsmount *mnt = nsfs_mnt; struct qstr qname = { .name = "", }; struct dentry *dentry; struct inode *inode; unsigned long d; rcu_read_lock(); d = atomic_long_read(&ns->stashed); if (!d) goto slow; dentry = (struct dentry *)d; if (!...
cwe
CWE-416
C/C++
int LUKS2_config_set_requirements(struct crypt_device *cd, struct luks2_hdr *hdr, uint32_t reqs, bool commit) { json_object *jobj_config, *jobj_requirements, *jobj_mandatory, *jobj; int i, r = -EINVAL; if (!hdr) return -EINVAL; jobj_mandatory = json_object_new_array(); if (!jobj_mandatory) return -ENOMEM; ...
cwe
CWE-345
Unknown
static int handle_to_path(int mountdirfd, struct file_handle __user *ufh, struct path *path) { int retval = 0; struct file_handle f_handle; struct file_handle *handle = NULL; /* * With handle we don't look at the execute bit on the * the directory. Ideally we would like CAP_DAC_SEARCH. * But we don't ha...
cwe
CWE-362
C/C++
QPDF_Array::setItem(int n, QPDFObjectHandle const& oh) { // Call getItem for bounds checking (void) getItem(n); this->items.at(n) = oh; }
cwe
CWE-787
Unknown
static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) { struct hw_fib * kfib; struct fib *fibptr; struct hw_fib * hw_fib = (struct hw_fib *)0; dma_addr_t hw_fib_pa = (dma_addr_t)0LL; unsigned size; int retval; if (dev->in_reset) { return -EBUSY; } fibptr = aac_fib_alloc(dev); if(fibptr == NULL)...
cwe
CWE-362
Unknown
/* Copyright 2015 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-617
Python
void virtio_scsi_exit(VirtIODevice *vdev) { VirtIOSCSI *s = (VirtIOSCSI *)vdev; unregister_savevm(s->qdev, "virtio-scsi", s); virtio_cleanup(vdev); }
vuln
Safe
C/C++
var FilePropertiesDialog=function(b){var e=document.createElement("table"),f=document.createElement("tbody");e.style.width="100%";e.style.marginTop="8px";var c=b.getCurrentFile();var m=null!=c&&null!=c.getTitle()?c.getTitle():b.defaultFilename;var n=function(){};if(/(\.png)$/i.test(m)){n=1;var v=0;m=b.fileNode;null!=m&...
cwe
CWE-20
JavaScript
async getKey(key) { const bKey = Buffer.from(key); const abHash = await crypto.subtle.digest('SHA-256', bKey.buffer); const abKey = Buffer.from(Buffer.from(abHash).toString('hex').slice(0, 32), 'utf8').buffer; return crypto.subtle.importKey('raw', abKey, 'AES-CBC', true, ['encrypt', 'decrypt']); }
cwe
CWE-331
JavaScript