code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
gsm_xsmp_client_disconnect (GsmXSMPClient *client) { if (client->priv->watch_id > 0) { g_source_remove (client->priv->watch_id); } if (client->priv->conn != NULL) { SmsCleanUp (client->priv->conn); } if (client->priv->ice_connection != NULL) { ...
vuln
Vulnerable
Unknown
/* +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2017 The PHP Group | +---------...
vuln
Safe
C/C++
public function onKernelResponse(ResponseEvent $event) { if (!$event->isMainRequest()) { return; } $request = $event->getRequest(); if (!$request->hasSession() || !$request->attributes->get('_security_firewall_run', false)) { return; } if ($...
vuln
Vulnerable
PHP
/** * Route Mappings * (sails.config.routes) * * Your routes tell Sails what to do each time it receives a request. * * For more information on configuring custom routes, check out: * https://sailsjs.com/anatomy/config/routes-js */ module.exports.routes = { 'POST /api/access-tokens': 'access-tokens/create', ...
vuln
Vulnerable
JavaScript
void PrintPreviewUI::OnCancelPendingPreviewRequest() { g_print_preview_request_id_map.Get().Set(id_, -1); }
vuln
Safe
C/C++
public void onParticipantLeft(Participant participant, String sessionId, Set<Participant> remainingParticipants, Integer transactionId, OpenViduException error, EndReason reason, boolean scheduleWebsocketClose) { if (error != null) { rpcNotificationService.sendErrorResponse(participant.getParticipantPrivateId(...
vuln
Safe
Java
// 2、答案。 const answers = map(item.answers, (value, index) => { // 没有作者图片时隐藏。 const classesAvatar = cs( "avatar", { "hide": isEmpty(value.avatar) } ); ...
vuln
Safe
JavaScript
static int spapr_phb_init(SysBusDevice *s) { sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s); PCIHostState *phb = PCI_HOST_BRIDGE(s); char *namebuf; int i; PCIBus *bus; sphb->dtbusname = g_strdup_printf("pci@%" PRIx64, sphb->buid); namebuf = alloca(strlen(sphb->dtbusname) + 32); spri...
vuln
Vulnerable
C/C++
static int mailimf_group_parse(const char * message, size_t length, size_t * indx, struct mailimf_group ** result) { size_t cur_token; char * display_name; struct mailimf_mailbox_list * mailbox_list; struct mailimf_group * group; int r; int res; clist * list; cur_token = * indx...
vuln
Safe
C/C++
static void vp6_parse_coeff(VP56Context *s) { VP56RangeCoder *c = s->ccp; VP56Model *model = s->modelp; uint8_t *permute = s->scantable.permutated; uint8_t *model1, *model2, *model3; int coeff, sign, coeff_idx; int b, i, cg, idx, ctx; int pt = 0; for (b=0; b<6; b++) { int ct ...
vuln
Vulnerable
C/C++
TfLiteStatus GenericPrepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input = GetInput(context, node, 0); TfLiteTensor* output = GetOutput(context, node, 0); TF_LITE_ENSURE_TYPES_EQ(context, ...
vuln
Vulnerable
C/C++
public int getHeight(){ final Object value = getFieldsMeta().get(HEIGHT_META_KEY.key()); if(value instanceof Number){ final Number numericValue = (Number) value; return numericValue.intValue(); } Logger.debug(Metadata.class, ()->String.format("Invalid non numeric ...
vuln
Safe
Java
/*! * URI.js - Mutating URLs * * Version: 1.19.3 * * Author: Rodney Rehm * Web: http://medialize.github.io/URI.js/ * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * */ (function (root, factory) { 'use strict'; // https://github.com/umdjs/umd/blob/master/returnExports.js ...
vuln
Vulnerable
JavaScript
get_cdtext_generic (void *p_user_data) { generic_img_private_t *p_env = p_user_data; uint8_t *p_cdtext_data = NULL; size_t len; if (!p_env) return NULL; if (p_env->b_cdtext_error) return NULL; if (NULL == p_env->cdtext) { p_cdtext_data = read_cdtext_generic (p_env); if (NULL != p_cdtext_data) {...
vuln
Vulnerable
Unknown
static int decode_pce(AACContext *ac, enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], GetBitContext *gb) { int num_front, num_side, num_back, num_lfe, num_assoc_data, num_cc, sampling_index; skip_bits(gb, 2); sampling_index = get_bits(gb, 4); if (ac->m4ac.sampling_index != samp...
vuln
Vulnerable
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
Vulnerable
Unknown
static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns, struct user_namespace *user_ns, struct fs_struct *fs) { struct mnt_namespace *new_ns; struct vfsmount *rootmnt = NULL, *pwdmnt = NULL; struct mount *p, *q; struct mount *old = mnt_ns->root; struct mount *new; int copy_flags; new_ns = alloc_...
vuln
Vulnerable
C/C++
void janus_videocall_setup_media(janus_plugin_session *handle) { JANUS_LOG(LOG_INFO, "[%s-%p] WebRTC media is now available\n", JANUS_VIDEOCALL_PACKAGE, handle); if(g_atomic_int_get(&stopping) || !g_atomic_int_get(&initialized)) return; janus_mutex_lock(&sessions_mutex); janus_videocall_session *session = janus_v...
vuln
Safe
C/C++
int dtls1_enc(SSL *s, int send) { SSL3_RECORD *rec; EVP_CIPHER_CTX *ds; unsigned long l; int bs,i,j,k,mac_size=0; const EVP_CIPHER *enc; if (send) { if (EVP_MD_CTX_md(s->write_hash)) { mac_size=EVP_MD_CTX_size(s->write_hash); if (mac_size < 0) return -1; } ds=s->enc_write_ctx; rec= &(s->...
vuln
Vulnerable
Unknown
static PHP_NAMED_FUNCTION(zif_zip_entry_read) { zval * zip_entry; zend_long len = 0; zip_read_rsrc * zr_rsrc; zend_string *buffer; int n = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &zip_entry, &len) == FAILURE) { return; } if ((zr_rsrc = (zip_read_rsrc *)zend_fetch_resource(Z_RES_P(zip_entry), le...
vuln
Vulnerable
C/C++
static int smacker_decode_bigtree(GetBitContext *gb, HuffContext *hc, DBCtx *ctx, int length) { if(length > 500) { av_log(NULL, AV_LOG_ERROR, "length too long\n"); return AVERROR_INVALIDDATA; } if (hc->current + 1 >= hc->length) { av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");...
vuln
Safe
C/C++
@Override protected NonNullList<ItemStack> getInput() { if (((AccessorAbstractFurnaceBlockEntity) this.getOwner()).getItems() != null) { return NonNullList.of(ItemStack.EMPTY, this.getOwner().getItem(0)); } else { return NonNullList.create(); } }
vuln
Safe
Java
int http_parse_cont_len_header(struct ist *value, unsigned long long *body_len, int not_first) { char *e, *n; unsigned long long cl; struct ist word; int check_prev = not_first; word.ptr = value->ptr - 1; // -1 for next loop's pre-increment e = value->ptr + value->len; while (++w...
vuln
Vulnerable
C/C++
static int t27(InterplayACMContext *s, unsigned ind, unsigned col) { GetBitContext *gb = &s->gb; unsigned i, b; int n1, n2, n3; for (i = 0; i < s->rows; i++) { b = get_bits(gb, 7); n1 = (mul_3x5[b] & 0x0F) - 2; n2 = ((mul_3x5[b] >> 4) & 0x0F) - 2; n3 = ((mul_3x5...
vuln
Vulnerable
C/C++
int32_t ByteArray::Get(int32_t index) { if (index < 0 || index >= Length()) return -1; return InternalGet(index) & 0xff; }
vuln
Safe
C/C++
/* * Timers abstract layer * Copyright (c) by Jaroslav Kysela <perex@perex.cz> * * * 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 you...
vuln
Vulnerable
C/C++
struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, struct ip_options *opt) { struct tcp_options_received tcp_opt; u8 *hash_location; struct inet_request_sock *ireq; struct tcp_request_sock *treq; struct tcp_sock *tp = tcp_sk(sk); const struct tcphdr *th = tcp_hdr(skb); __u32 cookie = ntoh...
vuln
Vulnerable
C/C++
protected void open(PdfVersion newPdfVersion) { this.fingerPrint = new FingerPrint(); this.encryptedEmbeddedStreamsHandler = new EncryptedEmbeddedStreamsHandler(this); try { final ITextCoreProductEvent event = ITextCoreProductEvent.createProcessPdfEvent(this.getDocumentIdWrapper(), ...
vuln
Safe
Java
@SuppressLint({"SetJavaScriptEnabled", "ClickableViewAccessibility"}) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); webappID = getIntent().getIntExtra(Const.INTENT_WEBAPPID, -1); DataManager.getInstance().loadAppData(); Util...
vuln
Vulnerable
Java
int nfc_dev_up(struct nfc_dev *dev) { int rc = 0; pr_debug("dev_name=%s\n", dev_name(&dev->dev)); device_lock(&dev->dev); if (!device_is_registered(&dev->dev)) { rc = -ENODEV; goto error; } if (dev->rfkill && rfkill_blocked(dev->rfkill)) { rc = -ERFKILL; goto error; } if (dev->fw_download_in_progre...
vuln
Vulnerable
Unknown
def computed_fields(context, obj, advanced_ui=None): """ Render all applicable links for the given object. This can also check whether the advanced_ui attribute is True or False for UI display purposes. """ fields = obj.get_computed_fields(label_as_key=True, advanced_ui=advanced_ui) if not compu...
vuln
Safe
Python
@Override public void notifyCollidingWithPortal(Entity portal) { Entity this_ = (Entity) (Object) this; collidingPortal = portal; collidingPortalActiveTickTime = tickCount;//world time may jump due to time synchroization ((Portal) portal).onCollidingWithEntity(this_); }
vuln
Vulnerable
Java
def parse_uri(self, uri): """ Parse URLs. This method fixes an issue where credentials specified in the URL are interpreted differently in Python 2.6.1+ than prior versions of Python. It also deals with the peculiarity that new-style Swift URIs have where a username can contain a...
vuln
Safe
Python
QPDFObjectHandle::newIndirect(QPDF* qpdf, int objid, int generation) { if (objid == 0) { // Special case: QPDF uses objid 0 as a sentinel for direct // objects, and the PDF specification doesn't allow for object // 0. Treat indirect references to object 0 as null so that we // ne...
vuln
Safe
Unknown
struct SwrContext *swr_alloc_set_opts(struct SwrContext *s, int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, int64_t in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, ...
vuln
Safe
C/C++
(function() { 'use strict'; exports.version = '3.0.0'; var isEqual = require('lodash.isequal'); var filterd = require('lodash.filter'); var clonedeep = require('lodash.clonedeep'); var matches = require('lodash.matches'); function RuleEngine(rules, options) { this.init(); i...
vuln
Safe
JavaScript
static void set_int32(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { DeviceState *dev = DEVICE(obj); Property *prop = opaque; int32_t *ptr = qdev_get_prop_ptr(dev, prop); Error *local_err = NULL; int64_t value; if (dev->state != DEV_STATE_CREATED) ...
vuln
Vulnerable
C/C++
Randoms() { random = new Random(); Date date = new Date(); random.setSeed(date.getTime()); }
vuln
Vulnerable
Java
status_t MediaHTTP::connect( const char *uri, const KeyedVector<String8, String8> *headers, off64_t /* offset */) { if (mInitCheck != OK) { return mInitCheck; } KeyedVector<String8, String8> extHeaders; if (headers != NULL) { extHeaders = *headers; } if (extHeaders.indexOfKey(String8("User-Agent")) ...
vuln
Safe
C/C++
long keyctl_chown_key(key_serial_t id, uid_t user, gid_t group) { struct key_user *newowner, *zapowner = NULL; struct key *key; key_ref_t key_ref; long ret; kuid_t uid; kgid_t gid; uid = make_kuid(current_user_ns(), user); gid = make_kgid(current_user_ns(), group); ret = -EINVAL; if ((user != (uid_t) -1) && ...
vuln
Vulnerable
C/C++
qedi_dbg_notice(struct qedi_dbg_ctx *qedi, const char *func, u32 line, const char *fmt, ...) { va_list va; struct va_format vaf; va_start(va, fmt); vaf.fmt = fmt; vaf.va = &va; if (!(qedi_dbg_log & QEDI_LOG_NOTICE)) goto ret; if (likely(qedi) && likely(qedi->pdev)) pr_notice("[%s]:[%s:%d]:%d: %pV", ...
vuln
Safe
C/C++
'use strict'; // @ts-check // ================================================================================== // index.js // ---------------------------------------------------------------------------------- // Description: System Information - library // for Node.js // Copyright: (c) 2014 - 202...
vuln
Safe
JavaScript
SYSCALL_DEFINE5(perf_event_open, struct perf_event_attr __user *, attr_uptr, pid_t, pid, int, cpu, int, group_fd, unsigned long, flags) { struct perf_event *group_leader = NULL, *output_event = NULL; struct perf_event *event, *sibling; struct perf_event_attr attr; struct perf_event_context *ctx, *uninitialized_...
vuln
Vulnerable
Unknown
public void setRespawnState() { respawnState.setRespawnMoney(.75f * hero.getMoney()); hero.setMoney(respawnState.getRespawnMoney()); // to update the display while the camera waits for respawn if the player died respawnState.setRespawnHull(hero.isNonTranscendent() ? hero.getHull().getHullConfig(...
vuln
Vulnerable
Java
/** * 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....
vuln
Vulnerable
Java
def do_GET(self): """This method handles the GET requests to retrieve status on agents from the Registrar Server. Currently, only agents resources are available for GETing, i.e. /agents. All other GET uri's will return errors. agents requests require a single agent_id parameter which identifies...
vuln
Vulnerable
Python
int create_user_ns(struct cred *new) { struct user_namespace *ns, *parent_ns = new->user_ns; kuid_t owner = new->euid; kgid_t group = new->egid; int ret; /* The creator needs a mapping in the parent user namespace * or else we won't be able to reasonably tell userspace who * created a user_namespace. ...
vuln
Vulnerable
C/C++
def import_requirements(project, r=None, dev=False): from pipenv.patched.notpip._vendor import requests as pip_requests from pipenv.patched.notpip._internal.req.constructors import install_req_from_parsed_requirement from pipenv.vendor.pip_shims.shims import parse_requirements # Parse requirements.txt ...
vuln
Safe
Python
def delete(self, req, id): """ Deletes the image and all its chunks from the Glance :param req: The WSGI/Webob Request object :param id: The opaque image identifier :raises HttpBadRequest if image registry is invalid :raises HttpNotFound if image or any chunk is not ava...
vuln
Vulnerable
Python
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; const uint8_t *buf_end = avpkt->data + avpkt->size; int buf_size = avpkt->size; QdrawContext * const a = avctx->priv_data; A...
vuln
Vulnerable
C/C++
jbig2_sd_release(Jbig2Ctx *ctx, Jbig2SymbolDict *dict) { int i; if (dict == NULL) return; for (i = 0; i < dict->n_symbols; i++) if (dict->glyphs[i]) jbig2_image_release(ctx, dict->glyphs[i]); jbig2_free(ctx->allocator, dict->glyphs); jbig2_free(ctx->allocator, dict);...
vuln
Vulnerable
C/C++
static bool get_build_id( Backtrace* backtrace, uintptr_t base_addr, uint8_t* e_ident, std::string* build_id) { HdrType hdr; memcpy(&hdr.e_ident[0], e_ident, EI_NIDENT); if (backtrace->Read(base_addr + EI_NIDENT, reinterpret_cast<uint8_t*>(&hdr) + EI_NIDENT, sizeof(HdrType) - EI_NIDENT) != sizeof(HdrType) - EI_...
vuln
Safe
C/C++
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input_tensor; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 0, &input_tensor)); const TfLiteTensor* padding_matrix; TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 1, &padding_matrix)); TfLiteTensor* output_te...
vuln
Safe
C/C++
void addRestApiExtensionPermissions(final ResourcesPermissionsMapping resourcesPermissionsMapping, final Properties pageProperties) { final Map<String, String> permissionsMapping = getApiExtensionResourcesPermissionsMapping( pageProperties); for (final String key : permission...
vuln
Safe
Java
static void ExpandMirrorKernelInfo(KernelInfo *kernel) { KernelInfo *clone, *last; last = kernel; clone = CloneKernelInfo(last); RotateKernelInfo(clone, 180); /* flip */ LastKernelInfo(last)->next = clone; last = clone; clone = CloneKernelInfo(last); RotateKernelInfo(clone, 90); /* transp...
vuln
Vulnerable
C/C++
public static void addDimensionalSpacing(final WorldEvent.Load event) { if (event.getWorld() instanceof ServerWorld) { ServerWorld serverWorld = (ServerWorld) event.getWorld(); ServerChunkProvider chunkProvider = serverWorld.getChunkProvider(); try { if (GETCODEC_METHOD == null) GETCODEC_METHOD = Ob...
vuln
Vulnerable
Java
static int read_request_line(request_rec *r, apr_bucket_brigade *bb) { const char *ll; const char *uri; const char *pro; unsigned int major = 1, minor = 0; /* Assume HTTP/1.0 if non-"HTTP" protocol */ char http[5]; apr_size_t len; int num_blank_lines = 0; int max_blank_lines = r->serv...
vuln
Vulnerable
Unknown
static int get_pci_config_device(QEMUFile *f, void *pv, size_t size) { PCIDevice *s = container_of(pv, PCIDevice, config); uint8_t config[size]; int i; qemu_get_buffer(f, config, size); for (i = 0; i < size; ++i) if ((config[i] ^ s->config[i]) & s->cmask[i] & ~s->wmask[i]) return...
vuln
Vulnerable
C/C++
package com.salesmanager.shop.admin.controller.shipping; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils...
vuln
Safe
Java
static int ehci_execute(EHCIPacket *p, const char *action) { USBEndpoint *ep; int endp; bool spd; assert(p->async == EHCI_ASYNC_NONE || p->async == EHCI_ASYNC_INITIALIZED); if (!(p->qtd.token & QTD_TOKEN_ACTIVE)) { fprintf(stderr, "Attempting to execute inactive qtd\n"); ...
vuln
Safe
Unknown
int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, const unsigned char *from, int flen, int num, const unsigned char *param, int plen) { int i, dblen, mlen = -1; const unsigned char *maskeddb; int lzero; unsigned char *db = NULL, seed[SHA_DIGEST_LENGTH], phash[SHA_DIGEST_LENGTH]; unsigned char *padde...
vuln
Vulnerable
Unknown
static void sig_server_connect_copy(SERVER_CONNECT_REC **dest, IRC_SERVER_CONNECT_REC *src) { IRC_SERVER_CONNECT_REC *rec; g_return_if_fail(dest != NULL); if (!IS_IRC_SERVER_CONNECT(src)) return; rec = g_new0(IRC_SERVER_CONNECT_REC, 1); rec->chat_type = IRC_PROTOCOL; rec->max_cmds_at_once = src->max_c...
vuln
Vulnerable
C/C++
import logging logger = logging.getLogger(__name__) from bottle import route, get, post, put, delete from bottle import request, response def error(code, message): response.status = code message['status'] = code return message get_user_table = lambda db: db.get_table('users', primary_id='userid', primar...
vuln
Vulnerable
Python
void md_mgf(uint8_t *key, int key_len, const uint8_t *in, int in_len) { uint32_t i, j, d; uint8_t *buffer = RLC_ALLOCA(uint8_t, in_len + sizeof(uint32_t)); uint8_t *t = RLC_ALLOCA(uint8_t, key_len + RLC_MD_LEN); if (buffer == NULL || t == NULL) { RLC_FREE(buffer); RLC_FREE(t); RLC_THROW(ERR_NO_MEMORY); r...
vuln
Vulnerable
C/C++
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) { const ASN1_TEMPLATE *tt, *errtt = NULL; const ASN1_COMPAT_FUNCS *cf; const ASN1_EXTERN_FUNCS *ef; const ASN1_AUX *aux...
vuln
Vulnerable
Unknown
GlyphCache::Loader::Loader(const Face & face, const bool dumb_font) : _head(face, Tag::head), _hhea(face, Tag::hhea), _hmtx(face, Tag::hmtx), _glyf(face, Tag::glyf), _loca(face, Tag::loca), _long_fmt(false), _has_boxes(false), _num_glyphs_graphics(0), _num_glyphs_attributes(0), _num_attrs(0) { if ...
vuln
Vulnerable
C/C++
private void addAssignmentsForOtherFieldsOfUnionForLhsCompositeType( final CExpression newLhs, final CCompositeType newLhsType, final CType rhsType, final Expression rhsExpression, final CExpressionVisitorWithPointerAliasing lhsVisitor, CCompositeTypeMemberDeclaration member, f...
vuln
Vulnerable
Java
static void slirp_hostfwd(SlirpState *s, Monitor *mon, const char *redir_str, int legacy_format) { struct in_addr host_addr = { .s_addr = INADDR_ANY }; struct in_addr guest_addr = { .s_addr = 0 }; int host_port, guest_port; const char *p; char buf[256]; int is_udp; ...
vuln
Vulnerable
C/C++
static int srpt_rx_mgmt_fn_tag(struct srpt_send_ioctx *ioctx, u64 tag) { struct srpt_device *sdev; struct srpt_rdma_ch *ch; struct srpt_send_ioctx *target; int ret, i; ret = -EINVAL; ch = ioctx->ch; BUG_ON(!ch); BUG_ON(!ch->sport); sdev = ch->sport->sdev; BUG_ON(!sdev); spin_lock_irq(&sdev->spinlock); for (...
vuln
Vulnerable
C/C++
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 = -EINVAL; /* Gener...
vuln
Safe
C/C++
def generate(length, numbers=False, symbols=False, uppercase=False, lowercase=False, space=False, save=False): password = '' if numbers is True: password += secrets.choice(string.digits) if symbols is True: password += secrets.choice(string.punctuation...
vuln
Safe
Python
SPL_METHOD(SplObjectStorage, serialize) { spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); spl_SplObjectStorageElement *element; zval members, *pmembers, *flags; HashPosition pos; php_serialize_data_t var_hash; smart_str buf = {0}; if (zend_parse_par...
vuln
Safe
Unknown
public User getUser() throws IllegalStateException { Organization org = getOrganization(); if (org == null) throw new IllegalStateException("No organization is set in security context"); User delegatedUser = delegatedUserHolder.get(); if (delegatedUser != null) { return delegatedUser; ...
vuln
Vulnerable
Java
void UTFstring::UpdateFromUTF8() { delete [] _Data; // find the size of the final UCS-2 string size_t i; const size_t SrcLength = UTF8string.length(); for (_Length=0, i=0; i<SrcLength; _Length++) { const unsigned int CharLength = UTFCharLength(static_cast<uint8>(UTF8string[i])); if ((CharLength >= 1) ...
vuln
Safe
C/C++
static void virtio_pci_start_ioeventfd(VirtIOPCIProxy *proxy) { int n, r; if (!(proxy->flags & VIRTIO_PCI_FLAG_USE_IOEVENTFD) || proxy->ioeventfd_disabled || proxy->ioeventfd_started) { return; } for (n = 0; n < VIRTIO_PCI_QUEUE_MAX; n++) { if (!virtio_queue_get_num(proxy...
vuln
Safe
C/C++
int ssl3_get_key_exchange(SSL *s) { #ifndef OPENSSL_NO_RSA unsigned char *q,md_buf[EVP_MAX_MD_SIZE*2]; #endif EVP_MD_CTX md_ctx; unsigned char *param,*p; int al,j,ok; long i,param_len,n,alg_k,alg_a; EVP_PKEY *pkey=NULL; const EVP_MD *md = NULL; #ifndef OPENSSL_NO_RSA RSA *rsa=NULL; #endif #ifndef OPENSSL_NO_DH...
vuln
Vulnerable
Unknown
@Override public void onRequiemInitialize() { registerEtherealEventHandlers(); registerPossessionEventHandlers(); ReclamationStatusEffect.registerEventHandlers(); CanCurePossessedCallback.EVENT.register((body) -> { CurableEntityComponent curableEntityComponent = CurableEn...
vuln
Vulnerable
Java
ecc_gostdsa_verify (const struct ecc_curve *ecc, const mp_limb_t *pp, /* Public key */ size_t length, const uint8_t *digest, const mp_limb_t *rp, const mp_limb_t *sp, mp_limb_t *scratch) { /* Procedure, according to GOST R 34.10. q denotes the group order. 1. Check 0 < r, s < q. 2. v ...
vuln
Vulnerable
Unknown
static void do_free_publickey(struct ecc_public_key *s) { if (!s) return; crypto_bignum_free(&s->x); crypto_bignum_free(&s->y); }
vuln
Safe
C/C++
/************************************************************************* This project implements a complete(!) JPEG (Recommendation ITU-T T.81 | ISO/IEC 10918-1) codec, plus a library that can be used to encode and decode JPEG streams. It also implements ISO/IEC 18477 aka JPEG XT which is an extensi...
vuln
Safe
C/C++
static int fuse_fsync(struct file *file, loff_t start, loff_t end, int datasync) { struct inode *inode = file->f_mapping->host; struct fuse_conn *fc = get_fuse_conn(inode); int err; if (is_bad_inode(inode)) return -EIO; inode_lock(inode); /* * Start writeback against all dirty pages of the inode, t...
vuln
Vulnerable
Unknown
@Override public boolean mouseScrolled(double mouseX, double mouseY, double delta) { if(this.scalingChestScreen.handleMouseScrolled(mouseX, mouseY, delta)) { return false; } return super.mouseScrolled(mouseX, mouseY, delta); }
vuln
Vulnerable
Java
public void unzip(InputStream stream, File toDir) throws IOException { ZipInputStream in = new ZipInputStream(stream); ZipEntry entry = in.getNextEntry(); while (entry != null) { File file = new File(toDir, entry.getName()); if (!file.toPath().normalize().startsWith(toDir.toPath().normalize())) ...
vuln
Safe
Java
static av_cold int vp3_decode_init(AVCodecContext *avctx) { Vp3DecodeContext *s = avctx->priv_data; int i, inter, plane; int c_width; int c_height; int y_fragment_count, c_fragment_count; if (avctx->codec_tag == MKTAG('V','P','3','0')) s->version = 0; else s->version = 1; ...
vuln
Vulnerable
C/C++
int avpriv_lock_avformat(void) { return ff_mutex_lock(&avformat_mutex) ? -1 : 0; }
vuln
Safe
C/C++
static inline int available_samples(AVFrame *out) { int bytes_per_sample = av_get_bytes_per_sample(out->format); int samples = out->linesize[0] / bytes_per_sample; if (av_sample_fmt_is_planar(out->format)) { return samples; } else { int channels = av_get_channel_layout_nb_channels(out->c...
vuln
Vulnerable
C/C++
static ssize_t flush_buf(VirtIOSerialPort *port, const uint8_t *buf, ssize_t len) { VirtConsole *vcon = VIRTIO_CONSOLE(port); ssize_t ret; if (!vcon->chr) { return len; } ret = qemu_chr_fe_write(vcon->chr, buf, len); trace_virtio_console_flush_buf(port->...
vuln
Vulnerable
C/C++
void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) { int need_software_tstamp = sock_flag(sk, SOCK_RCVTSTAMP); struct scm_timestamping tss; int empty = 1; struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb); /* Race occurred between timestamp enabling and packet ...
vuln
Vulnerable
Unknown
/* * Copyright (c) 2004-2021, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this * list of cond...
vuln
Safe
Java
static struct port_buffer *get_inbuf(struct port *port) { struct port_buffer *buf; unsigned int len; if (port->inbuf) return port->inbuf; buf = virtqueue_get_buf(port->in_vq, &len); if (buf) { buf->len = min_t(size_t, len, buf->size); buf->offset = 0; port->stats.bytes_received += len; } return buf; }
vuln
Safe
C/C++
private void load_prefs(){ SharedPreferences prefs = get_prefs(); this.runOnUiThread(() -> { binding.editIpAddr.setText(prefs.getString("ip", "")); binding.editPort.setText(String.valueOf(prefs.getInt("port", 6969))); binding.autodiscover.setChecked(prefs.getBoolean(...
vuln
Safe
Java
/* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** * \file buffers.c * \brief Implements a generic interface buffer. Buff...
vuln
Safe
C/C++
pci_lintr_route(struct pci_vdev *dev) { struct businfo *bi; struct intxinfo *ii; if (dev->lintr.pin == 0) return; bi = pci_businfo[dev->bus]; assert(bi != NULL); ii = &bi->slotinfo[dev->slot].si_intpins[dev->lintr.pin - 1]; /* * Attempt to allocate an I/O APIC pin for this intpin if one * is not yet ass...
vuln
Vulnerable
C/C++
static int llcp_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags) { int noblock = flags & MSG_DONTWAIT; struct sock *sk = sock->sk; unsigned int copied, rlen; struct sk_buff *skb, *cskb; int err = 0; pr_debug("%p %zu\n", sk, len); lock_sock(sk); if (sk->...
vuln
Safe
Unknown
static void set_frame_data(MIContext *mi_ctx, int alpha, AVFrame *avf_out) { int x, y, plane; for (plane = 0; plane < mi_ctx->nb_planes; plane++) { int width = avf_out->width; int height = avf_out->height; int chroma = plane == 1 || plane == 2; for (y = 0; y < height; y++) ...
vuln
Safe
C/C++
spnego_gss_get_mic_iov_length(OM_uint32 *minor_status, gss_ctx_id_t context_handle, gss_qop_t qop_req, gss_iov_buffer_desc *iov, int iov_count) { spnego_gss_ctx_id_t sc = (spnego_gss_ctx_id_t)context_handle; if (sc->ctx_handle == GSS_C_NO_CONTEXT) return (GSS_S_NO_CONTEXT); return g...
vuln
Safe
C/C++
''' SPDX-License-Identifier: Apache-2.0 Copyright 2017 Massachusetts Institute of Technology. ''' import os from keylime import keylime_logging from keylime import cmd_exec from keylime import config logger = keylime_logging.init_logging('secure_mount') # Store the mounted directories done by Keylime, so we can unm...
vuln
Safe
Python
void helper_rdmsr(void) { uint64_t val; helper_svm_check_intercept_param(SVM_EXIT_MSR, 0); switch((uint32_t)ECX) { case MSR_IA32_SYSENTER_CS: val = env->sysenter_cs; break; case MSR_IA32_SYSENTER_ESP: val = env->sysenter_esp; break; case MSR_IA32_SYSENTER_EIP: ...
vuln
Safe
C/C++
def on_invite_request(self, origin, content, room_version): if room_version not in KNOWN_ROOM_VERSIONS: raise SynapseError( 400, "Homeserver does not support this room version", Codes.UNSUPPORTED_ROOM_VERSION, ) format_ver = room_v...
vuln
Safe
Python
@PUT @ManagedAsync @ApiOperation( value = "Replace data at a path in a document", notes = "Removes whatever was previously present at the path") @ApiResponses( value = { @ApiResponse(code = 200, message = "OK", response = WriteDocResponse.class), @ApiResponse(code = 400, message ...
vuln
Safe
Java