text
stringlengths
79
3.72M
<vulnerable_code> /*globals URL*/ const _parse_url_exp = new RegExp([ '^([\\w.+\\-\\*]+:)//' // protocol , '(([^:/?#]*)(?::([^/?#]*))?@|)' // username:password , '(([^:/?#]*)(?::(\\d+))?)' // host == hostname:port , '(/[^?#]*|)' // pathname , '(\\?([^#]*)|)' ...
<vulnerable_code> bundle.mid = 0; bundle.mb = mbuf_alloc(128); mbuf_printf(bundle.mb, sdp_session_rattr(sess, "group")); list_flush((struct list *)sdp_session_medial(sess, true)); <commit_title>[PATCH] comawill: fix for string<commit_description><fixed_code> bundle.mid = 0; bundle.mb = mbuf_alloc(128); mbuf...
<vulnerable_code> kref_get(&handle->ref); } static int ion_handle_put(struct ion_handle *handle) { struct ion_client *client = handle->client; int ret; mutex_lock(&client->lock); ret = kref_put(&handle->ref, ion_handle_destroy); mutex_unlock(&client->lock); return ret; return ERR_PTR(-EINVAL); } static struc...
<vulnerable_code> /* We can reliably get at most 31 bits since ISO/IEC 9899 only guarantees that a long can represent values up to 2^31-1. */ assert(n >= 0 && n < 32); /* Get the number of bits requested from the specified bit stream. */ v = 0; /* We can reliably put at most 31 bits since ISO/IEC 9899 only ...
<vulnerable_code> (int) qcd->compparms.qntsty, qcd->compparms.numguard, qcd->compparms.numstepsizes); for (i = 0; i < qcd->compparms.numstepsizes; ++i) { fprintf(out, "expn[%d] = 0x%04x; mant[%d] = 0x%04x;\n", i, (unsigned) JPC_QCX_GETEXPN(qcd->compparms.stepsizes[i]), i, (unsigned) JPC_QCX_GETMANT(qcd->co...
<vulnerable_code> mant = JPC_QCX_GETMANT(refstepsize); numbands = 3 * numrlvls - 2; for (bandno = 0; bandno < numbands; ++bandno) { stepsizes[bandno] = JPC_QCX_MANT(mant) | JPC_QCX_EXPN(expn + (numrlvls - 1) - (numrlvls - 1 - ((bandno > 0) ? ((bandno + 2) / 3) : (0)))); }<commit_title>[PATCH] Changed the JPC b...
<vulnerable_code> if (is_a_way) { var bbox_intersects_old = (f.old && f.old.bounds && bbox.intersects(makeBbox(f.old.bounds))); var bbox_intersects_new = (f.neu && f.neu.bounds && bbox.intersects(makeBbox(f.neu.bounds))); var happened_today = moment((f.neu && f.neu.timestamp) ...
<vulnerable_code> return false; }); }, dataExport: async () => { return await fetch(`${API_BASE}/system/data-export`, { method: "GET", headers: baseHeaders(), }) .then((res) => res.json()) .then((res) => res) .catch((e) => { console.error(e); return...
<vulnerable_code> return `/workspace/${slug}`; }, }, exports: () => { return `${API_BASE.replace("/api", "")}/system/data-exports`; }, apiDocs: () => { return `${API_BASE}/docs`; }, vectorDatabase: () => { return "/settings/vector-database"; }, exportImport: () => { re...
<vulnerable_code> ? require("dotenv").config({ path: `.env.${process.env.NODE_ENV}` }) : require("dotenv").config(); const { viewLocalFiles, normalizePath } = require("../utils/files"); const { exportData, unpackAndOverwriteImport } = require("../utils/files/data"); const { checkProcessorAlive, acceptedFileTypes...
<vulnerable_code> const express = require("express"); const bodyParser = require("body-parser"); const serveIndex = require("serve-index"); const cors = require("cors"); const path = require("path"); const { reqBody } = require("./utils/http"); }); } app.use( "/system/data-exports", serveIndex(__dirname + "/stor...
<vulnerable_code>const fs = require("fs"); const path = require("path"); const { v4 } = require("uuid"); async function exportData() { const uid = `anythingllm-export-${new Date() .toJSON() .slice(0, 10)}-${new Date().toJSON().slice(11, 19)}`; const folder = process.env.NODE_ENV === "development" ...
<vulnerable_code>import android.widget.Toast; import com.bluelinelabs.logansquare.LoganSquare; import com.nextcloud.talk.R; import com.nextcloud.talk.adapters.ParticipantDisplayItem; import com.nextcloud.talk.adapters.ParticipantsAdapter; } } }; r...
<vulnerable_code> if (opts.getUserInfo) { csrfOpts.userInfo = true } const tokens = new CSRF(csrfOpts) const isCookieSigned = cookieOpts && cookieOpts.signed<commit_title>[PATCH] Merge pull request from GHSA-qrgf-9gpc-vrxw<commit_description>* fix: enforce hmac key * fix: check only if fastify/cookie is en...
<vulnerable_code> await fastify.register(fastifyCsrf, { getUserInfo (req) { return userInfoDB[req.body.username] } }) sessionPlugin: '@fastify/session', getUserInfo (req) { return req.session.username } }) sessionPlugin: '@fastify/secure-session', getUserInfo (req) { ...
<vulnerable_code>import java.io.*; import java.util.*; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; public TransformXML() { try { saxParser = SAXParserFactory.newInstance().newSAXParser(); } catch (Exception e) { log.info("Error configuring XML parser: " + e);<...
<vulnerable_code> /** * Returns the default maximum number of RST frames that are allowed per window before the connection is * closed. This allows to protect against the remote peer flooding us with such frames and so use up a lot * of CPU. Note that this flag has no effect if a user specified the v...
<vulnerable_code> const unsigned char *compact_pixels,const ssize_t depth, const size_t number_pixels,unsigned char *pixels) { #define CheckNumberPixels(count) \ if (((ssize_t) i + count) > (ssize_t) number_pixels) \ return(i); \ if (length > 128) { length=256-length+1; packets--; ...
<vulnerable_code> @cvar wanted: indicates if TLS negotiation is wanted. @type wanted: C{bool} """ feature = (NS_XMPP_TLS, 'starttls')<commit_title>[PATCH] Add docstrings for new contextFactory attribute<commit_description><fixed_code> @cvar wanted: indicates if TLS negotiation is wanted. @type...
<vulnerable_code>#include "read.h" #include "blocks/error.h" extern struct Movie m; extern SWF_Parserstruct *blockParse (FILE *f, int length, SWFBlocktype header); const char *blockName (SWFBlocktype header); unsigned int i; size_t nmalloc = ( glyphbits < 1 ? 1 : ((glyphbits+31)/32) ) * sizeof(UI32); gerec->Gly...
<vulnerable_code>// uncomment after placing your favicon in /public //app.use(favicon(__dirname + '/public/favicon.ico')); app.use(logger('dev')); app.use(bodyParser.json({limit: "50mb"})); app.use(bodyParser.urlencoded({ extended: false, limit: "50mb" })); app.use(cookieParser()); app.use(express.static(path.join(__di...
<vulnerable_code>import uuid from app.dependencies import ( check_token_expired, get_admin, get_tenant_id ) router = APIRouter( prefix="/admin", tags=["admin"], dependencies=[Depends(check_token_expired)] ) async def new_admin_db(admin_list, exclusion_list, tenant_id):<commit_title>[PATCH 2/4]...
<vulnerable_code>from netaddr import IPSet, IPNetwork from app.dependencies import ( check_token_expired, get_admin, get_tenant_id ) router = APIRouter( prefix="/azure", tags=["azure"], dependencies=[Depends(check_token_expired)] ) def str_to_list(input):<commit_title>[PATCH 2/4] Removed comme...
<vulnerable_code>from netaddr import IPNetwork from app.dependencies import ( check_token_expired, get_admin, get_tenant_id ) router = APIRouter( prefix="/internal", tags=["internal"], dependencies=[Depends(check_token_expired)] ) async def multi_helper(func, list, *args):<commit_title>[PATCH ...
<vulnerable_code>from netaddr import IPSet, IPNetwork from app.dependencies import ( check_token_expired, get_tenant_id ) router = APIRouter( prefix="/tools", tags=["tools"], dependencies=[Depends(check_token_expired)] ) @router.post(<commit_title>[PATCH 2/4] Removed comments used for testing<com...
<vulnerable_code>from typing import Union, List from app.dependencies import ( check_token_expired, get_admin, get_tenant_id ) router = APIRouter( prefix="/users", tags=["users"], dependencies=[Depends(check_token_expired)] ) async def new_user(user_id, tenant_id):<commit_title>[PATCH 2/4] Rem...
<vulnerable_code> raise HTTPException(status_code=401, detail="Token has expired.") except jwt.MissingRequiredClaimError: raise HTTPException(status_code=401, detail="Incorrect token claims, please check the audience and issuer.") except Exception: raise HTTPException(...
<vulnerable_code>import { common, macros } from "./_.js"; for (const shell of common.getTestShells()) { for (const arg of common.getTestArgs()) { const test = common.getTestFn(shell); test(macros.execFile, { arg, shell }); test(macros.execFileSync, { arg, shell }); }<commit_title>[PATCH] Slightly impro...
<vulnerable_code>import { common, macros } from "./_.js"; for (const shell of common.getTestShells()) { for (const arg of common.getTestArgs()) { const test = common.getTestFn(shell); test(macros.exec, { arg, shell }); test(macros.execSync, { arg, shell }); }<commit_title>[PATCH] Slightly improve e2e t...
<vulnerable_code>import { common, macros } from "./_.js"; for (const shell of common.getTestShells()) { for (const arg of common.getTestArgs()) { const test = common.getTestFn(shell); test(macros.spawn, { arg, shell }); test(macros.spawnSync, { arg, shell }); }<commit_title>[PATCH] Slightly improve e2e...
<vulnerable_code>static janus_callbacks *gateway = NULL; static GThread *handler_thread; static void *janus_videocall_handler(void *data); typedef struct janus_videocall_message { janus_plugin_session *handle; volatile gint destroyed; janus_refcount ref; } janus_videocall_session; static GHashTable *sessions; stati...
<vulnerable_code> */ /* * Copyright (c) 2019, Joyent, Inc. */ #include <syslog.h> * - we skip leading whitespaces and ignore trailing whitespaces */ while (*ptr != '\0') { if ((*ptr == ' ') || (*ptr == '\t')) break; else { username[index] = *ptr; index++; ptr++; } /* ret_username will be fre...
<vulnerable_code><commit_title>[PATCH] 3.0.9<commit_description>Fix vulnerability in form folder creation<fixed_code>
<vulnerable_code>/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* AES implementation in JavaScript (c) Chris Veness 2005-2010 */ /* - see http://csrc.nist.gov/publications/PubsFIPS.html#197 */ ...
<vulnerable_code>/*! * jQuery UI 1.8.16 * * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * http://docs.jquery.com/UI */ (function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=...
<vulnerable_code>/*! * jQuery JavaScript Library v1.6.2 * http://jquery.com/ * * Copyright 2011, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * Includes Sizzle.js * http://sizzlejs.com/ * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, a...
<vulnerable_code> */ #include <logging/log.h> LOG_MODULE_REGISTER(updatehub); #include <zephyr.h> <commit_title>[PATCH] lib: updatehub: Add log level<commit_description>Current log only prints default log level. Add LOG_LEVEL at updatehub to switch between log variations based on CONFIG_UPDATEHUB_LOG_LEVEL. Signed-...
<vulnerable_code>{ static generic_ret ret; char *prime_arg; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; restriction_t *rp; krb5_free_error_message(hand...
<vulnerable_code> else i += header.payload[i] + 1; /* skip length and label */ } } if (length - i < 10) return std::make_pair((unsigned char*)NULL,"Incorrectly sized DNS reply"); /* XXX: We actually initialise 'rr' here including its ttl field */<commit_title>[PATCH] Fixed out of bounds memory access fr...
<vulnerable_code>from __future__ import annotations from typing import Dict, Optional from pydantic import BaseModel as PydanticBaseModel from pydantic import Field if TYPE_CHECKING: from wasm_exec import WasmExecutor class BaseModel(PydanticBaseModel): class Config: arbitrary_types_allowed = True ...
<vulnerable_code> while (gf_list_count(traf->TrackRuns)) { trun = (GF_TrackFragmentRunBox *)gf_list_get(traf->TrackRuns, 0); gf_list_rem(traf->TrackRuns, 0); gf_isom_box_del_parent(&traf->child_boxes, (GF_Box *)trun); } traf->tfhd->flags |= GF_ISOM_TRAF_DUR_EMPTY; if (!first_ent) { i--; gf_list_re...
<vulnerable_code> */ base.toCSS = function (node, depth, breaks) { var cssString = ''; if (typeof depth == 'undefined') { depth = 0; } if (typeof breaks == 'undefined') { breaks = false; } if (node.attributes) { for (i in node.a...
<vulnerable_code> this._cssTemp = function (json) { var css = CSSJSON.toCSS(json); if(!mw.liveedit._cssTemp) { mw.liveedit._cssTemp = mw.tools.createStyle('#mw-liveedit-dynamic-temp-style', css, document.body); } }; this.changed = false; this._temp = {children: {}, ...
<vulnerable_code>package com.github.kfcfans.powerjob.server.web.controller; import com.github.kfcfans.powerjob.common.response.ResultDTO; import com.github.kfcfans.powerjob.server.persistence.core.model.AppInfoDO; import com.github.kfcfans.powerjob.server.persistence.core.repository.AppInfoRepository; import javax.ann...
<vulnerable_code>public class ModifyAppInfoRequest { private Long id; private String appName; private String password; <commit_title>[PATCH] fix: arbitrary password modification vulnerability #99<commit_description><fixed_code> public class ModifyAppInfoRequest { private Long id; private String ol...
<vulnerable_code>package org.openmrs.module.appointmentscheduling; import org.openmrs.BaseOpenmrsData; import org.openmrs.Patient; import org.openmrs.Provider; this.status = status; } public String getNotes() { return notes; } public void setNotes(String notes) { this.notes = ...
<vulnerable_code> } }<commit_title>[PATCH] Fixing reflective XSS in the notes section<commit_description><fixed_code> } @Test @Verifies(value="The text for notes should be sanitized", method="sanitizeNotes(String)") public void sanitizeAppointmentRequest_shouldSanitizeTheTextInputForAppointmentNo...
<vulnerable_code> { count=(ssize_t) ReadBlob(image,(size_t) (3*image->columns),pixels); if (count != (ssize_t) (3*image->columns)) ThrowReaderException(CorruptImageError,"UnableToReadImageData"); p=pixels; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Q...
<vulnerable_code> @Override protected JsonNode _at(JsonPointer ptr) { // 02-Jan-2020, tatu: As per [databind#3003] must return `null` and NOT // "missing node" return null; }<commit_title>[PATCH] ... and fixing reference, fixed #3005, not #3003<commit_description><fixed_code> ...
<vulnerable_code> * Module dependencies. */ var exec = require('child_process').exec , fs = require('fs') , path = require('path') , exists = fs.existsSync || path.existsSync , os = require('os') , shellescape = require('shell-escape') , cmd; function which(name) { })(args[0]); break; } ...
<vulnerable_code> *method = h2o_strdup(&req->pool, req->method.base, req->method.len); /* url */ h2o_url_init(url, origin->scheme, req->authority, h2o_strdup(&req->pool, req->path.base, req->path.len)); if (props->connection_header != NULL) { if (upgrade_to != NULL && upgrade_to != h2o_httpclie...
<vulnerable_code> if (!overrides->proxy_preserve_host) target = NULL; } if (target == &target_buf) h2o_url_init(&target_buf, req->scheme, req->authority, h2o_iovec_init(H2O_STRLIT("/"))); const char *upgrade_to = NULL; if (req->is_tunnel_req) {<commit_title>[PATCH 1/2] die wh...
<vulnerable_code> #if HAVE_XSHM shm->shmid = shmget(IPC_PRIVATE, xim->bytes_per_line * xim->height, IPC_CREAT | 0777); if (shm->shmid == -1) { rfbErr("shmget(%s) failed.\n", name);<commit_title>[PATCH] scan: limit access to shared memory segments to current user<commit_description><fixed_code> #if HAVE_XSHM ...
<vulnerable_code> } int tcpPort = receivedPacket->get<int>(QStringLiteral("tcpPort")); //qCDebug(KDECONNECT_CORE) << "Received Udp identity packet from" << sender << " asking for a tcp connection on port " << tcpPort; <commit_title>[PATCH] Limit the ports we try to connect to to the port range ...
<vulnerable_code> GF_List *identifiers; char *new_line; u32 indent; } ScriptParser; e = GF_OK; if (gf_node_get_tag(n) != TAG_MPEG4_Script) return GF_NON_COMPLIANT_BITSTREAM; parser.codec = codec; parser.script = n; parser.bs = bs; SFS_Space(&parser); SFS_StatementBlock(&parser, GF_TRUE); SFS_Line(&parse...
<vulnerable_code> case ESIS_OPTION_PROTOCOLS: while (opli>0) { ND_TCHECK(*pptr); ND_PRINT((ndo, "%s (0x%02x)", tok2str(nlpid_values, "unknown", pptr += opli; } trunc: re...
<vulnerable_code> */ @PostConstruct public void init() { methodsCache.initClassMethod("com.alibaba.nacos.naming.controllers"); methodsCache.initClassMethod("com.alibaba.nacos.console.controller"); methodsCache.initClassMethod("com.alibaba.nacos.config.server.controller"); } ...
<vulnerable_code> Method method = methodsCache.getMethod(req); if (method == null) { chain.doFilter(request, response); return; } <commit_title>[PATCH] Fix #4701<commit_description><fixed_code> Method method = method...
<vulnerable_code> package com.alibaba.nacos.core.code; import com.alibaba.nacos.common.utils.CollectionUtils; import com.alibaba.nacos.core.auth.RequestMappingInfo; import com.alibaba.nacos.core.auth.RequestMappingInfo.RequestMappingInfoComparator; public Method getMethod(HttpServletRequest request) { ...
<vulnerable_code><commit_title>[PATCH] improved open redirect prevention<commit_description><fixed_code> #!/usr/bin/env python # -*- coding: utf-8 -*- """ | This file is part of the web2py Web Framework | Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> | License: LGPLv3 (http://www.gnu.org/licenses/lgpl.htm...
<vulnerable_code><commit_title>[PATCH] improved open redirect prevention<commit_description><fixed_code> from gluon.dal import DAL from gluon.storage import Storage from gluon.utils import web2py_uuid try: # web3py from gluon.current import current from gluon.url import URL from gluon.helpers import * e...
<vulnerable_code>from gluon.dal import DAL, Field from pydal.objects import Table from gluon import tools from gluon.tools import Auth, Mail, Recaptcha2, prettydate, Expose from gluon._compat import PY2, to_bytes from gluon.globals import Request, Response, Session from gluon.storage import Storage def test_not_aut...
<vulnerable_code> return url return URL(url) class Mail(object): """ def get_vars_next(self): next = current.request.vars._next host = current.request.env.http_host if isinstance(next, (list, tuple)): next = next[0] if next and self.settings.prevent_...
<vulnerable_code> headers = pprint.pformat(self.headers_log(environ)) log.LOGGER.debug("Request headers:\n%s" % headers) base_prefix = config.get("server", "base_prefix") if environ["PATH_INFO"].startswith(base_prefix): # Sanitize request URI environ["PATH_INFO"] ...
<vulnerable_code> if(value.composition === 'source-atop'){ html += ' <button class="arrow_down" data-id="' + value.id + '" ></button>'; } html += ' <button class="layer_name" id="layer_name" data-id="' + value.id + '">' + value.name + '</button>'; html += ' <div class="clear"></div>'; html ...
<vulnerable_code>import config from './../../config.js'; import Base_layers_class from './../../core/base-layers.js'; import Dialog_class from './../../libs/popup.js'; class Layer_rename_class { constructor() { this.Base_layers = new Base_layers_class(); this.POP = new Dialog_class(); } rename(id = null) { ...
<vulnerable_code> } ); it( 'should call syncInputHeight only the display style is multiline', function(done) {<commit_title>[PATCH] LPS-67567 SF<commit_description><fixed_code> } ); it( 'should call syncInputHeight only the display style is multiline', ...
<vulnerable_code> ); }); it('works with array', async () => { await reconfigureServer({ fileUpload: {<commit_title>[PATCH] fix: Server crash when uploading file without extension;<commit_description><fixed_code> ); }); it('allows file without extension', async () => { aw...
<vulnerable_code> } else if (contentType && contentType.includes('/')) { extension = contentType.split('/')[1]; } extension = extension.split(' ').join(''); if (!isValidExtension(extension)) { next( new Parse.Error( Parse.Error.FILE_SAVE_ERROR,<commit_title>...
<vulnerable_code> emitstring(J, F, OP_CATCH, catchvar->string); cstm(J, F, catchstm); emit(J, F, OP_ENDCATCH); L3 = emitjump(J, F, OP_JUMP); /* skip past the try block to the finally block */ } label(J, F, L1);<commit_title>[PATCH] Bug 700947: Add missing ENDTRY opcode in try/catch/finally<commit_description><...
<vulnerable_code>#include <fastrtps/utils/IPFinder.h> #include <fastrtps/log/Log.h> using namespace eprosima::fastrtps; using namespace eprosima::fastrtps::rtps; } } TEST(TransportUDP, DatagramInjection) { using namespace eprosima::fastdds::rtps; auto receivers = transport->get_receivers(); ASSERT_F...
<vulnerable_code> sixel_output_t *output; output = (sixel_output_t *) AcquireQuantumMemory(sizeof(sixel_output_t) + SIXEL_OUTPUT_PACKET_SIZE * 2, 1); output->has_8bit_control = 0; output->save_pixel = 0; output->save_count = 0; Define SIXEL pixels. */ output = sixel_output_create(image); s...
<vulnerable_code> if (dirfd == -1) eerrorx("%s: unable to open the root directory: %s", applet, strerror(errno)); path_dupe = xstrdup(path); ch = path_dupe; while (*ch) { if (*ch == '/') components++; ch++; } item = strtok(path_dupe, "/"); #ifdef O_PATH flags |= O_PATH; dirfd = new_dirfd; free(...
<vulnerable_code> const encrypted = await encryptWithAES( encryptedEncryptionParams, new TextEncoder().encode(JSON.stringify(encryptedPayload)) ) const encryptedKey = await encryptStringAsymmetric(<commit_title>[PATCH] base64 encode encrypted<commit_description>Signed-off-by: Louis Chemineau <louis@chmn.me><fix...
<vulnerable_code>err: if (page) put_page(page); kfree(rm->atomic.op_notifier); return ret;<commit_title>[PATCH] RDS: null pointer dereference in rds_atomic_free_op<commit_description>set rm->atomic.op_active to 0 when rds_pin_pages() fails or the user supplied address is invalid, this prevents a NULL pointer usag...
<vulnerable_code>/* AVP-specific print out routines */ /***********************************/ static void l2tp_msgtype_print(netdissect_options *ndo, const u_char *dat) { const uint16_t *ptr = (const uint16_t *)dat; ND_PRINT((ndo, "%s", tok2str(l2tp_msgtype2str, "MSGTYPE-#%u", EXTRACT_16BITS(ptr)))); } { const ...
<vulnerable_code>{ struct crypto_report_cipher rcipher; strlcpy(rcipher.type, "cipher", sizeof(rcipher.type)); rcipher.blocksize = alg->cra_blocksize; rcipher.min_keysize = alg->cra_cipher.cia_min_keysize; { struct crypto_report_comp rcomp; strlcpy(rcomp.type, "compression", sizeof(rcomp.type)); if (nla_put(s...
<vulnerable_code> if (!p) return 0; p = xdr_decode_hyper(p, &args->offset); args->count = ntohl(*p++); len = min(args->count, max_blocksize); /* set up the kvec */ v++; } args->vlen = v; return xdr_argsize_check(rqstp, p); } int p = decode_fh(p, &args->fh); if (!p) return 0; args->buffer = page_addre...
<vulnerable_code> len = args->count = ntohl(*p++); p++; /* totalcount - unused */ len = min_t(unsigned int, len, NFSSVC_MAXBLKSIZE_V2); /* set up somewhere to store response. v++; } args->vlen = v; return xdr_argsize_check(rqstp, p); } int p = decode_fh(p, &args->fh); if (!p) return 0; args->buffer ...
<vulnerable_code> target->cl_clientid.cl_id = source->cl_clientid.cl_id; } int strdup_if_nonnull(char **target, char *source) { if (source) { *target = kstrdup(source, GFP_KERNEL); if (!*target) return -ENOMEM; } else *target = NULL; return 0; } static int copy_cred(struct svc_cred *target, struct svc_cr...
<vulnerable_code> err = follow_down(&path); if (err < 0) goto out; exp2 = rqst_exp_get_by_name(rqstp, &path); if (IS_ERR(exp2)) { /* * For nfsd purposes, we treat V4ROOT exports as though there was an * export at *every* directory. */ int nfsd_mountpoint(struct dentry *dentry, struct svc_export *exp) { if (d_...
<vulnerable_code> struct xdr_buf *sndbuf = &rqst->rq_snd_buf; struct svc_rdma_op_ctxt *ctxt; struct svc_rdma_req_map *vec; struct ib_send_wr send_wr; int ret; vec = svc_rdma_get_req_map(rdma); } svc_rdma_count_mappings(rdma, ctxt); memset(&send_wr, 0, sizeof(send_wr)); ctxt->cqe.done = svc_rdma_wc_send; sen...
<vulnerable_code> return -EIO; } /* This function prepares the portion of the RPCRDMA message to be * sent in the RDMA_SEND. This function is called after data sent via * RDMA has already been transmitted. There are three cases: u32 inv_rkey) { struct svc_rdma_op_ctxt *ctxt; struct ib_send_wr send_wr; u32...
<vulnerable_code>static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma, struct rpc_rqst *rqst) { struct xdr_buf *sndbuf = &rqst->rq_snd_buf; struct svc_rdma_op_ctxt *ctxt; struct svc_rdma_req_map *vec; int ret; vec = svc_rdma_get_req_map(rdma); ret = svc_rdma_map_xdr(rdma, sndbuf, vec, false); if (re...
<vulnerable_code> return 0; } /* Assumptions: * - The specified write_len can be represented in sc_max_sge * PAGE_SIZE */ err = ERR_VERS; length = svc_rdma_xdr_encode_error(xprt, rmsgp, err, va); ctxt = svc_rdma_get_context(xprt); ctxt->direction = DMA_TO_DEVICE; ctxt->count = 1; ctxt->pages[0] = p; /* Pre...
<vulnerable_code> dprintk("SVCRDMA Module Init, register RPC RDMA transport\n"); dprintk("\tsvcrdma_ord : %d\n", svcrdma_ord); dprintk("\tmax_requests : %u\n", svcrdma_max_requests); dprintk("\tsq_depth : %u\n", svcrdma_max_requests * RPCRDMA_SQ_DEPTH_MULT); dprintk("\tmax_bc_requests : %u\n", s...
<vulnerable_code> svcrdma_max_bc_requests); newxprt->sc_rq_depth = newxprt->sc_max_requests + newxprt->sc_max_bc_requests; newxprt->sc_sq_depth = RPCRDMA_SQ_DEPTH_MULT * newxprt->sc_rq_depth; atomic_set(&newxprt->sc_sq_avail, newxprt->sc_sq_depth); if (!svc_rdma_prealloc_ctxts(newxprt))<commit_ti...
<vulnerable_code> return -EIO; } /** * svc_rdma_post_send_wr - Set up and post one Send Work Request * @rdma: controlling transport u32 xdr_off; int sge_no; int sge_bytes; int page_no; int pages; int ret = -EIO; /* Prepare the context */ goto err; } /* Save all respages in the ctxt and remove them from ...
<vulnerable_code> * Invalidate, and responder chooses one rkey to invalidate. * * Find a candidate rkey to invalidate when sending a reply. Picks the * first rkey it finds in the chunks lists. * * Returns zero if RPC's chunk lists are empty. */ static u32 svc_rdma_get_inv_rkey(struct rpcrdma_msg *rdma_argp, ...
<vulnerable_code><commit_title>[PATCH 02/26] uapi: fix linux/nfsd/cld.h userspace compilation errors<commit_description>Include <linux/types.h> and consistently use types it provides to fix the following linux/nfsd/cld.h userspace compilation errors: /usr/include/linux/nfsd/cld.h:40:2: error: unknown type name 'uint16...
<vulnerable_code> INIT_LIST_HEAD(&cma_xprt->sc_read_complete_q); INIT_LIST_HEAD(&cma_xprt->sc_frmr_q); INIT_LIST_HEAD(&cma_xprt->sc_ctxts); INIT_LIST_HEAD(&cma_xprt->sc_maps); init_waitqueue_head(&cma_xprt->sc_send_wait); spin_lock_init(&cma_xprt->sc_rq_dto_lock); spin_lock_init(&cma_xprt->sc_frmr_q_lock); spin...
<vulnerable_code> * Caller holds the connection's mutex and has already marshaled * the RPC/RDMA request. * * This is similar to svc_rdma_reply, but takes an rpc_rqst * instead, does not support chunks, and avoids blocking memory * allocation. * * XXX: There is still an opportunity to block in svc_rdma_send() *...
<vulnerable_code>/* * Copyright (c) 2014 Open Grid Computing, Inc. All rights reserved. * Copyright (c) 2005-2006 Network Appliance, Inc. All rights reserved. * * Author: Tom Tucker <tom@opengridcomputing.com> */ #include <linux/sunrpc/debug.h> #include <linux/sunrpc/rpc_rdma.h> #include <linux/spinlock.h> retur...
<vulnerable_code> return -EINVAL; } int svc_rdma_xdr_encode_error(struct svcxprt_rdma *xprt, struct rpcrdma_msg *rmsgp, enum rpcrdma_errcode err, __be32 *va) { __be32 *startp = va; *va++ = rmsgp->rm_xid; *va++ = rmsgp->rm_vers; *va++ = xprt->sc_fc_credits; *va++ = rdma_error; *va++ = cpu_to_be...
<vulnerable_code> rqstp->rq_arg.buflen = head->arg.buflen; } /* By convention, backchannel calls arrive via rdma_msg type * messages, and never populate the chunk lists. This makes * the RPC/RDMA header small and fixed in size, so it is return ret; out_err: svc_rdma_send_error(rdma_xprt, rmsgp, ret); svc_rdma_pu...
<vulnerable_code> set_bit(XPT_CLOSE, &xprt->xpt_flags); return -ENOTCONN; } void svc_rdma_send_error(struct svcxprt_rdma *xprt, struct rpcrdma_msg *rmsgp, int status) { struct page *p; struct svc_rdma_op_ctxt *ctxt; enum rpcrdma_errcode err; __be32 *va; int length; int ret; ret = svc_rdma_repost_recv(xprt...
<vulnerable_code> return ret; } void svc_rdma_prep_reply_hdr(struct svc_rqst *rqstp) { } /* XXX: Presume the client sent only one Write chunk */ ret = svc_rdma_send_write_chunk(rdma, wr_lst, xdr); if (ret < 0) goto err1; svc_rdma_xdr_encode_write_list(rdma_resp, wr_lst, ret); } if (rp_ch) { ret = svc_rd...
<vulnerable_code> #undef SVCRDMA_BACKCHANNEL_DEBUG int svc_rdma_handle_bc_reply(struct rpc_xprt *xprt, struct rpcrdma_msg *rmsgp, struct xdr_buf *rcvbuf) { struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); p = (__be32 *)src->iov_base; len = src->iov_len; xid = rmsgp->rm_xid; #ifdef SVCRDMA_BACKCHANNEL_D...
<vulnerable_code> * the RPC/RDMA header small and fixed in size, so it is * straightforward to check the RPC header's direction field. */ static bool svc_rdma_is_backchannel_reply(struct svc_xprt *xprt, struct rpcrdma_msg *rmsgp) { __be32 *p = (__be32 *)rmsgp; if (!xprt->xpt_bc_xprt) return false; if (rmsgp->r...
<vulnerable_code>unsigned int svcrdma_max_bc_requests = RPCRDMA_MAX_BC_REQUESTS; static unsigned int min_max_requests = 4; static unsigned int max_max_requests = 16384; unsigned int svcrdma_max_req_size = RPCRDMA_MAX_REQ_SIZE; static unsigned int min_max_inline = 4096; static unsigned int max_max_inline = 65536; atomi...