code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
'use strict'; const Stream = require('stream').Stream; const fetch = require('../fetch'); const crypto = require('crypto'); const shared = require('../shared'); /** * XOAUTH2 access_token generator for Gmail. * Create client ID for web applications in Google API console to use it. * See Offline Access for receivin...
vuln
Vulnerable
Java
static int exif_scan_JPEG_header(image_info_type *ImageInfo) { int section, sn; int marker = 0, last_marker = M_PSEUDO, comment_correction=1; int ll, lh; unsigned char *Data; size_t fpos, size, got, itemlen; jpeg_sof_info sof_info; for(section=0;;section++) { // get marker byte, swallowing possible ...
vuln
Vulnerable
C/C++
static void _rpc_prolog(slurm_msg_t *msg) { int rc = SLURM_SUCCESS; prolog_launch_msg_t *req = (prolog_launch_msg_t *)msg->data; job_env_t job_env; bool first_job_run; uid_t req_uid; if (req == NULL) return; req_uid = g_slurm_auth_get_uid(msg->auth_cred, conf->auth_info); if (!_slurm_authorized_user(...
vuln
Safe
Unknown
void register_avcodec(AVCodec *codec) { AVCodec **p; p = &first_avcodec; while (*p != NULL) p = &(*p)->next; *p = codec; codec->next = NULL; }
vuln
Vulnerable
C/C++
/* * MinIO Cloud Storage, (C) 2016-2019 MinIO, 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 applicab...
vuln
Safe
Go
/* * Copyright 2017-2019 original authors * * 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 agre...
vuln
Safe
Java
public void onDrawerClosed(View view) { Log.i("Drawer closed"); if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) return; owner.stop(); drawerLayout.setDrawerLockMode(LOCK_MODE_UNLOCKED); childC...
vuln
Safe
Java
static int sha256_password_authenticate(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info) { uchar *pkt; int pkt_len; char *user_salt_begin; char *user_salt_end; char scramble[SCRAMBLE_LENGTH + 1]; char stage2[CRYPT_MAX_PASSWORD_SIZE + 1]; String scramble_respon...
vuln
Vulnerable
Unknown
static int alloc_cluster_link_l2(BlockDriverState *bs, uint64_t cluster_offset, QCowL2Meta *m) { BDRVQcowState *s = bs->opaque; int i, j = 0, l2_index, ret; uint64_t *old_cluster, start_sect, l2_offset, *l2_table; if (m->nb_clusters == 0) return 0; old_cluster = qemu_malloc(m->nb_clu...
vuln
Safe
C/C++
xmlXPtrNewRangeNodePoint(xmlNodePtr start, xmlXPathObjectPtr end) { xmlXPathObjectPtr ret; if (start == NULL) return(NULL); if (end == NULL) return(NULL); if (start->type != XPATH_POINT) return(NULL); if (end->type != XPATH_POINT) return(NULL); ret = xmlXPtrNewRangeInternal(start, -1, end-...
vuln
Safe
Unknown
int detach_capi_ctr(struct capi_ctr *ctr) { int err = 0; mutex_lock(&capi_controller_lock); ctr_down(ctr, CAPI_CTR_DETACHED); if (ctr->cnr < 1 || ctr->cnr - 1 >= CAPI_MAXCONTR) { err = -EINVAL; goto unlock_out; } if (capi_controller[ctr->cnr - 1] != ctr) { err = -EINVAL; goto unlock_out; } capi_cont...
vuln
Safe
C/C++
EmitRange(NCURSES_SP_DCLx const NCURSES_CH_T *ntext, int num) { int i; TR(TRACE_CHARPUT, ("EmitRange %d:%s", num, _nc_viscbuf(ntext, num))); if (erase_chars || repeat_char) { while (num > 0) { int runcount; NCURSES_CH_T ntext0; while (num > 1 && !CharEq(ntext[0], ntext[1])) { PutChar(NC...
vuln
Safe
Unknown
krb5_gss_wrap_size_limit(minor_status, context_handle, conf_req_flag, qop_req, req_output_size, max_input_size) OM_uint32 *minor_status; gss_ctx_id_t context_handle; int conf_req_flag; gss_qop_t qop_req; OM_uint32 req_outp...
vuln
Safe
C/C++
static int dot_product(const int16_t *a, const int16_t *b, int length) { int i, sum = 0; for (i = 0; i < length; i++) { int64_t prod = av_clipl_int32(MUL64(a[i], b[i]) << 1); sum = av_clipl_int32(sum + prod); } return sum; }
vuln
Vulnerable
C/C++
static int tls_construct_cke_ecdhe(SSL *s, unsigned char **p, int *len, int *al) { #ifndef OPENSSL_NO_EC unsigned char *encodedPoint = NULL; int encoded_pt_len = 0; EVP_PKEY *ckey = NULL, *skey = NULL; skey = s->s3->peer_tmp; if (skey == NULL) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_ECDHE, ERR_R_I...
vuln
Vulnerable
C/C++
var onlink = function () { if (win32) return next() // skip links on win for now before it can be tested xfs.unlink(name, function () { var srcpath = path.resolve(cwd, header.linkname) xfs.link(srcpath, name, function (err) { if (err && err.code === 'EPERM' && opts.hardlinkAsFiles...
vuln
Vulnerable
JavaScript
'use strict' const { AsyncResource } = require('async_hooks') const lru = require('tiny-lru').lru const secureJson = require('secure-json-parse') const { kDefaultJsonParse, kContentTypeParser, kBodyLimit, kRequestPayloadStream, kState, kTestInternals, kReplyIsError, kRouteContext } = require('./symbol...
vuln
Vulnerable
JavaScript
resolve_op_from_commit (FlatpakTransaction *self, FlatpakTransactionOperation *op, const char *checksum, GFile *sideload_path, GVariant *commit_data, GError **error) { g_autoptr(GBytes) metadata_byt...
vuln
Safe
C/C++
Unpickler_set_memo(UnpicklerObject *self, PyObject *obj) { PyObject **new_memo; size_t new_memo_size = 0; if (obj == NULL) { PyErr_SetString(PyExc_TypeError, "attribute deletion is not supported"); return -1; } if (Py_TYPE(obj) == &UnpicklerMemoProxyType) { ...
vuln
Safe
C/C++
new_msg_lsa_change_notify (u_char msgtype, u_int32_t seqnum, struct in_addr ifaddr, struct in_addr area_id, u_char is_self_originated, struct lsa_header *data) { u_char buf[OSPF_API_MAX_MSG_SIZE]; struct msg_lsa_change_notify *nmsg; int len; assert (data); nmsg = (struct msg_lsa_chan...
vuln
Vulnerable
C/C++
@SuppressWarnings("unchecked") @Override public <T extends Source> T getSource(Class<T> sourceClass) throws SQLException { try { if (isDebugEnabled()) { debugCode( "getSource(" + (sourceClass != null ? sourceClass.getSimpleName() + ".class" : "null") +...
vuln
Vulnerable
Java
int special(DviContext *dvi, int opcode) { char *s; Int32 arg; arg = dugetn(dvi, opcode - DVI_XXX1 + 1); s = mdvi_malloc(arg + 1); dread(dvi, s, arg); s[arg] = 0; mdvi_do_special(dvi, s); SHOWCMD((dvi, "XXXX", opcode - DVI_XXX1 + 1, "[%s]", s)); mdvi_free(s); return 0; }
vuln
Vulnerable
Unknown
processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq, struct iter_env* ie, int id) { int dnsseclame = 0; enum response_type type; iq->num_current_queries--; if(!inplace_cb_query_response_call(qstate->env, qstate, iq->response)) log_err("unable to call query_response callback"); if(iq->re...
vuln
Safe
Unknown
juniper_mlfr_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { struct juniper_l2info_t l2info; l2info.pictype = DLT_JUNIPER_MLFR; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; p+=l2info....
vuln
Safe
C/C++
static void virtio_pci_reset(void *opaque) { VirtIOPCIProxy *proxy = opaque; virtio_reset(proxy->vdev); msix_reset(&proxy->pci_dev); }
vuln
Vulnerable
C/C++
protected void scheduleNextPicture() { if (mContext != null && mAlarmMgr != null) { Intent intent = new Intent(mContext, PowerSavingReceiver.class); PendingIntent alarmIntent = PendingIntent.getBroadcast(mContext, 0, intent, PendingIntent.FLAG_IMMUTABLE); long diffTime = SystemClock.elapsedRealtime() -...
vuln
Safe
Java
/* 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...
vuln
Vulnerable
Python
void FileReaderLoader::OnCalculatedSize(uint64_t total_size, uint64_t expected_content_size) { OnStartLoading(expected_content_size); if (expected_content_size == 0) { received_all_data_ = true; return; } if (IsSyncLoad()) { OnDataPipeReadable(MOJO_RESUL...
vuln
Vulnerable
C/C++
sendpacket_t * sendpacket_open(const char *device, char *errbuf, tcpr_dir_t direction, sendpacket_type_t _U_ sendpacket_type, void _U_ *arg) { sendpacket_t *sp; struct stat sdata; assert(device); assert(errbuf); errbuf[0] = '\0'; /* khial is universal */ if (stat(device, &sdata) ==...
vuln
Safe
C/C++
private void setMasterMuteInternal(boolean mute, int flags, String callingPackage, int uid, int userId) { // If we are being called by the system check for user we are going to change // so we handle user restrictions correctly. if (uid == android.os.Process.SYSTEM_UID) { ...
vuln
Vulnerable
Java
/** * OLAT - Online Learning and Training<br> * http://www.olat.org * <p> * Licensed under the Apache License, Version 2.0 (the "License"); <br> * you may not use this file except in compliance with the License.<br> * You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unl...
vuln
Vulnerable
Java
static void serial_update_parameters(SerialState *s) { int speed, parity, data_bits, stop_bits, frame_size; QEMUSerialSetParams ssp; if (s->divider == 0) return; /* Start bit. */ frame_size = 1; if (s->lcr & 0x08) { /* Parity bit. */ frame_size++; if (s->lcr & 0...
vuln
Vulnerable
Unknown
static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size, int parse_extradata) { AVCodecContext *const avctx = h->avctx; H264SliceContext *sl; int buf_index; unsigned context_count; int next_avc; int nals_needed = 0; int nal_index; int idr...
vuln
Safe
C/C++
static void exynos4210_ltick_recalc_count(struct tick_timer *s) { uint64_t to_count; if ((s->cnt_run && s->last_tcnto) || (s->int_run && s->last_icnto)) { if (s->last_tcnto) { to_count = s->last_tcnto * s->last_icnto; } else { to_count = s->last_icnto; } ...
vuln
Vulnerable
C/C++
chunk_grow(chunk_t *chunk, size_t sz) { off_t offset; const size_t memlen_orig = chunk->memlen; const size_t orig_alloc = CHUNK_ALLOC_SIZE(memlen_orig); const size_t new_alloc = CHUNK_ALLOC_SIZE(sz); tor_assert(sz > chunk->memlen); offset = chunk->data - chunk->mem; chunk = tor_realloc(chunk, new_alloc); ...
vuln
Safe
C/C++
static void decode_gray_bitstream(HYuvContext *s, int count) { int i; OPEN_READER(re, &s->gb); count /= 2; if (count >= (get_bits_left(&s->gb)) / (32 * 2)) { for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) { READ_2PIX(s->temp[0][2 * i], s->temp[0][2 * i + 1], 0); } ...
vuln
Vulnerable
C/C++
MagickExport Image *DistortImage(const Image *image,DistortImageMethod method, const size_t number_arguments,const double *arguments, MagickBooleanType bestfit,ExceptionInfo *exception) { #define DistortImageTag "Distort/Image" double *coeff, output_scaling; Image *distort_image; RectangleInfo...
vuln
Safe
Unknown
/* mboxlist.c -- Mailbox list manipulation routines * * Copyright (c) 1994-2008 Carnegie Mellon University. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of sourc...
vuln
Safe
C/C++
static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags) { struct dentry *dir; int dir_has_key, cached_with_key; if (flags & LOOKUP_RCU) return -ECHILD; dir = dget_parent(dentry); if (!d_inode(dir)->i_sb->s_cop->is_encrypted(d_inode(dir))) { dput(dir); return 0; } /* this should eventu...
vuln
Safe
Unknown
async def _map_userinfo_to_user( self, userinfo: UserInfo, token: Token, user_agent: str, ip_address: str ) -> str: """Maps a UserInfo object to a mxid. UserInfo should have a claim that uniquely identifies users. This claim is usually `sub`, but can be configured with `oidc_config....
vuln
Vulnerable
Python
// Code generated by go-swagger; DO NOT EDIT. // This file is part of MinIO Console Server // Copyright (c) 2021 MinIO, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either ...
vuln
Safe
Go
inlineTokens(src, tokens = [], inLink = false, inRawBlock = false) { let token; // String with links masked to avoid interference with em and strong let maskedSrc = src; let match; let keepPrevChar, prevChar; // Mask out reflinks if (this.tokens.links) { const links = Object.keys(thi...
vuln
Vulnerable
JavaScript
/***************************************************************** | | AP4 - hdlr Atoms | | Copyright 2002-2008 Axiomatic Systems, LLC | | | This file is part of Bento4/AP4 (MP4 Atom Processing Library). | | Unless you have obtained Bento4 under a difference license, | this version of Bento4 is Bento4|G...
vuln
Vulnerable
C/C++
TPMT_TK_HASHCHECK_Unmarshal(TPMT_TK_HASHCHECK *target, BYTE **buffer, INT32 *size) { TPM_RC rc = TPM_RC_SUCCESS; if (rc == TPM_RC_SUCCESS) { rc = TPM_ST_Unmarshal(&target->tag, buffer, size); } if (rc == TPM_RC_SUCCESS) { if (target->tag != TPM_ST_HASHCHECK) { rc = TPM_RC_TAG; } } if (r...
vuln
Vulnerable
Unknown
int main(int argc, char **argv) { int result; int error = FALSE; int display_license = FALSE; int display_help = FALSE; int c = 0; struct tm *tm, tm_s; time_t now; char datestring[256]; nagios_macros *mac; const char *worker_socket = NULL; int i; #ifdef HAVE_SIGACTION struct sigaction sig_action; #endif #i...
vuln
Safe
C/C++
/** * OLAT - Online Learning and Training<br> * http://www.olat.org * <p> * Licensed under the Apache License, Version 2.0 (the "License"); <br> * you may not use this file except in compliance with the License.<br> * You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unl...
vuln
Vulnerable
Java
php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, ...
vuln
Vulnerable
C/C++
void ff_generate_sliding_window_mmcos(H264Context *h) { MpegEncContext * const s = &h->s; assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count); h->mmco_index= 0; if(h->short_ref_count && h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count && !(FIELD_PICTURE &...
vuln
Vulnerable
C/C++
int ssl3_send_client_key_exchange(SSL *s) { unsigned char *p,*d; int n; unsigned long alg_k; #ifndef OPENSSL_NO_RSA unsigned char *q; EVP_PKEY *pkey=NULL; #endif #ifndef OPENSSL_NO_KRB5 KSSL_ERR kssl_err; #endif /* OPENSSL_NO_KRB5 */ #ifndef OPENSSL_NO_ECDH EC_KEY *clnt_ecdh = NULL; const EC_POINT *srvr_ecpoin...
vuln
Vulnerable
Unknown
private void checkProccessesStopped(final List<String> pids){ Thread check = new Thread( new Runnable() { @Override public void run() { for(String processId: pids) { boolean exist = true; int times = 0; do { exist = checkProcessorExist(processId); times ++; logger.info("Pr...
vuln
Safe
Java
/* * 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
/************************************************************************ * 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
static int xfrm_expand_policies(const struct flowi *fl, u16 family, struct xfrm_policy **pols, int *num_pols, int *num_xfrms) { int i; if (*num_pols == 0 || !pols[0]) { *num_pols = 0; *num_xfrms = 0; return 0; } if (IS_ERR(pols[0])) return PTR_ERR(pols[0]); *num_xfrms = pols[0]->xfrm_nr; #ifdef ...
vuln
Vulnerable
C/C++
Status ConvBackpropComputeDimensionsV2( StringPiece label, int num_spatial_dims, const TensorShape& input_shape, const TensorShape& filter_shape, const TensorShape& out_backprop_shape, const gtl::ArraySlice<int32>& dilations, const std::vector<int32>& strides, Padding padding, absl::Span<const int64> ex...
vuln
Vulnerable
C/C++
def _add_callback_to_queue(self, request: CallbackRequest): # requests are sent by dag processors. SLAs exist per-dag, but can be generated once per SLA-enabled # task in the dag. If treated like other callbacks, SLAs can cause feedback where a SLA arrives, # goes to the front of the queue, gets...
vuln
Safe
Python
private Optional<Shard> convertToShard(JsonValue value, Map<String, String> idToAddress) { JsonObject object = value.asObject(); // TODO IndexShardState.STARTED but this is deeply inside elastic, should we mirror the enum? if ("STARTED".equals(object.get("state").asString())) { Strin...
vuln
Safe
Java
def redirect(redirect_path, redirect_params=None, **kw): """Redirect (via cherrypy.HTTPRedirect). Raises the exception instead of returning it, this to allow users to both call it as a function or to raise it as an exception. """ if not isinstance(redirect_path, basestring): redirect_path ...
vuln
Vulnerable
Python
mp_err s_mp_mul_high_digs_fast(const mp_int *a, const mp_int *b, mp_int *c, int digs) { int olduse, pa, ix, iz; mp_err err; mp_digit W[MP_WARRAY]; mp_word _W; if (digs < 0) { return MP_VAL; } /* grow the destination as required */ pa = a->used + b->used; if (c->alloc < pa) { ...
vuln
Safe
C/C++
/* Copyright 2021 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
void helper_st_asi(target_ulong addr, target_ulong val, int asi, int size) { #ifdef DEBUG_ASI dump_asi("write", addr, asi, size, val); #endif asi &= 0xff; if ((asi < 0x80 && (env->pstate & PS_PRIV) == 0) || (cpu_has_hypervisor(env) && asi >= 0x30 && asi < 0x80 && !(env->hpsta...
vuln
Safe
C/C++
@PayloadRoot(localPart = "AddManufacturerRequest", namespace = NAMESPACE) @ResponsePayload public AddManufacturerResponse addManufacturer( @OrganisationIdentification final String organisationIdentification, @RequestPayload final AddManufacturerRequest request) throws OsgpException { LOGGER.i...
vuln
Vulnerable
Java
eval_next_line(char_u *arg, evalarg_T *evalarg) { garray_T *gap = &evalarg->eval_ga; char_u *line; if (arg != NULL) { if (*arg == NL) return newline_skip_comments(arg); // Truncate before a trailing comment, so that concatenating the lines // won't turn the rest into a comment. if (*skipwhite(...
vuln
Vulnerable
C/C++
static inline void gen_op_arith_subf(DisasContext *ctx, TCGv ret, TCGv arg1, TCGv arg2, bool add_ca, bool compute_ca, bool compute_ov, bool compute_rc0) { TCGv t0 = ret; if (compute_ca || compute_ov) { t0 = tcg_temp_new(); } ...
vuln
Safe
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 8...
vuln
Safe
JavaScript
static Image *ReadOneDJVUImage(LoadContext* lc,const int pagenum, const ImageInfo *image_info,ExceptionInfo *exception) { ddjvu_page_type_t type; ddjvu_pageinfo_t info; ddjvu_message_t *message; Image *image; int logging; int tag; MagickBooleanType status; /* so, we know that the pag...
vuln
Safe
C/C++
struct Address * new_address(const char *hostname_or_ip) { union { struct sockaddr a; struct sockaddr_in in; struct sockaddr_in6 in6; struct sockaddr_un un; struct sockaddr_storage s; } s; char ip_buf[ADDRESS_BUFFER_SIZE]; char *port; size_t len; if (host...
vuln
Safe
C/C++
static int read_password(char *buf, int buf_size) { int c, i; printf("Password: "); fflush(stdout); i = 0; for(;;) { c = getchar(); if (c < 0) { buf[i] = '\0'; return -1; } else if (c == '\n') { break; } else if (i < (buf_size - 1))...
vuln
Safe
C/C++
nm_gconf_read_connection (GConfClient *client, const char *dir) { ReadFromGConfInfo info; GSList *list; GError *err = NULL; list = gconf_client_all_dirs (client, dir, &err); if (err) { g_warning ("Error while reading connection: %s", err->message); g_error_free (err); return NULL; ...
vuln
Vulnerable
Unknown
document.addEventListener("DOMContentLoaded", function(event) { var tool = { offset: function (node) { var rect = node.getBoundingClientRect() return { top: rect.top, left: rect.left } } } var mlt = 'Multiple embed instance...
vuln
Vulnerable
JavaScript
public int getHonedCount(ItemStack itemStack) { return NBTHelper.getTag(itemStack).getInt(honeCountKey); }
vuln
Vulnerable
Java
static int amr_read_packet(AVFormatContext *s, AVPacket *pkt) { AVCodecContext *enc = s->streams[0]->codec; int read, size, toc, mode; if (url_feof(&s->pb)) { return AVERROR_IO; } toc=get_byte(&s->pb); mode = (toc >> 3) & 0x0F; if (enc->codec_id == CODEC...
vuln
Vulnerable
C/C++
static int yop_read_header(AVFormatContext *s) { YopDecContext *yop = s->priv_data; AVIOContext *pb = s->pb; AVCodecContext *audio_dec, *video_dec; AVStream *audio_stream, *video_stream; int frame_rate, ret; audio_stream = avformat_new_stream(s, NULL); video_stream = avformat_new_stream(s, ...
vuln
Safe
C/C++
/* * 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 version. * * This program is distributed in the hope that it will be use...
vuln
Vulnerable
C/C++
(function() { // Adds Arrow shapes with control points Sidebar.prototype.addUml25Palette = function() { // Avoids having to bind all functions to "this" var sb = this; // Reusable cells var field = new mxCell('+ field: type', new mxGeometry(0, 0, 100, 26), 'text;strokeColor=none;fillColor=none;align=left;ve...
vuln
Safe
Java
static void esp_do_dma(ESPState *s) { uint32_t len; int to_device; len = s->dma_left; if (s->do_cmd) { trace_esp_do_dma(s->cmdlen, len); assert (s->cmdlen <= sizeof(s->cmdbuf) && len <= sizeof(s->cmdbuf) - s->cmdlen); s->dma_memory_read(s->dma_opaque, &s->cmdbuf[...
vuln
Safe
Unknown
/* 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...
vuln
Safe
Python
static int replmd_name_modify(struct replmd_replicated_request *ar, struct ldb_request *req, struct ldb_dn *dn) { struct ldb_message *msg; const char *rdn_name; const struct ldb_val *rdn_val; const struct dsdb_attribute *rdn_attr; int ret; msg = ldb_msg_new(req); if (msg == NULL) { goto failed; } m...
vuln
Safe
Unknown
static int ext4_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata) { handle_t *handle = ext4_journal_current_handle(); struct inode *inode = mapping->host; loff_t old_size = inode->i_size; int ret = 0, ret2; int i_s...
vuln
Safe
Unknown
public static FluidVeinWorldEntry getFluidVeinWorldEntry(World world, int chunkX, int chunkZ) { if (world.isRemote) return null; Random random = new XSTR(31 * 31 * chunkX + chunkZ * 31 + Long.hashCode(world.getSeed())); ChunkPosDimension coords = new ChunkPosDimension(world.provide...
vuln
Vulnerable
Java
static bool check_allocations(ASS_Shaper *shaper, size_t new_size) { if (new_size > shaper->n_glyphs) { if (!ASS_REALLOC_ARRAY(shaper->event_text, new_size) || !ASS_REALLOC_ARRAY(shaper->ctypes, new_size) || !ASS_REALLOC_ARRAY(shaper->emblevels, new_size) || !ASS_REALLO...
vuln
Safe
C/C++
static void phys_sections_clear(void) { while (phys_sections_nb > 0) { MemoryRegionSection *section = &phys_sections[--phys_sections_nb]; phys_section_destroy(section->mr); } }
vuln
Safe
C/C++
PHP_FUNCTION(dns_get_record) { char *hostname; int hostname_len; long type_param = PHP_DNS_ANY; zval *authns = NULL, *addtl = NULL; int type_to_fetch; #if defined(HAVE_DNS_SEARCH) struct sockaddr_storage from; uint32_t fromsize = sizeof(from); dns_handle_t handle; #elif defined(HAVE_RES_NSEARCH) struct __res_s...
vuln
Safe
C/C++
@Override public ResponseMessage createCertificate(final AuthenticationToken admin, final RequestMessage req, Class<? extends CertificateResponseMessage> responseClass, final EndEntityInformation suppliedUserData) throws AuthorizationDeniedException, CertificateExtensionException, NoSuchEndE...
vuln
Safe
Java
public static String replace(String text, String search, java.util.function.Supplier<String> replacement) { int index = text.indexOf(search); if (index == -1) { return text; } StringBuilder builder = new StringBuilder(text); int searchLength = search.length(); while ((index = builder.replace(index, in...
vuln
Vulnerable
Java
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteUnpackParams* data = reinterpret_cast<TfLiteUnpackParams*>(node->builtin_data); const TfLiteTensor* input = GetInput(context, node, kInputTensor); switch (input->type) { case kTfLiteFloat32: { UnpackImpl<float>(context, nod...
vuln
Vulnerable
C/C++
@Internal @Override public void handleServerboundHandshake(@NotNull PluginMessageServerboundHandshake message) { Player player = getPlayer(); assert player != null; int serverProtocolVersion = VeinMiner.PROTOCOL.getVersion(); if (serverProtocolVersion != message.getProtocolVersi...
vuln
Safe
Java
int coroutine_fn bdrv_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes) { BdrvTrackedRequest req; int max_pdiscard, ret; int head, tail, align; return -ENOMEDIUM; if (bdrv_has_readonly_bitmaps(bs)) { return -EPERM; ret = bdrv_check_byte_re...
vuln
Vulnerable
C/C++
@Override protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) { try { if (this.trustedProxies.contains(InetAddress.getByName(request.getRemoteAddr()))) { String username = request.getHeader(AUTH_HEADER); if (username != null) { ...
vuln
Safe
Java
@Override public void optionSelected(String optionText, Object optionData) { if (optionText != null) { text.addParagraph(optionText, Global.getSettings().getColor("buttonText")); } try { if (optionData == Menu.NEXT_PAGE) { currentPage++; showPaginatedMenu(); return; } else if (optionData...
vuln
Vulnerable
Java
def validate_sql(sql_cmd: str, dialect: str, sql_validation: SQLValidation) -> None: """Parse an SQL query from a given dialect and determine if it passes validations. Args: sql_cmd (str): SQL query to validate. dialect (str): Dialect of the SQL query. sql_validation (SQLValidation): De...
vuln
Vulnerable
Python
package io.onedev.server.web.resource; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.util.Arr...
vuln
Vulnerable
Java
public void setOssNicknames(String[] ossNicknames) { this.ossNicknames = ossNicknames != null ? ossNicknames.clone() : null; }
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-2016, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** * \file connection_edge.c * \brief Handle edge streams. * * An edge_c...
vuln
Safe
C/C++
static status encodeJsonStructure(const void *src, const UA_DataType *type, CtxJson *ctx) { /* Check the recursion limit */ if(ctx->depth > UA_JSON_ENCODING_MAX_RECURSION) return UA_STATUSCODE_BADENCODINGERROR; ctx->depth++; status ret = writeJsonObjStart(ctx); uintptr_t ptr = (uintptr_t) ...
vuln
Vulnerable
C/C++
void ChromotingHost::ShutdownFinish() { DCHECK(context_->network_message_loop()->BelongsToCurrentThread()); state_ = kStopped; scoped_refptr<ChromotingHost> self(this); for (StatusObserverList::iterator it = status_observers_.begin(); it != status_observers_.end(); ++it) { (*it)->OnShutdown(); ...
vuln
Safe
C/C++
static int get_cluster_offset(BlockDriverState *bs, uint64_t offset, int allocate, int compressed_size, int n_start, int n_end, uint64_t *result) { BDRVQcowState *s = bs->opaque; int min_index, i, j, l1_index, l2_index, re...
vuln
Vulnerable
C/C++
htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) { size_t len = 0, startPosition = 0; xmlChar *ret = NULL; /* * Name ::= (Letter | '_') (NameChar)* */ if (CUR == '"') { NEXT; if (CUR_PTR < BASE_PTR) return(ret); startPosition = CUR_PTR - BASE_PTR; whi...
vuln
Safe
C/C++
int dtls1_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; #ifndef OPENSSL_NO_SCTP unsigned char sctpauthkey[64]; char labelbuffer[sizeof(DTLS1_SCTP_AUTH...
vuln
Vulnerable
Unknown
check_data_region (struct tar_sparse_file *file, size_t i) { off_t size_left; if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset)) return false; size_left = file->stat_info->sparse_map[i].numbytes; mv_size_left (file->stat_info->archive_file_size - file->dumped_size); while (size_left > 0)...
vuln
Safe
Unknown
function ac_sigleid($name, $id) { global $cms_db, $sess; $sess->gc( true ); $ret = true; if( $id >= 1 ) { $ret = false; $cquery = sprintf("select count(*) from %s where user_id='%s' and name='%s'", $cms_db['sessions'], $id, ...
vuln
Vulnerable
PHP