code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
def init_ssh(): """ Configure passwordless SSH. """ utils.start_service("sshd.service", enable=True) configure_local_ssh_key()
cwe
CWE-269
Python
void Compute(OpKernelContext* context) override { const Tensor& tensor_in = context->input(0); const Tensor& tensor_out = context->input(1); const Tensor& out_grad_backprop = context->input(2); // For maxpooling3d, tensor_in should have 5 dimensions. OP_REQUIRES(context, tensor_in.dims() == 5, ...
cwe
CWE-369
Unknown
static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf, size_t length, size_t displacement TSRMLS_DC) { unsigned exif_value_2a, offset_of_ifd; /* set the thumbnail stuff to nothing so we can test to see if they get set up */ if (memcmp(CharBuf, "II", 2) == 0) { ImageInfo->motorola_intel =...
cwe
CWE-119
Unknown
BigInt inverse_mod(const BigInt& n, const BigInt& mod) { if(mod.is_zero()) throw BigInt::DivideByZero(); if(mod.is_negative() || n.is_negative()) throw Invalid_Argument("inverse_mod: arguments must be non-negative"); if(n.is_zero() || (n.is_even() && mod.is_even())) return 0; BigInt x...
cwe
CWE-200
Unknown
/* foreign file formats base class * * 7/2/12 * - add support for sequential reads * 18/6/12 * - flatten alpha with vips_flatten() * 28/5/13 * - auto rshift down to 8 bits during save * 19/1/14 * - pack and unpack rad to scrgb * 18/8/14 * - fix conversion to 16-bit RGB, thanks John * 18/6/15 * - forw...
cwe
CWE-362
C/C++
function compilePointer (pointer) { if (typeof pointer === 'string') { pointer = pointer.split('/') if (pointer[0] === '') return pointer throw new Error('Invalid JSON pointer.') } else if (Array.isArray(pointer)) { return pointer } throw new Error('Invalid JSON pointer.') }
cwe
CWE-843
JavaScript
ins_compl_add_infercase( char_u *str_arg, int len, int icase, char_u *fname, int dir, int cont_s_ipos) // next ^X<> will set initial_pos { char_u *str = str_arg; char_u *p; int actual_len; // Take multi-byte characters int actual_compl_length; // into account. int mi...
cwe
CWE-122
Unknown
# -*- coding: utf-8 -*- # Copyright 2019 The Matrix.org Foundation C.I.C. # # 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 requir...
cwe
CWE-918
Python
function lazyLoadCustomEmoji(element: HTMLElement): void { const img = createElement('img', CLASS_CUSTOM_EMOJI) as HTMLImageElement; if (element.dataset.emoji) { img.src = element.dataset.emoji; element.innerText = ''; element.appendChild(img); } }
cwe
CWE-79
JavaScript
size_t util_path_encode(char *s, size_t len) { char t[(len * 3)+1]; size_t i, j; for (i = 0, j = 0; s[i] != '\0'; i++) { if (s[i] == '/') { memcpy(&t[j], "\\x2f", 4); j += 4; } else if (s[i] == '\\') { memcpy(&t[j], "\\x5c", 4); j += 4; } else { t[j] = s[i]; j++; } } if (len == 0) retu...
cwe
CWE-120
Unknown
/* radare - LGPL - Copyright 2015-2018 - pancake */ #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> #include <r_util.h> typedef enum optype_t { ARM_NOTYPE = -1, ARM_GPR = 1, ARM_CONSTANT = 2, ARM_FP = 4, ARM_MEM_OPT = 8 } OpType; typedef enum regtype_t { ARM_UNDEFINED = -1, ARM_R...
cwe
CWE-125
C/C++
[_sanitize](svg) { return svg.removeAttr('onload'); }
cwe
CWE-94
JavaScript
static void *listen_fn_(UNUSED_ATTR void *context) { prctl(PR_SET_NAME, (unsigned long)LISTEN_THREAD_NAME_, 0, 0, 0); listen_socket_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listen_socket_ == -1) { LOG_ERROR("%s socket creation failed: %s", __func__, strerror(errno)); goto cleanup; } int enable =...
cwe
CWE-284
C/C++
package saml import ( "bytes" "compress/flate" "encoding/xml" "strconv" "time" "github.com/beevik/etree" "github.com/russellhaering/goxmldsig/etreeutils" ) // AuthnRequest represents the SAML object of the same name, a request from a service provider // to authenticate a user. // // See http://docs.oasis-open...
cwe
CWE-287
Go
TPMI_ALG_SIG_SCHEME_Unmarshal(TPMI_ALG_SIG_SCHEME *target, BYTE **buffer, INT32 *size, BOOL allowNull) { TPM_RC rc = TPM_RC_SUCCESS; if (rc == TPM_RC_SUCCESS) { rc = TPM_ALG_ID_Unmarshal(target, buffer, size); } if (rc == TPM_RC_SUCCESS) { switch (*target) { #if ALG_HMAC case TPM_ALG_HMAC: #en...
cwe
CWE-787
Unknown
generate_sub_request(uint8_t* qname, size_t qnamelen, uint16_t qtype, uint16_t qclass, struct module_qstate* qstate, int id, struct iter_qstate* iq, enum iter_state initial_state, enum iter_state finalstate, struct module_qstate** subq_ret, int v) { struct module_qstate* subq = NULL; struct iter_qstate* subiq = ...
cwe
CWE-400
Unknown
ProcPanoramiXShmCreatePixmap( register ClientPtr client) { ScreenPtr pScreen = NULL; PixmapPtr pMap = NULL; DrawablePtr pDraw; DepthPtr pDepth; int i, j, result, rc; ShmDescPtr shmdesc; REQUEST(xShmCreatePixmapReq); unsigned int width, height, depth; unsigned long size; Panor...
cwe
CWE-189
Unknown
void luaV_execute (lua_State *L, CallInfo *ci) { LClosure *cl; TValue *k; StkId base; const Instruction *pc; int trap; #if LUA_USE_JUMPTABLE #include "ljumptab.h" #endif tailcall: trap = L->hookmask; cl = clLvalue(s2v(ci->func)); k = cl->p->k; pc = ci->u.l.savedpc; if (trap) { if (cl->p->is_var...
cwe
CWE-787
Unknown
static char *pool_strdup(const char *s) { char *r = pool_alloc(strlen(s) + 1); strcpy(r, s); return r; }
cwe
CWE-119
C/C++
void vp8_deblock(VP8_COMMON *cm, YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *post, int q, int low_var_thresh, int flag) { double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065; int ppl = (int)(level + .5); const MODE_INFO *mode_info_context = cm->show_frame_m...
cwe
CWE-20
C/C++
gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) { int lastBorder; /* Seek left */ int leftLimit, rightLimit; int i; leftLimit = (-1); if (border < 0) { /* Refuse to fill to a non-solid border */ return; } for (i = x; (i >= 0); i--) { if (gdImageGetPix...
cwe
CWE-119
Unknown
int main(int argc, char *argv[]) { int free_query_string = 0; int exit_status = SUCCESS; int cgi = 0, c, i, len; zend_file_handle file_handle; char *s; /* temporary locals */ int behavior = PHP_MODE_STANDARD; int no_headers = 0; int orig_optind = php_optind; char *orig_optarg = php_optarg; char *script_file...
cwe
CWE-119
Unknown
#ifndef IGNOREALL /* dcraw.c -- Dave Coffin's raw photo decoder Copyright 1997-2015 by Dave Coffin, dcoffin a cybercom o net This is a command-line ANSI C program to convert raw photos from any digital camera on any computer running any operating system. No license is required to download and use dcraw...
cwe
CWE-835
C/C++
function highlightSearchResults(searchResults, highlightedTokens) { highlightedTokens = Array.from(new Set(highlightedTokens)); // we remove < signs because they can cause trouble in matching and overwriting existing highlighted chunks // which would make the resulting HTML string invalid. // { and } a...
cwe
CWE-79
JavaScript
static int db_interception(struct vcpu_svm *svm) { struct kvm_run *kvm_run = svm->vcpu.run; if (!(svm->vcpu.guest_debug & (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP)) && !svm->nmi_singlestep) { kvm_queue_exception(&svm->vcpu, DB_VECTOR); return 1; } if (svm->nmi_singlestep) { svm->nmi_single...
cwe
CWE-200
Unknown
_crypt_extended_r(const char *key, const char *setting, struct php_crypt_extended_data *data) { int i; uint32_t count, salt, l, r0, r1, keybuf[2]; u_char *p, *q; if (!data->initialized) des_init_local(data); /* * Copy the key, shifting each character up by one bit * and padding with zeros. */ q = (u_...
cwe
CWE-310
C/C++
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
cwe
CWE-521
Python
def loadDraftAndText(pageId: String, postNr: Int): Action[Unit] = GetActionRateLimited(RateLimits.ReadsFromDb) { request =>
cwe
CWE-613
Scala
def _get_iscsi_ip_addrs(self): generator = self._port_conf_generator('svcinfo lsportip') header = next(generator, None) if not header: return for port_data in generator: try: port_node_id = port_data['node_id'] port_ipv4 = port_dat...
cwe
CWE-78
Python
asn1_length_decode(struct asn1_ctx *ctx, unsigned int *def, unsigned int *len) { unsigned char ch, cnt; if (!asn1_octet_decode(ctx, &ch)) return 0; if (ch == 0x80) *def = 0; else { *def = 1; if (ch < 0x80) *len = ch; else { cnt = (unsigned char) (ch & 0x7F); *len = 0; while (cnt > 0) { ...
cwe
CWE-119
Unknown
value () { return this.entry[this.propertyId]; }
cwe
CWE-79
JavaScript
mobility_opt_print(netdissect_options *ndo, const u_char *bp, const unsigned len) { unsigned i, optlen; for (i = 0; i < len; i += optlen) { ND_TCHECK(bp[i]); if (bp[i] == IP6MOPT_PAD1) optlen = 1; else { if (i + 1 < len) { ND_TCHECK(bp[i + 1]); optlen = bp[i + 1] + 2; } e...
cwe
CWE-125
C/C++
#encoding=utf-8 # test for flask import MySQLdb import time from flask import Flask from flask import render_template from flask import request, jsonify COLOR_CHART = ["#F7464A","#46BFBD","#FDB45C","#949FB1","#C7604C",\ "#4D5360","#7D4F6D","#9D9B7F","#21323D","#1874CD",\ "#218868","#8E8E38"] conn=MySQLdb.con...
cwe
CWE-89
Python
Ra=document.createElement("div");Ra.className="geTempDlgDiagramTileImg geTempDlgDiagramTileImgLoading";var Qa=document.createElement("img");Qa.style.display="none";(function(Ma,Ta,Ua){Qa.onload=function(){Ta.className="geTempDlgDiagramTileImg";Ma.style.display=""};Qa.onerror=function(){this.src!=Ua?this.src=Ua:Ta.class...
cwe
CWE-20
JavaScript
package com.salesmanager.core.model.catalog.product.availability; import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Embedded; import javax.persistence.Entity; import javax.persistence.FetchType; import...
cwe
CWE-639
Java
int regexec(Reprog *prog, const char *sp, Resub *sub, int eflags) { Resub scratch; int i; if (!sub) sub = &scratch; sub->nsub = prog->nsub; for (i = 0; i < MAXSUB; ++i) sub->sub[i].sp = sub->sub[i].ep = NULL; return !match(prog->start, sp, sp, prog->flags | eflags, sub); }
cwe
CWE-674
Unknown
static inline void tss_invalidate_io_bitmap(struct tss_struct *tss) { /* * Invalidate the I/O bitmap by moving io_bitmap_base outside the * TSS limit so any subsequent I/O access from user space will * trigger a #GP. * * This is correct even when VMEXIT rewrites the TSS limit * to 0x67 as the only requirem...
cwe
CWE-276
C/C++
size_t OpenMP4SourceUDTA(char *filename) { mp4object *mp4 = (mp4object *)malloc(sizeof(mp4object)); if (mp4 == NULL) return 0; memset(mp4, 0, sizeof(mp4object)); #ifdef _WINDOWS fopen_s(&mp4->mediafp, filename, "rb"); #else mp4->mediafp = fopen(filename, "rb"); #endif if (mp4->mediafp) { uint32_t qttag, qts...
cwe
CWE-787
Unknown
function deleteProject(user, name) { if (activeProject && activeProject.name === name) { var e = new Error("NLS: Can't delete the active project"); e.code = "cannot_delete_active_project"; throw e; } var projectPath = fspath.join(projectsDir,name); return Projects.delete(user, pr...
cwe
CWE-22
JavaScript
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
cwe
CWE-352
Python
cib_remote_dispatch(gpointer user_data) { cib_t *cib = user_data; cib_remote_opaque_t *private = cib->variant_opaque; xmlNode *msg = NULL; const char *type = NULL; crm_info("Message on callback channel"); msg = crm_recv_remote_msg(private->callback.session, private->callback.encrypted);...
cwe
CWE-399
C/C++
*/ static void mysql_prune_stmt_list(MYSQL *mysql) { LIST *element= mysql->stmts; LIST *pruned_list= 0; for (; element; element= element->next) { MYSQL_STMT *stmt= (MYSQL_STMT *) element->data; if (stmt->state != MYSQL_STMT_INIT_DONE) { stmt->mysql= 0; stmt->last_errno= CR_SERVER_LOST; ...
cwe
CWE-416
Unknown
public function onRouteShutdown(Enlight_Controller_EventArgs $args) { $request = $args->getRequest(); $response = $args->getResponse(); if (Shopware()->Container()->initialized('shop')) { /** @var DetachedShop $shop */ $shop = $this->get('shop'); if ($re...
cwe
CWE-601
PHP
static int diffie_hellman_sha256(LIBSSH2_SESSION *session, _libssh2_bn *g, _libssh2_bn *p, int group_order, unsigned char packet_type_init, unsigned char p...
cwe
CWE-200
Unknown
int test_mod_exp(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *e; int i; a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); BN_one(a); BN_one(b); BN_zero(c); if (BN_mod_exp(d, a, b, c, ctx)) { fprintf(stderr, "BN_mod_exp with zero modulus succee...
cwe
CWE-200
Unknown
public function execute( $par ) { $user = $this->getUser(); $out = $this->getOutput(); $out->setPageTitle( wfMessage('report-title')->escaped() ); $out->addModules( 'ext.report' ); $this->checkReadOnly(); if ( !$user->isAllowed( 'report' ) ) { $out->addHTML(Html::rawElement( 'p', [ 'class' => 'er...
cwe
CWE-352
PHP
_PUBLIC_ enum ndr_err_code ndr_push_nbt_string(struct ndr_push *ndr, int ndr_flags, const char *s) { if (!(ndr_flags & NDR_SCALARS)) { return NDR_ERR_SUCCESS; } while (s && *s) { enum ndr_err_code ndr_err; char *compname; size_t complen; uint32_t offset; /* see if we have pushed the remaining string al...
cwe
CWE-400
Unknown
void UrlData::MergeFrom(const scoped_refptr<UrlData>& other) { if (ValidateDataOrigin(other->data_origin_)) { DCHECK(thread_checker_.CalledOnValidThread()); valid_until_ = std::max(valid_until_, other->valid_until_); set_length(other->length_); cacheable_ |= other->cacheable_; range_supported_ |= ...
cwe
CWE-732
C/C++
package fsutil import ( "archive/zip" "io" "io/ioutil" "os" "path" "path/filepath" ) // Mkdir alias of os.MkdirAll() func Mkdir(dirPath string, perm os.FileMode) error { return os.MkdirAll(dirPath, perm) } // MkParentDir quick create parent dir func MkParentDir(fpath string) error { dirPath := filepath.Dir(f...
cwe
CWE-22
Go
/* * Copyright 2016 Red Hat, Inc. and/or its affiliates * and other contributors as indicated by the @author tags. * * 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.apach...
cwe
CWE-863
Java
# -*- coding: utf-8 -*- from django.http import HttpRequest, HttpResponse, HttpResponseForbidden, \ HttpResponseNotFound from django.shortcuts import redirect from django.utils.translation import ugettext as _ from zerver.lib.response import json_success, json_error from zerver.lib.upload import upload_message_im...
cwe
CWE-79
Python
############################################################################## # # Copyright (c) 2004 Zope Foundation and Contributors. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS I...
cwe
CWE-200
Python
/** @odoo-module **/ import { registry } from "@web/core/registry"; import { Many2OneAvatarUserField, KanbanMany2OneAvatarUserField, many2OneAvatarUserField, kanbanMany2OneAvatarUserField, } from "@mail/web/fields/many2one_avatar_user_field/many2one_avatar_user_field"; export class Many2OneAvatarEmplo...
cwe
CWE-287
JavaScript
static void _imap_quote_string (char *dest, size_t dlen, const char *src, const char *to_quote) { char *pt; const char *s; pt = dest; s = src; *pt++ = '"'; /* save room for trailing quote-char */ dlen -= 2; for (; *s && dlen; s++) { if (strchr (to_quote, *s)) ...
cwe
CWE-787
C/C++
layer_resize(int layer, int x_size, int y_size) { int old_height; int old_width; struct map_tile* tile; int tile_width; int tile_height; struct map_tile* tilemap; struct map_trigger* trigger; struct map_zone* zone; int x, y, i; o...
cwe
CWE-190
C/C++
static enum try_read_result try_read_network(conn *c) { enum try_read_result gotdata = READ_NO_DATA_RECEIVED; int res; assert(c != NULL); if (c->rcurr != c->rbuf) { if (c->rbytes != 0) /* otherwise there's nothing to copy */ memmove(c->rbuf, c->rcurr, c->rbytes); c->rcurr =...
cwe
CWE-20
C/C++
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version ...
cwe
CWE-305
Python
#include "PipeSocketHandler.hpp" namespace et { PipeSocketHandler::PipeSocketHandler() {} int PipeSocketHandler::connect(const SocketEndpoint& endpoint) { lock_guard<std::recursive_mutex> mutexGuard(globalMutex); string pipePath = endpoint.name(); sockaddr_un remote; int sockFd = ::socket(AF_UNIX, SOCK_STRE...
cwe
CWE-362
C/C++
static void enable_nmi_window(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm = to_svm(vcpu); if ((svm->vcpu.arch.hflags & (HF_NMI_MASK | HF_IRET_MASK)) == HF_NMI_MASK) return; /* IRET will cause a vm exit */ /* * Something prevents NMI from been injected. Single step over possible * problem (IRET or exce...
cwe
CWE-399
Unknown
keystr_from_desc(KEYDB_SEARCH_DESC *desc) { switch(desc->mode) { case KEYDB_SEARCH_MODE_LONG_KID: case KEYDB_SEARCH_MODE_SHORT_KID: return keystr(desc->u.kid); case KEYDB_SEARCH_MODE_FPR20: { u32 keyid[2]; keyid[0] = ((unsigned char)desc->u.fpr[12] << 24 | (unsigned...
cwe
CWE-20
Unknown
R_API char *r_socket_http_get(const char *url, int *code, int *rlen) { char *curl_env = r_sys_getenv ("R2_CURL"); if (curl_env && *curl_env) { char *encoded_url = r_str_escape (url); char *res = r_sys_cmd_strf ("curl '%s'", encoded_url); free (encoded_url); if (res) { if (code) { *code = 200; } i...
cwe
CWE-78
C/C++
def set_node_utilization(params, reqest, session) unless allowed_for_local_cluster(session, Permissions::WRITE) return 403, 'Permission denied' end unless params[:node] and params[:name] return 400, 'node and name are required' end node = params[:node] name = params[:name] value = params[:value]...
cwe
CWE-384
Ruby
static Image *ReadTXTImage(const ImageInfo *image_info,ExceptionInfo *exception) { char colorspace[MaxTextExtent], text[MaxTextExtent]; Image *image; IndexPacket *indexes; long x_offset, y_offset; MagickBooleanType status; MagickPixelPacket pixel; QuantumAny range...
cwe
CWE-835
C/C++
function cellClicked(cell) { // Forces focusout in IE if (!ui.editor.isChromelessView()) { graph.container.focus(); } // Gets the selection cell if (cell == null) { highlight.highlight(null); div.innerHTML = '<p><i>' + mxResources.get('nothingIsSelected') + '</i></p>'; } else { var att...
cwe
CWE-94
JavaScript
/* * Error resilience / concealment * * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation...
cwe
CWE-617
C/C++
// SPDX-License-Identifier: GPL-2.0-or-later /* * * Copyright (C) Alan Cox GW4PTS (alan@lxorguk.ukuu.org.uk) * Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk) * Copyright (C) Darryl Miles G7LED (dlm@g7led.demon.co.uk) * Copyright (C) Steven Whitehouse GW7RRM (stevew@acm.org) * Copyright (C) Joerg Re...
cwe
CWE-476
C/C++
function copy(target, current) { lazy.forOwn(current, function (value, key) { var val = target[key]; // add the missing property, or allow a null property to be updated if (val == null) { target[key] = value; } else if (lazy.isObject(val) && lazy.isObject(value)) { defaultsDe...
cwe
CWE-20
JavaScript
static void aes_ctr_cleanup(struct ssh_cipher_struct *cipher){ explicit_bzero(cipher->aes_key, sizeof(*cipher->aes_key)); SAFE_FREE(cipher->aes_key); }
cwe
CWE-476
Unknown
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLiteDepthToSpaceParams*>(node->builtin_data); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); #define TF_LITE_DEPTH_TO_SPACE(ty...
cwe
CWE-125
C/C++
my_object_recursive1 (MyObject *obj, GArray *array, guint32 *len_ret, GError **error) { *len_ret = array->len; return TRUE; }
cwe
CWE-264
C/C++
package com.jflyfox.modules.front.controller; import com.alibaba.fastjson.JSONObject; import com.jfinal.aop.Before; import com.jfinal.plugin.activerecord.Db; import com.jfinal.plugin.activerecord.Page; import com.jfinal.plugin.activerecord.Record; import com.jflyfox.component.base.BaseProjectController; import com.jfl...
cwe
CWE-79
Java
static ssize_t driver_override_show(struct device *dev, struct device_attribute *attr, char *buf) { struct platform_device *pdev = to_platform_device(dev); ssize_t len; device_lock(dev); len = sprintf(buf, "%s\n", pdev->driver_override); device_unlock(dev); return len; }
cwe
CWE-787
Unknown
PHP_FUNCTION(getenv) { char *ptr, *str; int str_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) { RETURN_FALSE; } /* SAPI method returns an emalloc()'d string */ ptr = sapi_getenv(str, str_len TSRMLS_CC); if (ptr) { RETURN_STRING(ptr, 0); } #ifdef PHP_WIN32 { ...
cwe
CWE-601
Unknown
/* * Copyright (C) 2009 Voice Sistem SRL * Copyright (C) 2009 Andrei Dragus * * This file is part of opensips, a free SIP server. * * opensips 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 ver...
cwe
CWE-770
C/C++
bool load_face(Face & face, unsigned int options) { #ifdef GRAPHITE2_TELEMETRY telemetry::category _misc_cat(face.tele.misc); #endif Face::Table silf(face, Tag::Silf, 0x00050000); if (silf) options &= ~gr_face_dumbRendering; else if (!(options & gr_face_dumbRendering)) ...
cwe
CWE-476
C/C++
static ssize_t o2nm_node_local_store(struct config_item *item, const char *page, size_t count) { struct o2nm_node *node = to_o2nm_node(item); struct o2nm_cluster *cluster = to_o2nm_cluster_from_node(node); unsigned long tmp; char *p = (char *)page; ssize_t ret; tmp = simple_strtoul(p, &p, 0); if (!p ||...
cwe
CWE-476
Unknown
/** * Based on Kendo UI Core expression code <https://github.com/telerik/kendo-ui-core#license-information> */ 'use strict' function Cache(maxSize) { this._maxSize = maxSize this.clear() } Cache.prototype.clear = function() { this._size = 0 this._values = Object.create(null) } Cache.prototype.get = function(...
cwe
CWE-20
JavaScript
/* * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * th...
cwe
CWE-79
Java
static void vhost_net_ubuf_put_and_wait(struct vhost_net_ubuf_ref *ubufs) { kref_put(&ubufs->kref, vhost_net_zerocopy_done_signal); wait_event(ubufs->wait, !atomic_read(&ubufs->kref.refcount)); kfree(ubufs); }
cwe
CWE-399
C/C++
__version__ = "1.2.1-dev"
cwe
CWE-125
Python
int main(int argc, char **argv) { /* I18n */ setlocale(LC_ALL, ""); #if ENABLE_NLS bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); #endif abrt_init(argv); /* Can't keep these strings/structs static: _() doesn't support that */ const char *program_usage_string = _( "& [-y] ...
cwe
CWE-59
C/C++
l_noret luaG_runerror (lua_State *L, const char *fmt, ...) { CallInfo *ci = L->ci; const char *msg; va_list argp; luaC_checkGC(L); /* error message uses memory */ va_start(argp, fmt); msg = luaO_pushvfstring(L, fmt, argp); /* format message */ va_end(argp); if (isLua(ci)) /* if Lua function, add sour...
cwe
CWE-787
Unknown
create_policy_2_svc(cpol_arg *arg, struct svc_req *rqstp) { static generic_ret ret; char *prime_arg; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; cons...
cwe
CWE-772
C/C++
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % ...
cwe
CWE-119
C/C++
# -*- coding: utf-8 -*- # This file is part of wger Workout Manager. # # wger Workout Manager 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 version 3 of the License, or # (at your option) any ...
cwe
CWE-307
Python
static int asf_build_simple_index(AVFormatContext *s, int stream_index) { ff_asf_guid g; ASFContext *asf = s->priv_data; int64_t current_pos = avio_tell(s->pb); int64_t ret; if((ret = avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET)) < 0) { return ret; } ...
cwe
CWE-400
C/C++
GURL URLFixerUpper::FixupRelativeFile(const FilePath& base_dir, const FilePath& text) { FilePath old_cur_directory; if (!base_dir.empty()) { file_util::GetCurrentDirectory(&old_cur_directory); file_util::SetCurrentDirectory(base_dir); } FilePath::StringType trimmed...
cwe
CWE-20
C/C++
def file_parse(key) file_path = File.join(@root_folder, key) url_path, is_dir = file_path.sub(Rails.root.join('public').to_s, ''), File.directory?(file_path) res = { "name" => File.basename(key), "folder_path" => File.dirname(key), "url" => is_dir ? '' : (is_private_uploader? ? url_p...
cwe
CWE-755
Ruby
rsa_sec_blind (const struct rsa_public_key *pub, void *random_ctx, nettle_random_func *random, mp_limb_t *c, mp_limb_t *ri, const mp_limb_t *m, mp_size_t mn) { const mp_limb_t *ep = mpz_limbs_read (pub->e); const mp_limb_t *np = mpz_limbs_read (pub->n); mp_bitcnt_t ebn...
cwe
CWE-20
Unknown
int sequencer_write(int dev, struct file *file, const char __user *buf, int count) { unsigned char event_rec[EV_SZ], ev_code; int p = 0, c, ev_size; int mode = translate_mode(file); dev = dev >> 4; DEB(printk("sequencer_write(dev=%d, count=%d)\n", dev, count)); if (mode == OPEN_READ) return -EIO; c = count...
cwe
CWE-703
Unknown
static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflen) { struct page *pages[NFS4ACL_MAXPAGES] = {NULL, }; struct nfs_getaclargs args = { .fh = NFS_FH(inode), .acl_pages = pages, .acl_len = buflen, }; struct nfs_getaclres res = { .acl_len = buflen, }; void *resp_buf; struct ...
cwe
CWE-189
C/C++
/* * Copyright (c) 2012-2019 Belledonne Communications SARL. * * This file is part of belle-sip. * * 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 3 of the License, or * (...
cwe
CWE-404
C/C++
package com.zrlog.web.controller.blog; import com.zrlog.common.Constants; import com.zrlog.common.request.CreateCommentRequest; import com.zrlog.common.response.CreateCommentResponse; import com.zrlog.model.Comment; import com.zrlog.model.Log; import com.zrlog.model.Type; import com.zrlog.service.ArticleService; impor...
cwe
CWE-79
Java
function(J){k=J};this.setAutoScroll=function(J){m=J};this.setOpenFill=function(J){q=J};this.setStopClickEnabled=function(J){A=J};this.setSelectInserted=function(J){z=J};this.setSmoothing=function(J){l=J};this.setPerfectFreehandMode=function(J){M=J};this.setBrushSize=function(J){L.size=J};this.getBrushSize=function(){re...
cwe
CWE-20
JavaScript
static ut64 estimate_slide(RBinFile *bf, RDyldCache *cache, ut64 value_mask, ut64 value_add) { ut64 slide = 0; if (cache->n_hdr > 1) { return slide; } ut64 *classlist = malloc (64); if (!classlist) { goto beach; } RListIter *iter; RDyldBinImage *bin; r_list_foreach (cache->bins, iter, bin) { bool found_...
cwe
CWE-703
Unknown
function chatEndpoints(app) { if (!app) return; app.post( "/workspace/:slug/chat", [validatedRequest], async (request, response) => { try { const user = await userFromSession(request, response); const { slug } = request.params; const { message, mode = "query" } = reqBody(r...
cwe
CWE-305
JavaScript
private function encloseForCSV($field) { return '"' . cleanCSV($field) . '"'; }
cwe
CWE-1236
PHP
int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, ASN1_BIT_STRING *signature, void *asn, EVP_PKEY *pkey) { EVP_MD_CTX ctx; const EVP_MD *type; unsigned char *buf_in=NULL; int ret= -1,i,inl; if (!pkey) { ASN1err(ASN1_F_ASN1_ITEM_VERIFY, ERR_R_PASSED_NULL_PARAMETER); return -1; } EVP_MD_CTX_...
cwe
CWE-310
Unknown
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
cwe
CWE-617
Python
OMX_ERRORTYPE SoftRaw::internalGetParameter( OMX_INDEXTYPE index, OMX_PTR params) { switch (index) { case OMX_IndexParamAudioPcm: { OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams = (OMX_AUDIO_PARAM_PCMMODETYPE *)params; if (pcmParams->nPortIndex != 0 && pcmParams->nPortI...
cwe
CWE-119
C/C++