code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
def paginate_by_sql(model, sql, per_page, options={}) if options[:count] if options[:count].is_a?(Integer) total = options[:count] else total = model.count_by_sql(options[:count]) end else total = model.count_by_sql_wrapping_select_query(sql) end object_pages = m...
vuln
Vulnerable
Ruby
int qcow2_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab) { BDRVQcowState *s = bs->opaque; QEMUSnapshotInfo *sn_tab, *sn_info; QCowSnapshot *sn; int i; if (!s->nb_snapshots) { *psn_tab = NULL; return s->nb_snapshots; } sn_tab = g_malloc0(s->nb_snapshots * size...
vuln
Vulnerable
C/C++
gs_heap_alloc_bytes(gs_memory_t * mem, uint size, client_name_t cname) { gs_malloc_memory_t *mmem = (gs_malloc_memory_t *) mem; byte *ptr = 0; #ifdef DEBUG const char *msg; static const char *const ok_msg = "OK"; # define set_msg(str) (msg = (str)) #else # define set_msg(str) DO_NOTHING #endif ...
cwe
CWE-189
C/C++
private static boolean isValidBiome(Structure.GenerationContext context) { int x = context.chunkPos().getMiddleBlockX(); int z = context.chunkPos().getMiddleBlockZ(); int y = 1; Holder<Biome> holder = context.chunkGenerator().getBiomeSource().getNoiseBiome(QuartPos.fromBlock(x), QuartPos.fromBlock(y), QuartPos....
vuln
Vulnerable
Java
void cWebAdmin::HandleFileRequest(cHTTPServerConnection & a_Connection, cHTTPIncomingRequest & a_Request) { AString FileURL = a_Request.GetURL(); std::replace(FileURL.begin(), FileURL.end(), '\\', '/'); // Remove all leading backslashes: if (!FileURL.empty() && (FileURL[0] == '/')) { size_t FirstCharToRead = Fi...
vuln
Vulnerable
C/C++
compress_write(ds_file_t *file, const uchar *buf, size_t len) { ds_compress_file_t *comp_file; ds_compress_ctxt_t *comp_ctxt; comp_thread_ctxt_t *threads; comp_thread_ctxt_t *thd; uint nthreads; uint i; const char *ptr; ds_file_t *dest_file; comp_file = (ds_compress_file_t *) file->ptr; comp_ctxt = com...
cwe
CWE-703
Unknown
private AuthnRequestParseResult parseRequest(byte[] xmlBytes) throws SAMLException { String xml = new String(xmlBytes, StandardCharsets.UTF_8); if (logger.isDebugEnabled()) { logger.debug("SAMLRequest XML is\n{}", xml); } AuthnRequestParseResult result = new AuthnRequestParseResult(); result....
cwe
CWE-611
Java
bool Cluster::EOS() const //// long long element_size) { return (m_pSegment == NULL); }
cwe
CWE-119
C/C++
int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, int *al) { unsigned short length; unsigned short type; unsigned short size; unsigned char *data = *p; int tlsext_servername = 0; int renegotiate_seen = 0; # ifndef OPENSSL_NO_NE...
vuln
Safe
Unknown
/** * Copyright (c) 2010-2020 Contributors to the openHAB project * * See the NOTICE file(s) distributed with this work for additional * information. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse....
cwe
CWE-611
Java
static ssize_t ucma_write(struct file *filp, const char __user *buf, size_t len, loff_t *pos) { struct ucma_file *file = filp->private_data; struct rdma_ucm_cmd_hdr hdr; ssize_t ret; if (len < sizeof(hdr)) return -EINVAL; if (copy_from_user(&hdr, buf, sizeof(hdr))) return -EFAULT; if (hdr.cmd >=...
cwe
CWE-264
C/C++
int mainloop(CLIENT *client) { struct nbd_request request; struct nbd_reply reply; gboolean go_on=TRUE; #ifdef DODBG int i = 0; #endif negotiate(client->net, client, NULL); DEBUG("Entering request loop!\n"); reply.magic = htonl(NBD_REPLY_MAGIC); reply.error = 0; while (go_on) { char buf[BUFSIZE]; size_t le...
cwe
CWE-119
C/C++
static char *parse_note(char *p, int flags) { struct SYMBOL *s; char *q; int pit = 0, len, acc, nostem, chord, j, m, n; if (flags & ABC_F_GRACE) { /* in a grace note sequence */ s = abc_new(ABC_T_NOTE, NULL); } else { s = abc_new(ABC_T_NOTE, gchord); if (gchord) gchord = NULL; } s->flags |= flags; ...
cwe
CWE-787
Unknown
/* * Copyright (c) 2009-2020, Salvatore Sanfilippo <antirez at gmail dot com> * Copyright (c) 2020, Redis Labs, Inc * 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 ...
cwe
CWE-404
C/C++
unsigned long X509_issuer_and_serial_hash(X509 *a) { unsigned long ret = 0; EVP_MD_CTX *ctx = EVP_MD_CTX_new(); unsigned char md[16]; char *f; if (ctx == NULL) goto err; f = X509_NAME_oneline(a->cert_info.issuer, NULL, 0); if (!EVP_DigestInit_ex(ctx, EVP_md5(), NULL)) goto e...
cwe
CWE-476
Unknown
static void hidp_process_report(struct hidp_session *session, int type, const u8 *data, unsigned int len, int intr) { if (len > HID_MAX_BUFFER_SIZE) len = HID_MAX_BUFFER_SIZE; memcpy(session->input_buf, data, len); hid_input_report(session->hid, type, session->input_buf, len, intr); }
vuln
Safe
C/C++
static int tower_probe (struct usb_interface *interface, const struct usb_device_id *id) { struct device *idev = &interface->dev; struct usb_device *udev = interface_to_usbdev(interface); struct lego_usb_tower *dev = NULL; struct usb_host_interface *iface_desc; struct usb_endpoint_descriptor* endpoint; struct tow...
cwe
CWE-476
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
package server import ( "context" "fmt" "os" "path/filepath" "strconv" "strings" "github.com/containers/storage/pkg/idtools" "github.com/containers/storage/pkg/mount" "github.com/containers/storage/pkg/stringid" "github.com/cri-o/cri-o/internal/factory/container" "github.com/cri-o/cri-o/internal/lib/sandbo...
vuln
Safe
Go
function l(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}
vuln
Safe
JavaScript
/* etterfilter -- the actual compiler Copyright (C) ALoR & NaGA 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 later...
cwe
CWE-125
C/C++
public String[] getCdDtlNm2() { return cdDtlNm2 != null ? cdDtlNm2.clone() : null; }
vuln
Safe
Java
opj_pi_iterator_t *opj_pi_create_decode(opj_image_t *p_image, opj_cp_t *p_cp, OPJ_UINT32 p_tile_no) { /* loop */ OPJ_UINT32 pino; OPJ_UINT32 compno, resno; /* to store w, h, dx and dy fro all components and resolutions */ OPJ_UINT32 * l_tmp_data; OPJ_UINT32 ** l_tmp_ptr; /* encoding pramete...
vuln
Safe
C/C++
static void usbredir_buffered_bulk_packet(void *priv, uint64_t id, struct usb_redir_buffered_bulk_packet_header *buffered_bulk_packet, uint8_t *data, int data_len) { USBRedirDevice *dev = priv; uint8_t status, ep = buffered_bulk_packet->endpoint; void *free_on_destroy; int i, len; DPRINTF("b...
vuln
Safe
C/C++
static int write_header(FlashSV2Context * s, uint8_t * buf, int buf_size) { PutBitContext pb; int buf_pos, len; if (buf_size < 5) return -1; init_put_bits(&pb, buf, buf_size); put_bits(&pb, 4, (s->block_width >> 4) - 1); put_bits(&pb, 12, s->image_width); put_bits(&pb, 4, (s->block_...
vuln
Safe
C/C++
package libproxy import ( "bytes" "encoding/base64" "encoding/json" "fmt" "io" "io/ioutil" "log" "mime/multipart" "net/http" "net/url" "strconv" "strings" "github.com/google/uuid" ) type statusChangeFunction func(status string, isListening bool) var ( accessToken string sessionFingerprint stri...
cwe
CWE-918
Go
/* 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...
cwe
CWE-416
Python
void ACLosslessScan::ParseMCU(struct Line **prev,struct Line **top) { #if ACCUSOFT_CODE UBYTE c; // // Parse a single MCU, which is now a group of pixels. for(c = 0;c < m_ucCount;c++) { struct QMContextSet &contextset = m_Context[m_ucContext[c]]; struct Line *line = top[c]; struct Line *pline= prev...
cwe
CWE-617
C/C++
static void png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type, uint8_t *src, uint8_t *last, int size, int bpp) { int i, p, r, g, b, a; switch (filter_type) { case PNG_FILTER_VALUE_NONE: memcpy(dst, src, size); break; case PNG_FILTER_VALUE_SUB: ...
vuln
Vulnerable
C/C++
public void agentDisconnected(String packageName) { // TODO: handle backup being interrupted synchronized (mAgentConnectLock) { if (Binder.getCallingUid() == Process.SYSTEM_UID) { mConnectedAgent = null; mConnecting = false; } else { ...
vuln
Vulnerable
Java
static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, SpectrumParameters *spectrum) { unsigned int temp, max_qmf_subbands; unsigned int start_min, stop_min; int k; const int8_t *sbr_offset_ptr; int16_t stop_dk[13]; if (sbr->sample_rate < 32000) {...
vuln
Vulnerable
C/C++
@Override public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) { if(this.scalingChestScreen.handleMouseClicked(mouseX, mouseY, mouseButton)) { return false; } return super.mouseClicked(mouseX, mouseY, mouseButton); }
vuln
Vulnerable
Java
@SuppressWarnings("unchecked") private static Connection getConnection0(final Settings settings, final Path configPath, final ClassLoader cl, final boolean needRestore) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException, LdapException...
vuln
Safe
Java
static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb) { struct sk_buff **pp = NULL; struct packet_offload *ptype; __be16 type = skb->protocol; struct list_head *head = &offload_base; int same_flow; enum gro_result ret; int grow; if (!(skb->dev->features & NETIF_F_GRO)) goto no...
vuln
Vulnerable
Unknown
static void lm32_evr_init(QEMUMachineInitArgs *args) { const char *cpu_model = args->cpu_model; const char *kernel_filename = args->kernel_filename; LM32CPU *cpu; CPULM32State *env; DriveInfo *dinfo; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *phys_ram = g_new(Memor...
vuln
Vulnerable
C/C++
static av_cold int vqa_decode_init(AVCodecContext *avctx) { VqaContext *s = avctx->priv_data; unsigned char *vqa_header; int i, j, codebook_index; s->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; if (s->avctx->extradata_size != VQA_HEADER_SIZE) { av_log(s->avctx, AV_LOG_ERROR, " VQ...
vuln
Vulnerable
C/C++
@Nonnull @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, @Nonnull Hand handIn) { ItemStack stack = playerIn.getHeldItem(handIn); return VampirePlayer.getOpt(playerIn).map(vampire -> { if (vampire.getLevel() == 0) return new ActionResult...
vuln
Safe
Java
/* * Description: * History: yang@haipo.me, 2016/03/30, create */ # include <stdlib.h> # include <assert.h> # include "ut_rpc.h" # include "ut_crc32.h" # include "ut_misc.h" int rpc_decode(nw_ses *ses, void *data, size_t max) { if (max < RPC_PKG_HEAD_SIZE) return 0; rpc_pkg *pkg = data; ...
cwe
CWE-190
C/C++
package samlsp import ( "context" "encoding/xml" "errors" "io/ioutil" "net/http" "net/url" "github.com/crewjam/httperr" "github.com/crewjam/saml" ) // ParseMetadata parses arbitrary SAML IDP metadata. // // Note: this is needed because IDP metadata is sometimes wrapped in // an <EntitiesDescriptor>, and som...
cwe
CWE-287
Go
/* * PgBouncer - Lightweight connection pooler for PostgreSQL. * * Copyright (c) 2007-2009 Marko Kreen, Skype Technologies OÜ * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permissi...
vuln
Safe
C/C++
static int axff_init(struct hid_device *hid) { struct axff_device *axff; struct hid_report *report; struct hid_input *hidinput = list_first_entry(&hid->inputs, struct hid_input, list); struct list_head *report_list =&hid->report_enum[HID_OUTPUT_REPORT].report_list; struct input_dev *dev = hidinput->input; int fie...
vuln
Vulnerable
C/C++
results.push({'rkey':rkey, 'tags': getTagsFromKey(rkey), 'imgIds':rIds}); // Update the UI var $toRemove = $('tr:has(.img_panel)', $this); // For each Tag combination... (E.g. 'Metaphase'+'Dead') var topLevelTag = ""; var $td, $tr; ...
cwe
CWE-116
JavaScript
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-703
Unknown
static void construct_get_dest_keyring(struct key **_dest_keyring) { struct request_key_auth *rka; const struct cred *cred = current_cred(); struct key *dest_keyring = *_dest_keyring, *authkey; kenter("%p", dest_keyring); /* find the appropriate keyring */ if (dest_keyring) { /* the caller supplied on...
cwe
CWE-862
C/C++
int ssl_get_prev_session(SSL *s, unsigned char *session_id, int len, const unsigned char *limit) { /* This is used only by servers. */ SSL_SESSION *ret = NULL; int fatal = 0; int try_session_cache = 1; #ifndef OPENSSL_NO_TLSEXT int r; #endif if (session_id + len > limi...
cwe
CWE-190
Unknown
if (!NIL_P(exc)) { volatile VALUE eclass = rb_obj_class(exc); volatile VALUE backtrace; DUMP1("(failed)"); thr_crit_bup = rb_thread_critical; rb_thread_critical = Qtrue; DUMP1("set backtrace"); if (!NIL_P(backtrace = rb_funcallv(exc, ID_backtrace, 0, 0))) { ...
vuln
Vulnerable
Unknown
decode_NXAST_RAW_ENCAP(const struct nx_action_encap *nae, enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out) { struct ofpact_encap *encap; const struct ofp_ed_prop_header *ofp_prop; size_t props_len; uint16_t n_props = 0; int err; encap = ...
cwe
CWE-416
Unknown
n)for(v=0;v<n.length;v++)n[v].node.style.visibility=c?"visible":"hidden"};var f=mxGuide.prototype.destroy;mxGuide.prototype.destroy=function(){f.call(this);var c=this.guidesArrVer,m=this.guidesArrHor;if(null!=c){for(var n=0;n<c.length;n++)c[n].destroy();this.guidesArrVer=null}if(null!=m){for(n=0;n<m.length;n++)m[n].des...
cwe
CWE-20
JavaScript
long Segment::DoLoadClusterUnknownSize(long long& pos, long& len) { assert(m_pos < 0); assert(m_pUnknownSize); #if 0 assert(m_pUnknownSize->GetElementSize() < 0); //TODO: verify this const long long element_start = m_pUnknownSize->m_element_start; pos = -m_pos; assert(pos > element_start); lo...
vuln
Vulnerable
C/C++
0;e<this.pages.length;e++)this.updatePageRoot(this.pages[e]),this.addBasenamesForCell(this.pages[e].root,c);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),c);e=[];for(var g in c)e.push(g);return e};EditorUi.prototype.addBasenamesForCell=function(c,e){function g(v){if(null!=v){var x=v.lastIndexOf(".");0...
cwe
CWE-20
JavaScript
package org.pac4j.oidc.credentials.authenticator; import static java.util.Optional.ofNullable; import static org.pac4j.core.profile.AttributeLocation.PROFILE_ATTRIBUTE; import java.io.IOException; import java.util.Map; import org.pac4j.core.context.WebContext; import org.pac4j.core.context.session.SessionStore; impo...
vuln
Safe
Java
/* ecc-eh-to-a.c Copyright (C) 2014 Niels Möller This file is part of GNU Nettle. GNU Nettle is free software: you can redistribute it and/or modify it under the terms of either: * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the Lic...
cwe
CWE-787
C/C++
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLiteResizeNearestNeighborParams*>(node->builtin_data); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); const TfLiteTensor* siz...
cwe
CWE-125
C/C++
static inline void gen_st16(TCGv val, TCGv addr, int index) { tcg_gen_qemu_st16(val, addr, index); dead_tmp(val); }
vuln
Vulnerable
C/C++
var CC = require('config-chain').ConfigChain var inherits = require('inherits') var configDefs = require('./defaults.js') var types = configDefs.types var once = require('once') var fs = require('fs') var path = require('path') var nopt = require('nopt') var ini = require('ini') var Umask = configDefs.Umask var correct...
cwe
CWE-284
JavaScript
static long mem_seek(jas_stream_obj_t *obj, long offset, int origin) { jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj; long newpos; JAS_DBGLOG(100, ("mem_seek(%p, %ld, %d)\n", obj, offset, origin)); switch (origin) { case SEEK_SET: newpos = offset; break; case SEEK_END: newpos = m->len_ - offset; br...
vuln
Vulnerable
Unknown
void WebPImage::doWriteMetadata(BasicIo& outIo) { if (!io_->isopen()) throw Error(kerInputDataReadFailed); if (!outIo.isopen()) throw Error(kerImageWriteFailed); #ifdef EXIV2_DEBUG_MESSAGES std::cout << "Writing metadata" << std::endl; #endif byte data [WEBP_TAG_SIZE*3]; ...
cwe
CWE-703
C/C++
query_io (struct query *z, iopause_fd *x, struct taia *deadline) { dns_transmit_io (&z->dt, x, deadline); }
cwe
CWE-362
Unknown
MediaStreamDispatcherHost::~MediaStreamDispatcherHost() { DCHECK_CURRENTLY_ON(BrowserThread::IO); bindings_.CloseAllBindings(); CancelAllRequests(); }
cwe
CWE-189
C/C++
static int zrle_send_framebuffer_update(VncState *vs, int x, int y, int w, int h) { bool be = vs->client_be; size_t bytes; int zywrle_level; if (vs->zrle.type == VNC_ENCODING_ZYWRLE) { if (!vs->vd->lossy || vs->tight.quality == (uint8_t)-1 || ...
cwe
CWE-401
Unknown
def _sentry_request_response(func): # type: (Callable[[Any], Any]) -> ASGIApp old_func = func is_coroutine = _is_async_callable(old_func) if is_coroutine: async def _sentry_async_func(*args, **kwargs): # type: (*Any, **Any) -> Any hub = Hub.c...
vuln
Safe
Python
static Image *ReadSVGImage(const ImageInfo *image_info,ExceptionInfo *exception) { char filename[MagickPathExtent]; FILE *file; Image *image; int status, unique_file; ssize_t n; SVGInfo *svg_info; unsigned char message[MagickPathExtent]; xmlSAXHandler sax_modul...
vuln
Safe
C/C++
static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_op_array *new_op_array=NULL; int return_value_used; zend_free_op free_op1; zval *inc_filename = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); zval tmp_inc_filename; zend_...
vuln
Safe
Unknown
private boolean performAuth(ChannelHandlerContext ctx, String username, String password) { Authenticator authenticator = respServer.getConfiguration().authentication().authenticator(); if (authenticator == null) { return handleAuthResponse(ctx, null); } CompletionStage<Boolean> cs = aut...
vuln
Safe
Java
ffi_prep_closure_loc (ffi_closure *closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void *codeloc) { if (cif->abi != FFI_SYSV) return FFI_BAD_ABI; void (*start)(void); if (cif->flags & ...
vuln
Vulnerable
C/C++
def get(self, id, project=None): if not project: project = g.project return ( Person.query.filter(Person.id == id) .filter(Project.id == project.id) .one() )
cwe
CWE-863
Python
bool ChildProcessSecurityPolicy::CanRequestURL( int renderer_id, const GURL& url) { if (!url.is_valid()) return false; // Can't request invalid URLs. if (IsWebSafeScheme(url.scheme())) return true; // The scheme has been white-listed for every renderer. if (IsPseudoScheme(url.scheme())) { if...
vuln
Vulnerable
C/C++
/* * Dragonfly - Runtime dependency management library * Copyright (c) 2021 Joshua Sing <joshua@hypera.dev> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, in...
cwe
CWE-611
Java
@Override @SuppressWarnings("WrongConstant") protected void setValuedSetting (ListItem item, SettingView view, boolean isUpdate) { switch (item.getViewType()) { case ListItem.TYPE_RADIO_SETTING_WITH_NEGATIVE_STATE: { boolean canEdit = hasAccessToEditRight(item.getId()); ...
vuln
Vulnerable
Java
static HB_Error Lookup_MarkMarkPos( GPOS_Instance* gpi, HB_GPOS_SubTable* st, HB_Buffer buffer, HB_UShort flags, HB_UShort context_length, int nesting_level ) { HB_UShort i, j, mark1_index, mark2_index, property, class; HB_...
vuln
Safe
Unknown
void HeaderMapImpl::setCopy(const LowerCaseString& key, absl::string_view value) { if (!Runtime::runtimeFeatureEnabled( "envoy.reloadable_features.http_set_copy_replace_all_headers")) { auto entry = getExisting(key); if (!entry.empty()) { updateSize(entry[0]->value().size(), value.size()); ...
vuln
Safe
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 ...
vuln
Safe
Python
static void ctcp_msg_dcc_chat(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr, const char *target, CHAT_DCC_REC *chat) { CHAT_DCC_REC *dcc; char **params; int paramcount; int passive, autoallow = FALSE; /* CHAT <unused> <address> <port> */ /* CH...
cwe
CWE-416
Unknown
public function edit() { $currentUser = $this->User->find('first', array( 'conditions' => array('User.id' => $this->Auth->user('id')), 'recursive' => -1 )); if (empty($currentUser)) { throw new NotFoundException('Something went wrong. Your user account cou...
cwe
CWE-287
PHP
public void testCycle_ECDH_ES_Curve_P256_attackPoint1() throws Exception { ECKey ecJWK = generateECJWK(ECKey.Curve.P_256); BigInteger privateReceiverKey = ecJWK.toECPrivateKey().getS(); JWEHeader header = new JWEHeader.Builder(JWEAlgorithm.ECDH_ES, EncryptionMethod.A128GCM) .agreementPartyUInfo(B...
vuln
Vulnerable
Java
int __kvm_set_memory_region(struct kvm *kvm, struct kvm_userspace_memory_region *mem, int user_alloc) { int r; gfn_t base_gfn; unsigned long npages; unsigned long i; struct kvm_memory_slot *memslot; struct kvm_memory_slot old, new; struct kvm_memslots *slots, *old_memslots; r = check_memory_regio...
cwe
CWE-399
C/C++
net_bind(short unsigned *port, int type, const char *log_service_name) { struct addrinfo hints = { 0 }; struct addrinfo *servinfo; struct addrinfo *ptr; const char *cfgaddr; char addr[INET6_ADDRSTRLEN]; char strport[8]; int yes = 1; int no = 0; int fd; int ret; cfgaddr = cfg_getstr(cfg_getsec(cfg...
cwe
CWE-416
C/C++
ReverbConvolverStage::ReverbConvolverStage(const float* impulseResponse, size_t, size_t reverbTotalLatency, size_t stageOffset, size_t stageLength, size_t fftSize, size_t renderPhase, size_t renderSliceSize, ReverbAccumulationBuffer* accumulationBuffer, bool directMode) : ...
cwe
CWE-119
C/C++
Status PySeqToTensor(PyObject* obj, DataType dtype, Tensor* ret) { ConverterState state; TF_RETURN_IF_ERROR(InferShapeAndType(obj, &state)); DataType requested_dtype = DT_INVALID; if (dtype != DT_INVALID) { requested_dtype = dtype; } // NOTE(josh11b): If don't successfully convert to the requested type,...
cwe
CWE-20
C/C++
bool BitReaderCore::ReadBitsInternal(int num_bits, uint64_t* out) { DCHECK_GE(num_bits, 0); if (num_bits == 0) { *out = 0; return true; } if (num_bits > nbits_ && !Refill(num_bits)) { nbits_ = 0; reg_ = 0; return false; } bits_read_ += num_bits; if (num_bits == kRegWidthInBits...
cwe
CWE-908
C/C++
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % ...
cwe
CWE-399
C/C++
static void print_maps(struct pid_info_t* info) { FILE *maps; size_t offset; char device[10]; long int inode; char file[PATH_MAX]; strlcat(info->path, "maps", sizeof(info->path)); maps = fopen(info->path, "r"); if (!maps) goto out; while (fscanf(maps, "%*x-%*x ...
cwe
CWE-20
C/C++
/* -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- / /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ /* Copyright 2011 notmasteryet Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obt...
cwe
CWE-835
JavaScript
static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception) { BMPInfo bmp_info; Image *image; IndexPacket index; MagickBooleanType status; MagickOffsetType offset, start_position; MemoryInfo *pixel_info; register IndexPacket *indexes; register ...
cwe
CWE-835
C/C++
def deliver!(mail) if ::File.respond_to?(:makedirs) ::File.makedirs settings[:location] else ::FileUtils.mkdir_p settings[:location] end mail.destinations.uniq.each do |to| ::File.open(::File.join(settings[:location], to), 'a') { |f| "#{f.write(mail.encoded)}\r\n\r\n" } ...
cwe
CWE-22
Ruby
cvtchar(register const char *sp) /* convert a character to a terminfo push */ { unsigned char c = 0; int len; switch (*sp) { case '\\': switch (*++sp) { case '\'': case '$': case '\\': case '%': c = UChar(*sp); len = 2; break; case '\0': c = '\\'; len = 1; break; ca...
cwe
CWE-787
Unknown
import logging import urllib from typing import Any, Dict, List, Optional from urllib.parse import urlencode from django.conf import settings from django.contrib.auth import authenticate, get_backends from django.core import validators from django.core.exceptions import ValidationError from django.db.models import Q f...
cwe
CWE-863
Python
int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb) { int ret; int size; if (ud->side == USBIP_STUB) { /* the direction of urb must be OUT. */ if (usb_pipein(urb->pipe)) return 0; size = urb->transfer_buffer_length; } else { /* the direction of urb must be IN. */ if (usb_pipeout(urb->pipe)...
cwe
CWE-119
Unknown
static int set_expected_hash(const char *val, const struct kernel_param *kp) { int rv = param_set_uint(val, kp); ksu_invalidate_manager_uid(); pr_info("ksu_expected_hash set to %x\n", ksu_expected_hash); return rv; }
vuln
Vulnerable
C/C++
# encoding: utf-8 """An object for managing IPython profile directories.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import os import shutil import errno from pathlib import Path from traitlets.config.configurable import LoggingConfigurable from ..paths imp...
vuln
Safe
Python
smart_compare(sldns_buffer* pkt, uint8_t* dnow, uint8_t* dprfirst, uint8_t* dprlast) { if(LABEL_IS_PTR(*dnow)) { /* ptr points to a previous dname */ uint8_t* p = sldns_buffer_at(pkt, PTR_OFFSET(dnow[0], dnow[1])); if( p == dprfirst || p == dprlast ) return 0; /* prev dname is also a ptr, both ptrs are th...
vuln
Vulnerable
Unknown
int do_ssl3_write(SSL *s, int type, const unsigned char *buf, unsigned int *pipelens, unsigned int numpipes, int create_empty_fragment) { unsigned char *outbuf[SSL_MAX_PIPELINES], *plen[SSL_MAX_PIPELINES]; SSL3_RECORD wr[SSL_MAX_PIPELINES]; int i, mac_size, clear = 0; ...
cwe
CWE-20
C/C++
package jsonpatch import ( "bytes" "encoding/json" "fmt" "strconv" "strings" ) const ( eRaw = iota eDoc eAry ) type lazyNode struct { raw *json.RawMessage doc partialDoc ary partialArray which int } type operation map[string]*json.RawMessage // Patch is an ordered collection of operations. type P...
cwe
CWE-787
Go
struct resource_pool *dce112_create_resource_pool( uint8_t num_virtual_links, struct dc *dc) { struct dce110_resource_pool *pool = kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL); if (!pool) return NULL; if (construct(num_virtual_links, dc, pool)) return &pool->base; BREAK_TO_DEBUGGER(); return...
cwe
CWE-400
Unknown
read_attribute(cdk_stream_t inp, size_t pktlen, cdk_pkt_userid_t attr, int name_size) { const byte *p; byte *buf; size_t len, nread; cdk_error_t rc; if (!inp || !attr || !pktlen) return CDK_Inv_Value; if (DEBUG_PKT) _gnutls_write_log("read_attribute: %d octets\n", (int) pktlen); _gnutls_str_...
cwe
CWE-119
C/C++
public function enableCurrency(TransactionCurrency $currency) { app('preferences')->mark(); $this->repository->enable($currency); session()->flash('success', (string)trans('firefly.currency_is_now_enabled', ['name' => $currency->name])); Log::channel('audit')->info(sprintf('Enabled ...
cwe
CWE-352
PHP
function initialize() { // Our default tooltip configuration. For this, one simply needs to: // * Set `class="tippy-zulip-tooltip"` on an element for enable this. // * Set `data-tippy-content="{{t 'Tooltip content' }}"`, often // replacing a `title` attribute on an element that had both. // * Set ...
cwe
CWE-79
JavaScript
QPDF_Array::insertItem(int at, QPDFObjectHandle const& item) { // As special case, also allow insert beyond the end if ((at < 0) || (at > QIntC::to_int(this->items.size()))) { throw std::logic_error( "INTERNAL ERROR: bounds error accessing QPDF_Array element"); } this->items.insert(this->items...
vuln
Safe
Unknown
package node import ( "bytes" "context" "fmt" "net" "net/http" _ "net/http/pprof" // nolint: gosec // securely exposed on separate, optional port "os" "strings" "time" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "githu...
vuln
Vulnerable
Go
static ssize_t phys_index_show(struct device *dev, struct device_attribute *attr, char *buf) { struct memory_block *mem = to_memory_block(dev); unsigned long phys_index; phys_index = mem->start_section_nr / sections_per_block; return sysfs_emit(buf, "%08lx\n", phys_index); }
vuln
Safe
Unknown