diff --git "a/validation.jsonl" "b/validation.jsonl" --- "a/validation.jsonl" +++ "b/validation.jsonl" @@ -1,6454 +1,5259 @@ -{"code": " it 'is valid with valid attributes' do\n notification = build(:notification)\n\n expect(notification).to be_valid\n end", "label": 0, "label_name": "vulnerable"} -{"code": " def test_dump(self):\n node = ast.parse('spam(eggs, \"and cheese\")')\n self.assertEqual(ast.dump(node),\n \"Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load()), \"\n \"args=[Name(id='eggs', ctx=Load()), Constant(value='and cheese')], \"\n \"keywords=[]))])\"\n )\n self.assertEqual(ast.dump(node, annotate_fields=False),\n \"Module([Expr(Call(Name('spam', Load()), [Name('eggs', Load()), \"\n \"Constant('and cheese')], []))])\"\n )\n self.assertEqual(ast.dump(node, include_attributes=True),\n \"Module(body=[Expr(value=Call(func=Name(id='spam', ctx=Load(), \"\n \"lineno=1, col_offset=0, end_lineno=1, end_col_offset=4), \"\n \"args=[Name(id='eggs', ctx=Load(), lineno=1, col_offset=5, \"\n \"end_lineno=1, end_col_offset=9), Constant(value='and cheese', \"\n \"lineno=1, col_offset=11, end_lineno=1, end_col_offset=23)], keywords=[], \"\n \"lineno=1, col_offset=0, end_lineno=1, end_col_offset=24), \"\n \"lineno=1, col_offset=0, end_lineno=1, end_col_offset=24)])\"\n )", "label": 0, "label_name": "vulnerable"} -{"code": " it { should contain_postgresql__server__config_entry('config_entry') }", "label": 0, "label_name": "vulnerable"} -{"code": " public function setFlashCookieObject($name, $object, $time = 60)\n {\n setcookie($name, json_encode($object, JSON_THROW_ON_ERROR), $this->getCookieOptions($time));\n\n return $this;\n }", "label": 1, "label_name": "safe"} -{"code": "void imap_quote_string(char *dest, size_t dlen, const char *src, bool quote_backtick)\n{\n const char *quote = \"`\\\"\\\\\";\n if (!quote_backtick)\n quote++;\n\n char *pt = dest;\n const char *s = src;\n\n *pt++ = '\"';\n /* save room for trailing quote-char */\n dlen -= 2;\n\n for (; *s && dlen; s++)\n {\n if (strchr(quote, *s))\n {\n dlen -= 2;\n if (dlen == 0)\n break;\n *pt++ = '\\\\';\n *pt++ = *s;\n }\n else\n {\n *pt++ = *s;\n dlen--;\n }\n }\n *pt++ = '\"';\n *pt = '\\0';\n}", "label": 1, "label_name": "safe"} -{"code": "function Session(client, info, localChan) {\n this.subtype = undefined;\n\n var ending = false;\n var self = this;\n var outgoingId = info.sender;\n var channel;\n\n var chaninfo = {\n type: 'session',\n incoming: {\n id: localChan,\n window: Channel.MAX_WINDOW,\n packetSize: Channel.PACKET_SIZE,\n state: 'open'\n },\n outgoing: {\n id: info.sender,\n window: info.window,\n packetSize: info.packetSize,\n state: 'open'\n }\n };\n\n function onREQUEST(info) {\n var replied = false;\n var accept;\n var reject;\n\n if (info.wantReply) {\n // \"real session\" requests will have custom accept behaviors\n if (info.request !== 'shell'\n && info.request !== 'exec'\n && info.request !== 'subsystem') {\n accept = function() {\n if (replied || ending || channel)\n return;\n\n replied = true;\n\n return client._sshstream.channelSuccess(outgoingId);\n };\n }\n\n reject = function() {\n if (replied || ending || channel)\n return;\n\n replied = true;\n\n return client._sshstream.channelFailure(outgoingId);\n };\n }\n\n if (ending) {\n reject && reject();\n return;\n }\n\n switch (info.request) {\n // \"pre-real session start\" requests\n case 'env':\n if (listenerCount(self, 'env')) {\n self.emit('env', accept, reject, {\n key: info.key,\n val: info.val\n });\n } else\n reject && reject();\n break;\n case 'pty-req':\n if (listenerCount(self, 'pty')) {\n self.emit('pty', accept, reject, {\n cols: info.cols,\n rows: info.rows,\n width: info.width,\n height: info.height,\n term: info.term,\n modes: info.modes,\n });\n } else\n reject && reject();\n break;\n case 'window-change':\n if (listenerCount(self, 'window-change')) {\n self.emit('window-change', accept, reject, {\n cols: info.cols,\n rows: info.rows,\n width: info.width,\n height: info.height\n });\n } else\n reject && reject();\n break;\n case 'x11-req':\n if (listenerCount(self, 'x11')) {\n self.emit('x11', accept, reject, {\n single: info.single,\n protocol: info.protocol,\n cookie: info.cookie,\n screen: info.screen\n });\n } else\n reject && reject();\n break;\n // \"post-real session start\" requests\n case 'signal':\n if (listenerCount(self, 'signal')) {\n self.emit('signal', accept, reject, {\n name: info.signal\n });\n } else\n reject && reject();\n break;\n // XXX: is `auth-agent-req@openssh.com` really \"post-real session start\"?\n case 'auth-agent-req@openssh.com':\n if (listenerCount(self, 'auth-agent'))\n self.emit('auth-agent', accept, reject);\n else\n reject && reject();\n break;\n // \"real session start\" requests\n case 'shell':\n if (listenerCount(self, 'shell')) {\n accept = function() {\n if (replied || ending || channel)\n return;\n\n replied = true;\n\n if (info.wantReply)\n client._sshstream.channelSuccess(outgoingId);\n\n channel = new Channel(chaninfo, client, { server: true });\n\n channel.subtype = self.subtype = info.request;\n\n return channel;\n };\n\n self.emit('shell', accept, reject);\n } else\n reject && reject();\n break;\n case 'exec':\n if (listenerCount(self, 'exec')) {\n accept = function() {\n if (replied || ending || channel)\n return;\n\n replied = true;\n\n if (info.wantReply)\n client._sshstream.channelSuccess(outgoingId);\n\n channel = new Channel(chaninfo, client, { server: true });\n\n channel.subtype = self.subtype = info.request;\n\n return channel;\n };\n\n self.emit('exec', accept, reject, {\n command: info.command\n });\n } else\n reject && reject();\n break;\n case 'subsystem':\n accept = function() {\n if (replied || ending || channel)\n return;\n\n replied = true;\n\n if (info.wantReply)\n client._sshstream.channelSuccess(outgoingId);\n\n channel = new Channel(chaninfo, client, { server: true });\n\n channel.subtype = self.subtype = (info.request + ':' + info.subsystem);\n\n if (info.subsystem === 'sftp') {\n var sftp = new SFTPStream({\n server: true,\n debug: client._sshstream.debug\n });\n channel.pipe(sftp).pipe(channel);\n\n return sftp;\n } else\n return channel;\n };\n\n if (info.subsystem === 'sftp' && listenerCount(self, 'sftp'))\n self.emit('sftp', accept, reject);\n else if (info.subsystem !== 'sftp' && listenerCount(self, 'subsystem')) {\n self.emit('subsystem', accept, reject, {\n name: info.subsystem\n });\n } else\n reject && reject();\n break;\n default:\n reject && reject();\n }\n }\n function onEOF() {\n ending = true;\n self.emit('eof');\n self.emit('end');\n }\n function onCLOSE() {\n ending = true;\n self.emit('close');\n }\n client._sshstream\n .on('CHANNEL_REQUEST:' + localChan, onREQUEST)\n .once('CHANNEL_EOF:' + localChan, onEOF)\n .once('CHANNEL_CLOSE:' + localChan, onCLOSE);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu)\n{\n\tstruct kvm_pit *pit = vcpu->kvm->arch.vpit;\n\tstruct hrtimer *timer;\n\n\tif (!kvm_vcpu_is_bsp(vcpu) || !pit)\n\t\treturn;\n\n\ttimer = &pit->pit_state.timer;\n\tmutex_lock(&pit->pit_state.lock);\n\tif (hrtimer_cancel(timer))\n\t\thrtimer_start_expires(timer, HRTIMER_MODE_ABS);\n\tmutex_unlock(&pit->pit_state.lock);\n}", "label": 1, "label_name": "safe"} -{"code": " public function splice($t, $delete, $replacement) {\n // delete\n $old = array();\n $r = $t;\n for ($i = $delete; $i > 0; $i--) {\n $old[] = $r;\n $r = $this->delete();\n }\n // insert\n for ($i = count($replacement)-1; $i >= 0; $i--) {\n $this->insertAfter($r);\n $r = $replacement[$i];\n }\n return array($old, $r);\n }", "label": 1, "label_name": "safe"} -{"code": "null);z.apply(this,arguments)};var L=EditorUi.prototype.setGraphEnabled;EditorUi.prototype.setGraphEnabled=function(B){L.apply(this,arguments);if(B){var F=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;1E3<=F&&null!=this.sidebarWindow&&\"1\"!=urlParams.sketch&&this.sidebarWindow.window.setVisible(!0);null!=this.formatWindow&&(1E3<=F||\"1\"==urlParams.sketch)&&this.formatWindow.window.setVisible(!0)}else null!=this.sidebarWindow&&this.sidebarWindow.window.setVisible(!1),\nnull!=this.formatWindow&&this.formatWindow.window.setVisible(!1)};EditorUi.prototype.chromelessWindowResize=function(){};var M=DiagramFormatPanel.prototype.addView;DiagramFormatPanel.prototype.addView=function(B){B=M.apply(this,arguments);var F=this.editorUi,G=F.editor.graph;if(G.isEnabled()&&\"1\"==urlParams.sketch){var N=this.createOption(mxResources.get(\"sketch\"),function(){return Editor.sketchMode},function(J,E){F.setSketchMode(!Editor.sketchMode);null!=E&&mxEvent.isShiftDown(E)||G.updateCellStyles({sketch:J?", "label": 1, "label_name": "safe"} -{"code": " public function next($t) {\n if ($t !== NULL) array_push($this->front, $t);\n return empty($this->back) ? NULL : array_pop($this->back);\n }", "label": 1, "label_name": "safe"} -{"code": " protected function getDeprecatedServiceService()\n {\n @trigger_error('The \"deprecated_service\" service is deprecated. You should stop using it, as it will soon be removed.', E_USER_DEPRECATED);\n\n return $this->services['deprecated_service'] = new \\stdClass();\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function testSendSuccess()\n {\n $this->setMockHttpResponse('DeleteCustomerSuccess.txt');\n $response = $this->request->send();\n\n $this->assertTrue($response->isSuccessful());\n $this->assertFalse($response->isRedirect());\n $this->assertNull($response->getTransactionReference());\n $this->assertNull($response->getCustomerReference());\n $this->assertNull($response->getMessage());\n }", "label": 0, "label_name": "vulnerable"} -{"code": "static ssize_t ocfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter)\n{\n\tstruct file *file = iocb->ki_filp;\n\tstruct inode *inode = file->f_mapping->host;\n\tstruct ocfs2_super *osb = OCFS2_SB(inode->i_sb);\n\tget_block_t *get_block;\n\n\t/*\n\t * Fallback to buffered I/O if we see an inode without\n\t * extents.\n\t */\n\tif (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)\n\t\treturn 0;\n\n\t/* Fallback to buffered I/O if we do not support append dio. */\n\tif (iocb->ki_pos + iter->count > i_size_read(inode) &&\n\t !ocfs2_supports_append_dio(osb))\n\t\treturn 0;\n\n\tif (iov_iter_rw(iter) == READ)\n\t\tget_block = ocfs2_lock_get_block;\n\telse\n\t\tget_block = ocfs2_dio_wr_get_block;\n\n\treturn __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev,\n\t\t\t\t iter, get_block,\n\t\t\t\t ocfs2_dio_end_io, NULL, 0);\n}", "label": 1, "label_name": "safe"} -{"code": "function AJchangeUserGroupPrivs() {\n\tglobal $user;\n\t$node = processInputVar(\"activeNode\", ARG_NUMERIC);\n\tif(! checkUserHasPriv(\"userGrant\", $user[\"id\"], $node)) {\n\t\t$text = \"You do not have rights to modify user privileges at this node.\";\n\t\tprint \"alert('$text');\";\n\t\treturn;\n\t}\n\t$newusergrpid = processInputVar(\"item\", ARG_NUMERIC);\n\t$newusergrp = getUserGroupName($newusergrpid);\n\t$newpriv = processInputVar('priv', ARG_STRING);\n\t$newprivval = processInputVar('value', ARG_STRING);\n\t//print \"alert('node: $node; newuser:grp $newuser;grp newpriv: $newpriv; newprivval: $newprivval');\";\n\n\t# get cascade privs at this node\n\t$cascadePrivs = getNodeCascadePrivileges($node, \"usergroups\");\n\n\t// if $newprivval is true and $newusergrp already has $newpriv\n\t// cascaded to it, do nothing\n\tif($newprivval == 'true') {\n\t\tif(array_key_exists($newusergrp, $cascadePrivs['usergroups']) &&\n\t\t in_array($newpriv, $cascadePrivs['usergroups'][$newusergrp]['privs']))\n\t\t\treturn;\n\t\t// add priv\n\t\t$adds = array($newpriv);\n\t\t$removes = array();\n\t}\n\telse {\n\t\t// remove priv\n\t\t$adds = array();\n\t\t$removes = array($newpriv);\n\t}\n\tupdateUserOrGroupPrivs($newusergrpid, $node, $adds, $removes, \"group\");\n\t$_SESSION['dirtyprivs'] = 1;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function getTrackingId()\n { \n if(isset($this->ectid)) return $this->ectid;\n else return '';\n }", "label": 0, "label_name": "vulnerable"} -{"code": " private void updateSecureSessionFlag() {\n try {\n ServletContext context = Jenkins.getInstance().servletContext;\n Method m;\n try {\n m = context.getClass().getMethod(\"getSessionCookieConfig\");\n } catch (NoSuchMethodException x) { // 3.0+\n LOGGER.log(Level.FINE, \"Failed to set secure cookie flag\", x);\n return;\n }\n Object sessionCookieConfig = m.invoke(context);\n\n Class scc = Class.forName(\"javax.servlet.SessionCookieConfig\");\n Method setSecure = scc.getMethod(\"setSecure\", boolean.class);\n boolean v = fixNull(jenkinsUrl).startsWith(\"https\");\n setSecure.invoke(sessionCookieConfig, v);\n } catch (InvocationTargetException e) {\n if (e.getTargetException() instanceof IllegalStateException) {\n // servlet 3.0 spec seems to prohibit this from getting set at runtime,\n // though Winstone is happy to accept i. see JENKINS-25019\n return;\n }\n LOGGER.log(Level.WARNING, \"Failed to set secure cookie flag\", e);\n } catch (Exception e) {\n LOGGER.log(Level.WARNING, \"Failed to set secure cookie flag\", e);\n }\n }", "label": 1, "label_name": "safe"} -{"code": " def format_type(self):\n format_type = self.type.lower()\n if format_type == 'amazon':\n return u\"Amazon\"\n elif format_type.startswith(\"amazon_\"):\n return u\"Amazon.{0}\".format(format_type[7:])\n elif format_type == \"isbn\":\n return u\"ISBN\"\n elif format_type == \"doi\":\n return u\"DOI\"\n elif format_type == \"douban\":\n return u\"Douban\"\n elif format_type == \"goodreads\":\n return u\"Goodreads\"\n elif format_type == \"babelio\":\n return u\"Babelio\"\n elif format_type == \"google\":\n return u\"Google Books\"\n elif format_type == \"kobo\":\n return u\"Kobo\"\n elif format_type == \"litres\":\n return u\"\u041b\u0438\u0442\u0420\u0435\u0441\"\n elif format_type == \"issn\":\n return u\"ISSN\"\n elif format_type == \"isfdb\":\n return u\"ISFDB\"\n if format_type == \"lubimyczytac\":\n return u\"Lubimyczytac\"\n else:\n return self.type", "label": 1, "label_name": "safe"} -{"code": "chrand_principal3_2_svc(chrand3_arg *arg, struct svc_req *rqstp)\n{\n static chrand_ret ret;\n krb5_keyblock *k;\n int nkeys;\n char *prime_arg, *funcname;\n gss_buffer_desc client_name = GSS_C_EMPTY_BUFFER;\n gss_buffer_desc service_name = GSS_C_EMPTY_BUFFER;\n OM_uint32 minor_stat;\n kadm5_server_handle_t handle;\n const char *errmsg = NULL;\n\n xdr_free(xdr_chrand_ret, &ret);\n\n if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle)))\n goto exit_func;\n\n if ((ret.code = check_handle((void *)handle)))\n goto exit_func;\n\n ret.api_version = handle->api_version;\n\n funcname = \"kadm5_randkey_principal\";\n\n if (setup_gss_names(rqstp, &client_name, &service_name) < 0) {\n ret.code = KADM5_FAILURE;\n goto exit_func;\n }\n if (krb5_unparse_name(handle->context, arg->princ, &prime_arg)) {\n ret.code = KADM5_BAD_PRINCIPAL;\n goto exit_func;\n }\n\n if (cmp_gss_krb5_name(handle, rqst2name(rqstp), arg->princ)) {\n ret.code = randkey_principal_wrapper_3((void *)handle, arg->princ,\n arg->keepold,\n arg->n_ks_tuple,\n arg->ks_tuple,\n &k, &nkeys);\n } else if (!(CHANGEPW_SERVICE(rqstp)) &&\n kadm5int_acl_check(handle->context, rqst2name(rqstp),\n ACL_CHANGEPW, arg->princ, NULL)) {\n ret.code = kadm5_randkey_principal_3((void *)handle, arg->princ,\n arg->keepold,\n arg->n_ks_tuple,\n arg->ks_tuple,\n &k, &nkeys);\n } else {\n log_unauth(funcname, prime_arg,\n &client_name, &service_name, rqstp);\n ret.code = KADM5_AUTH_CHANGEPW;\n }\n\n if(ret.code == KADM5_OK) {\n ret.keys = k;\n ret.n_keys = nkeys;\n }\n\n if(ret.code != KADM5_AUTH_CHANGEPW) {\n if( ret.code != 0 )\n errmsg = krb5_get_error_message(handle->context, ret.code);\n\n log_done(funcname, prime_arg, errmsg,\n &client_name, &service_name, rqstp);\n\n if (errmsg != NULL)\n krb5_free_error_message(handle->context, errmsg);\n }\n free(prime_arg);\nexit_func:\n gss_release_buffer(&minor_stat, &client_name);\n gss_release_buffer(&minor_stat, &service_name);\n free_server_handle(handle);\n return &ret;\n}", "label": 1, "label_name": "safe"} -{"code": " def _deny_hook(self, resource=None):\n app = self.get_app()\n if current_user.is_authenticated:\n status = 403\n else:\n status = 401\n #abort(status)\n\n if app.config.get('FRONTED_BY_NGINX'):\n url = \"https://{}:{}{}\".format(app.config.get('FQDN'), app.config.get('NGINX_PORT'), '/login')\n else:\n url = \"http://{}:{}{}\".format(app.config.get('FQDN'), app.config.get('API_PORT'), '/login')\n if current_user.is_authenticated:\n auth_dict = {\n \"authenticated\": True,\n \"user\": current_user.email,\n \"roles\": current_user.role,\n }\n else:\n auth_dict = {\n \"authenticated\": False,\n \"user\": None,\n \"url\": url\n }\n\n return Response(response=json.dumps({\"auth\": auth_dict}), status=status, mimetype=\"application/json\")", "label": 1, "label_name": "safe"} -{"code": "struct ipv6_txoptions *ipv6_update_options(struct sock *sk,\n\t\t\t\t\t struct ipv6_txoptions *opt)\n{\n\tif (inet_sk(sk)->is_icsk) {\n\t\tif (opt &&\n\t\t !((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) &&\n\t\t inet_sk(sk)->inet_daddr != LOOPBACK4_IPV6) {\n\t\t\tstruct inet_connection_sock *icsk = inet_csk(sk);\n\t\t\ticsk->icsk_ext_hdr_len = opt->opt_flen + opt->opt_nflen;\n\t\t\ticsk->icsk_sync_mss(sk, icsk->icsk_pmtu_cookie);\n\t\t}\n\t}\n\topt = xchg(&inet6_sk(sk)->opt, opt);\n\tsk_dst_reset(sk);\n\n\treturn opt;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " $scope.reset = function() {\n bootbox.confirm('Are you sure you want to reset the foreign source definition to the default ?', function(ok) {\n if (ok) {\n RequisitionsService.startTiming();\n RequisitionsService.deleteForeignSourceDefinition($scope.foreignSource).then(\n function() { // success\n growl.success('The foreign source definition for ' + _.escape($scope.foreignSource) + 'has been reseted.');\n $scope.initialize();\n },\n $scope.errorHandler\n );\n }\n });\n };", "label": 1, "label_name": "safe"} -{"code": "mxTooltipHandler.prototype.reset=function(a,b,c){if(!this.ignoreTouchEvents||mxEvent.isMouseEvent(a.getEvent()))if(this.resetTimer(),c=null!=c?c:this.getStateForEvent(a),b&&this.isEnabled()&&null!=c&&(null==this.div||\"hidden\"==this.div.style.visibility)){var d=a.getSource(),e=a.getX(),f=a.getY(),g=a.isSource(c.shape)||a.isSource(c.text);this.thread=window.setTimeout(mxUtils.bind(this,function(){if(!this.graph.isEditing()&&!this.graph.popupMenuHandler.isMenuShowing()&&!this.graph.isMouseDown){var k=\nthis.graph.getTooltip(c,d,e,f);this.show(k,e,f);this.state=c;this.node=d;this.stateSource=g}}),this.delay)}};mxTooltipHandler.prototype.hide=function(){this.resetTimer();this.hideTooltip()};mxTooltipHandler.prototype.hideTooltip=function(){null!=this.div&&(this.div.style.visibility=\"hidden\",this.div.innerHTML=\"\")};", "label": 0, "label_name": "vulnerable"} -{"code": "DECLAREreadFunc(readContigTilesIntoBuffer)\n{\n\tint status = 1;\n\ttsize_t tilesize = TIFFTileSize(in);\n\ttdata_t tilebuf;\n\tuint32 imagew = TIFFScanlineSize(in);\n\tuint32 tilew = TIFFTileRowSize(in);\n\tint64 iskew = (int64)imagew - (int64)tilew;\n\tuint8* bufp = (uint8*) buf;\n\tuint32 tw, tl;\n\tuint32 row;\n\n\t(void) spp;\n\ttilebuf = _TIFFmalloc(tilesize);\n\tif (tilebuf == 0)\n\t\treturn 0;\n\t_TIFFmemset(tilebuf, 0, tilesize);\n\t(void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);\n\t(void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);\n \n\tfor (row = 0; row < imagelength; row += tl) {\n\t\tuint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;\n\t\tuint32 colb = 0;\n\t\tuint32 col;\n\n\t\tfor (col = 0; col < imagewidth && colb < imagew; col += tw) {\n\t\t\tif (TIFFReadTile(in, tilebuf, col, row, 0, 0) < 0\n\t\t\t && !ignore) {\n\t\t\t\tTIFFError(TIFFFileName(in),\n\t\t\t\t \"Error, can't read tile at %lu %lu\",\n\t\t\t\t (unsigned long) col,\n\t\t\t\t (unsigned long) row);\n\t\t\t\tstatus = 0;\n\t\t\t\tgoto done;\n\t\t\t}\n\t\t\tif (colb > iskew) {\n\t\t\t\tuint32 width = imagew - colb;\n\t\t\t\tuint32 oskew = tilew - width;\n\t\t\t\tcpStripToTile(bufp + colb,\n\t\t\t\t tilebuf, nrow, width,\n\t\t\t\t oskew + iskew, oskew );\n\t\t\t} else\n\t\t\t\tcpStripToTile(bufp + colb,\n\t\t\t\t tilebuf, nrow, tilew,\n\t\t\t\t iskew, 0);\n\t\t\tcolb += tilew;\n\t\t}\n\t\tbufp += imagew * nrow;\n\t}\ndone:\n\t_TIFFfree(tilebuf);\n\treturn status;\n}", "label": 1, "label_name": "safe"} -{"code": "-1;d=b.parent?b.getIndex():-1}return c>d?1:-1})},param:function(a){a.children=[];a.isEmpty=true;return a},span:function(a){a.attributes[\"class\"]==\"Apple-style-span\"&&delete a.name},html:function(a){delete a.attributes.contenteditable;delete a.attributes[\"class\"]},body:function(a){delete a.attributes.spellcheck;delete a.attributes.contenteditable},style:function(a){var b=a.children[0];if(b&&b.value)b.value=CKEDITOR.tools.trim(b.value);if(!a.attributes.type)a.attributes.type=\"text/css\"},title:function(a){var b=", "label": 1, "label_name": "safe"} -{"code": " free() {\n this._dead = true;\n }", "label": 1, "label_name": "safe"} -{"code": "this.customFonts)))}finally{U.getModel().endUpdate()}}}));this.editorUi.showDialog(W.container,380,Editor.enableWebFonts?250:180,!0,!0);W.init()}),y,null,!0)})))}})();function DiagramPage(b,f){this.node=b;null!=f?this.node.setAttribute(\"id\",f):null==this.getId()&&this.node.setAttribute(\"id\",Editor.guid())}DiagramPage.prototype.node=null;DiagramPage.prototype.root=null;DiagramPage.prototype.viewState=null;DiagramPage.prototype.getId=function(){return this.node.getAttribute(\"id\")};DiagramPage.prototype.getName=function(){return this.node.getAttribute(\"name\")};", "label": 0, "label_name": "vulnerable"} -{"code": " public static function tearDownAfterClass()\n {\n @unlink(self::$cacheFile);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "function getResourceGroupID($groupdname) {\n\tlist($type, $name) = explode('/', $groupdname);\n\t$query = \"SELECT g.id \"\n\t . \"FROM resourcegroup g, \"\n\t . \"resourcetype t \"\n\t . \"WHERE g.name = '$name' AND \"\n\t . \"t.name = '$type' AND \"\n\t . \"g.resourcetypeid = t.id\";\n\t$qh = doQuery($query, 371);\n\tif($row = mysql_fetch_row($qh))\n\t\treturn $row[0];\n\telse\n\t\treturn NULL;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public void translate(ServerEntityTeleportPacket packet, GeyserSession session) {\n Entity entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());\n if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {\n entity = session.getPlayerEntity();\n }\n if (entity == null) return;\n\n entity.teleport(session, Vector3f.from(packet.getX(), packet.getY(), packet.getZ()), packet.getYaw(), packet.getPitch(), packet.isOnGround());\n }", "label": 0, "label_name": "vulnerable"} -{"code": "def remove_acl_remote(params, request, session)\n if not allowed_for_local_cluster(session, Permissions::GRANT)\n return 403, 'Permission denied'\n end\n if params[\"item\"] == \"permission\"\n retval = remove_acl_permission(session, params[\"acl_perm_id\"])\n elsif params[\"item\"] == \"usergroup\"\n retval = remove_acl_usergroup(\n session, params[\"role_id\"],params[\"usergroup_id\"]\n )\n else\n retval = \"Error: Unknown removal request\"\n end\n\n if retval == \"\"\n return [200, \"Successfully removed permission from role\"]\n else\n return [400, retval]\n end\nend", "label": 0, "label_name": "vulnerable"} -{"code": " public static function sanitizeGetParams () {\n //sanitize get params\n $whitelist = array(\n 'fg', 'bgc', 'font', 'bs', 'bc', 'iframeHeight'\n );\n $_GET = array_intersect_key($_GET, array_flip($whitelist));\n //restrict param values, alphanumeric, # for color vals, comma for tag list, . for decimals\n $_GET = preg_replace('/[^a-zA-Z0-9#,.]/', '', $_GET);\n return $_GET;\n }", "label": 1, "label_name": "safe"} -{"code": " public function loadFiles($dir, $name, $method) {\n return parent::loadFiles($dir, $name, $method);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "static void hugepage_subpool_put_pages(struct hugepage_subpool *spool,\n\t\t\t\t long delta)\n{\n\tif (!spool)\n\t\treturn;\n\n\tspin_lock(&spool->lock);\n\tspool->used_hpages -= delta;\n\t/* If hugetlbfs_put_super couldn't free spool due to\n\t* an outstanding quota reference, free it now. */\n\tunlock_or_release_subpool(spool);\n}", "label": 1, "label_name": "safe"} -{"code": "f.appendChild(e);this.container=f},NewDialog=function(b,f,l,d,u,t,D,c,e,g,k,m,q,v,x,A,z,L){function M(pa){null!=pa&&(Fa=xa=pa?135:140);pa=!0;if(null!=Ma)for(;H {\n if (err) {\n cb(err);\n return;\n }\n\n reqSubsystem(chan, name, (err, stream) => {\n if (err) {\n cb(err);\n return;\n }\n\n cb(undefined, stream);\n });\n });\n\n return this;\n }", "label": 1, "label_name": "safe"} -{"code": "c,b){var e=function(h,f,l){var p=function(n){n&&(this.res=n)};p.prototype=h;p.prototype.constructor=p;h=new p(l);for(var k in f||{})l=f[k],h[k]=l.slice?l.slice():l;return h},g={res:e(c.res,b.res)};g.formatter=e(c.formatter,b.formatter,g.res);g.parser=e(c.parser,b.parser,g.res);t[a]=g};d.compile=function(a){for(var c=/\\[([^\\[\\]]*|\\[[^\\[\\]]*\\])*\\]|([A-Za-z])\\2+|\\.{3}|./g,b,e=[a];b=c.exec(a);)e[e.length]=b[0];return e};d.format=function(a,c,b){c=\"string\"===typeof c?d.compile(c):c;a=d.addMinutes(a,b?\na.getTimezoneOffset():0);var e=t[m].formatter,g=\"\";a.utc=b||!1;b=1;for(var h=c.length,f;bencodepfunc != NULL);\n\tassert(sp->encodetile != NULL);\n\n /* \n * Do predictor manipulation in a working buffer to avoid altering\n * the callers buffer. http://trac.osgeo.org/gdal/ticket/1965\n */\n working_copy = (uint8*) _TIFFmalloc(cc0);\n if( working_copy == NULL )\n {\n TIFFErrorExt(tif->tif_clientdata, module, \n \"Out of memory allocating \" TIFF_SSIZE_FORMAT \" byte temp buffer.\",\n cc0 );\n return 0;\n }\n memcpy( working_copy, bp0, cc0 );\n bp = working_copy;\n\n\trowsize = sp->rowsize;\n\tassert(rowsize > 0);\n\tif((cc0%rowsize)!=0)\n {\n TIFFErrorExt(tif->tif_clientdata, \"PredictorEncodeTile\",\n \"%s\", \"(cc0%rowsize)!=0\");\n _TIFFfree( working_copy );\n return 0;\n }\n\twhile (cc > 0) {\n\t\t(*sp->encodepfunc)(tif, bp, rowsize);\n\t\tcc -= rowsize;\n\t\tbp += rowsize;\n\t}\n\tresult_code = (*sp->encodetile)(tif, working_copy, cc0, s);\n\n _TIFFfree( working_copy );\n\n return result_code;\n}", "label": 1, "label_name": "safe"} -{"code": "size_t TLSInStream::overrun(size_t itemSize, size_t nItems, bool wait)\n{\n if (itemSize > bufSize)\n throw Exception(\"TLSInStream overrun: max itemSize exceeded\");\n\n if (end - ptr != 0)\n memmove(start, ptr, end - ptr);\n\n offset += ptr - start;\n end -= ptr - start;\n ptr = start;\n\n while (end < start + itemSize) {\n size_t n = readTLS((U8*) end, start + bufSize - end, wait);\n if (!wait && n == 0)\n return 0;\n end += n;\n }\n\n if (itemSize * nItems > (size_t)(end - ptr))\n nItems = (end - ptr) / itemSize;\n\n return nItems;\n}", "label": 1, "label_name": "safe"} -{"code": " it 'squeezes strings' do\n pp = <<-EOS\n $a = \"wallless laparohysterosalpingooophorectomy brrr goddessship\"\n $o = squeeze($a)\n notice(inline_template('squeeze is <%= @o.inspect %>'))\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/squeeze is \"wales laparohysterosalpingophorectomy br godeship\"/)\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": "func canonicalMIMEHeaderKey(a []byte) string {\n\tupper := true\n\tfor i, c := range a {\n\t\t// Canonicalize: first letter upper case\n\t\t// and upper case after each dash.\n\t\t// (Host, User-Agent, If-Modified-Since).\n\t\t// MIME headers are ASCII only, so no Unicode issues.\n\t\tif c == ' ' {\n\t\t\tc = '-'\n\t\t} else if upper && 'a' <= c && c <= 'z' {\n\t\t\tc -= toLower\n\t\t} else if !upper && 'A' <= c && c <= 'Z' {\n\t\t\tc += toLower\n\t\t}\n\t\ta[i] = c\n\t\tupper = c == '-' // for next time\n\t}\n\t// The compiler recognizes m[string(byteSlice)] as a special\n\t// case, so a copy of a's bytes into a new string does not\n\t// happen in this map lookup:\n\tif v := commonHeader[string(a)]; v != \"\" {\n\t\treturn v\n\t}\n\treturn string(a)\n}", "label": 0, "label_name": "vulnerable"} -{"code": "c.executeLayoutList(L);c.customLayoutConfig=L}catch(C){c.handleError(C),null!=window.console&&console.error(C)}},null,null,null,null,null,!0,null,null,\"https://www.diagrams.net/doc/faq/apply-layouts\");c.showDialog(t.container,620,460,!0,!0);t.init()});l=this.get(\"layout\");var y=l.funct;l.funct=function(t,z){y.apply(this,arguments);t.addItem(mxResources.get(\"orgChart\"),null,function(){function L(){\"undefined\"!==typeof mxOrgChartLayout||c.loadingOrgChart||c.isOffline(!0)?K():c.spinner.spin(document.body,\nmxResources.get(\"loading\"))&&(c.loadingOrgChart=!0,\"1\"==urlParams.dev?mxscript(\"js/orgchart/bridge.min.js\",function(){mxscript(\"js/orgchart/bridge.collections.min.js\",function(){mxscript(\"js/orgchart/OrgChart.Layout.min.js\",function(){mxscript(\"js/orgchart/mxOrgChartLayout.js\",K)})})}):mxscript(\"js/extensions.min.js\",K))}var C=null,D=20,G=20,P=!0,K=function(){c.loadingOrgChart=!1;c.spinner.stop();if(\"undefined\"!==typeof mxOrgChartLayout&&null!=C&&P){var X=c.editor.graph,u=new mxOrgChartLayout(X,C,", "label": 0, "label_name": "vulnerable"} -{"code": "\t\tprivate byte[] ReadClientHelloV2 (Stream record)\n\t\t{\n\t\t\tint msgLength = record.ReadByte ();\n\t\t\t// process further only if the whole record is available\n\t\t\tif (record.CanSeek && (msgLength + 1 > record.Length)) \n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tbyte[] message = new byte[msgLength];\n\t\t\trecord.Read (message, 0, msgLength);\n\n\t\t\tint msgType\t\t= message [0];\n\t\t\tif (msgType != 1)\n\t\t\t{\n\t\t\t\tthrow new TlsException(AlertDescription.DecodeError);\n\t\t\t}\n\t\t\tint protocol = (message [1] << 8 | message [2]);\n\t\t\tint cipherSpecLength = (message [3] << 8 | message [4]);\n\t\t\tint sessionIdLength = (message [5] << 8 | message [6]);\n\t\t\tint challengeLength = (message [7] << 8 | message [8]);\n\t\t\tint length = (challengeLength > 32) ? 32 : challengeLength;\n\n\t\t\t// Read CipherSpecs\n\t\t\tbyte[] cipherSpecV2 = new byte[cipherSpecLength];\n\t\t\tBuffer.BlockCopy (message, 9, cipherSpecV2, 0, cipherSpecLength);\n\n\t\t\t// Read session ID\n\t\t\tbyte[] sessionId = new byte[sessionIdLength];\n\t\t\tBuffer.BlockCopy (message, 9 + cipherSpecLength, sessionId, 0, sessionIdLength);\n\n\t\t\t// Read challenge ID\n\t\t\tbyte[] challenge = new byte[challengeLength];\n\t\t\tBuffer.BlockCopy (message, 9 + cipherSpecLength + sessionIdLength, challenge, 0, challengeLength);\n\t\t\n\t\t\tif (challengeLength < 16 || cipherSpecLength == 0 || (cipherSpecLength % 3) != 0)\n\t\t\t{\n\t\t\t\tthrow new TlsException(AlertDescription.DecodeError);\n\t\t\t}\n\n\t\t\t// Updated the Session ID\n\t\t\tif (sessionId.Length > 0)\n\t\t\t{\n\t\t\t\tthis.context.SessionId = sessionId;\n\t\t\t}\n\n\t\t\t// Update the protocol version\n\t\t\tthis.Context.ChangeProtocol((short)protocol);\n\n\t\t\t// Select the Cipher suite\n\t\t\tthis.ProcessCipherSpecV2Buffer(this.Context.SecurityProtocol, cipherSpecV2);\n\n\t\t\t// Updated the Client Random\n\t\t\tthis.context.ClientRandom = new byte [32]; // Always 32\n\t\t\t// 1. if challenge is bigger than 32 bytes only use the last 32 bytes\n\t\t\t// 2. right justify (0) challenge in ClientRandom if less than 32\n\t\t\tBuffer.BlockCopy (challenge, challenge.Length - length, this.context.ClientRandom, 32 - length, length);\n\n\t\t\t// Set \n\t\t\tthis.context.LastHandshakeMsg = HandshakeType.ClientHello;\n\t\t\tthis.context.ProtocolNegotiated = true;\n\n\t\t\treturn message;\n\t\t}", "label": 0, "label_name": "vulnerable"} -{"code": " def _handle_carbon_received(self, msg):\n if msg['from'].bare == self.xmpp.boundjid.bare:\n self.xmpp.event('carbon_received', msg)", "label": 1, "label_name": "safe"} -{"code": "TagSearch.prototype.makeKeyUpHandler = function() {\n var me = this;\n return function(evt) {\n var keyCode = getKeyCode(evt);\n if (me.getIsRunning() === false) {\n me.runSearch();\n }\n };\n};", "label": 1, "label_name": "safe"} -{"code": "\tpublic static function endReset( &$parser, $text ) {\n\t\tif ( !self::$createdLinks['resetdone'] ) {\n\t\t\tself::$createdLinks['resetdone'] = true;\n\t\t\tforeach ( $parser->getOutput()->mCategories as $key => $val ) {\n\t\t\t\tif ( array_key_exists( $key, self::$fixedCategories ) ) {\n\t\t\t\t\tself::$fixedCategories[$key] = $val;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// $text .= self::dumpParsedRefs($parser,\"before final reset\");\n\t\t\tif ( self::$createdLinks['resetLinks'] ) {\n\t\t\t\t$parser->getOutput()->mLinks = [];\n\t\t\t}\n\t\t\tif ( self::$createdLinks['resetCategories'] ) {\n\t\t\t\t$parser->getOutput()->mCategories = self::$fixedCategories;\n\t\t\t}\n\t\t\tif ( self::$createdLinks['resetTemplates'] ) {\n\t\t\t\t$parser->getOutput()->mTemplates = [];\n\t\t\t}\n\t\t\tif ( self::$createdLinks['resetImages'] ) {\n\t\t\t\t$parser->getOutput()->mImages = [];\n\t\t\t}\n\t\t\t// $text .= self::dumpParsedRefs( $parser, 'after final reset' );\n\t\t\tself::$fixedCategories = [];\n\t\t}\n\t\treturn true;\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": " async def test_char_fuzz(self):\n for char in DODGY_STRINGS:\n # print(repr(char))\n\n # Create\n obj1 = await CharFields.create(char=char)\n\n # Get-by-pk, and confirm that reading is correct\n obj2 = await CharFields.get(pk=obj1.pk)\n self.assertEqual(char, obj2.char)\n\n # Update data using a queryset, confirm that update is correct\n await CharFields.filter(pk=obj1.pk).update(char=\"a\")\n await CharFields.filter(pk=obj1.pk).update(char=char)\n obj3 = await CharFields.get(pk=obj1.pk)\n self.assertEqual(char, obj3.char)\n\n # Filter by value in queryset, and confirm that it fetched the right one\n obj4 = await CharFields.get(pk=obj1.pk, char=char)\n self.assertEqual(obj1.pk, obj4.pk)\n self.assertEqual(char, obj4.char)\n\n # LIKE statements are not strict, so require all of these to match\n obj5 = await CharFields.get(\n pk=obj1.pk,\n char__startswith=char,\n char__endswith=char,\n char__contains=char,\n char__istartswith=char,\n char__iendswith=char,\n char__icontains=char,\n )\n self.assertEqual(obj1.pk, obj5.pk)\n self.assertEqual(char, obj5.char)", "label": 1, "label_name": "safe"} -{"code": "var cleanUrl = function(url) { \r\n\turl = decodeURIComponent(url);\r\n\twhile(url.indexOf('..').length > 0) { url = url.replace('..', ''); }\r\n\treturn url;\r\n};\r", "label": 0, "label_name": "vulnerable"} -{"code": " it \"returns the count\" do\n database.stub(command: { \"n\" => 4 })\n\n query.count.should eq 4\n end", "label": 0, "label_name": "vulnerable"} -{"code": " async def check_credentials(username: str, password: str) -> bool:\n return (username, password) == credentials", "label": 0, "label_name": "vulnerable"} -{"code": " public void translate(ServerSetTitleTextPacket packet, GeyserSession session) {\n String text;\n if (packet.getText() == null) { //TODO 1.17 can this happen?\n text = \" \";\n } else {\n text = MessageTranslator.convertMessage(packet.getText(), session.getLocale());\n }\n\n SetTitlePacket titlePacket = new SetTitlePacket();\n titlePacket.setType(SetTitlePacket.Type.TITLE);\n titlePacket.setText(text);\n titlePacket.setXuid(\"\");\n titlePacket.setPlatformOnlineId(\"\");\n session.sendUpstreamPacket(titlePacket);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "Renderer.prototype.del = function(text) {\n return '' + text + '';\n};", "label": 1, "label_name": "safe"} -{"code": "cdf_check_stream_offset(const cdf_stream_t *sst, const cdf_header_t *h,\n const void *p, size_t tail, int line)\n{\n\tconst char *b = (const char *)sst->sst_tab;\n\tconst char *e = ((const char *)p) + tail;\n\tsize_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?\n\t CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);\n\t(void)&line;\n\tif (e >= b && (size_t)(e - b) <= ss * sst->sst_len)\n\t\treturn 0;\n\tDPRINTF((\"%d: offset begin %p < end %p || %\" SIZE_T_FORMAT \"u\"\n\t \" > %\" SIZE_T_FORMAT \"u [%\" SIZE_T_FORMAT \"u %\"\n\t SIZE_T_FORMAT \"u]\\n\", line, b, e, (size_t)(e - b),\n\t ss * sst->sst_len, ss, sst->sst_len));\n\terrno = EFTYPE;\n\treturn -1;\n}", "label": 1, "label_name": "safe"} -{"code": " void onComplete(const Status& status, ContextImpl& context) const override {\n auto& completion_state = context.getCompletionState(this);\n if (completion_state.is_completed_) {\n return;\n }\n\n // If any of children is OK, return OK\n if (Status::Ok == status) {\n completion_state.is_completed_ = true;\n completeWithStatus(status, context);\n return;\n }\n\n // Then wait for all children to be done.\n if (++completion_state.number_completed_children_ == verifiers_.size()) {\n // Aggregate all children status into a final status.\n // JwtMissed and JwtUnknownIssuer should be treated differently than other errors.\n // JwtMissed means not Jwt token for the required provider.\n // JwtUnknownIssuer means wrong issuer for the required provider.\n Status final_status = Status::JwtMissed;\n for (const auto& it : verifiers_) {\n // Prefer errors which are not JwtMissed nor JwtUnknownIssuer.\n // Prefer JwtUnknownIssuer between JwtMissed and JwtUnknownIssuer.\n Status child_status = context.getCompletionState(it.get()).status_;\n if ((child_status != Status::JwtMissed && child_status != Status::JwtUnknownIssuer) ||\n final_status == Status::JwtMissed) {\n final_status = child_status;\n }\n }\n\n if (is_allow_missing_or_failed_) {\n final_status = Status::Ok;\n } else if (is_allow_missing_ && final_status == Status::JwtMissed) {\n final_status = Status::Ok;\n }\n completion_state.is_completed_ = true;\n completeWithStatus(final_status, context);\n }\n }", "label": 1, "label_name": "safe"} -{"code": "\tthis.getstate = function() {\n\t\tvar sel = this.fm.selectedFiles();\n\n\t\treturn !this._disabled && sel.length == 1 && sel[0].phash && !sel[0].locked ? 0 : -1;\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": "int processCommand(redisClient *c) {\n struct redisCommand *cmd;\n\n /* The QUIT command is handled separately. Normal command procs will\n * go through checking for replication and QUIT will cause trouble\n * when FORCE_REPLICATION is enabled and would be implemented in\n * a regular command proc. */\n if (!strcasecmp(c->argv[0]->ptr,\"quit\")) {\n addReply(c,shared.ok);\n c->flags |= REDIS_CLOSE_AFTER_REPLY;\n return REDIS_ERR;\n }\n\n /* Now lookup the command and check ASAP about trivial error conditions\n * such wrong arity, bad command name and so forth. */\n cmd = lookupCommand(c->argv[0]->ptr);\n if (!cmd) {\n addReplyErrorFormat(c,\"unknown command '%s'\",\n (char*)c->argv[0]->ptr);\n return REDIS_OK;\n } else if ((cmd->arity > 0 && cmd->arity != c->argc) ||\n (c->argc < -cmd->arity)) {\n addReplyErrorFormat(c,\"wrong number of arguments for '%s' command\",\n cmd->name);\n return REDIS_OK;\n }\n\n /* Check if the user is authenticated */\n if (server.requirepass && !c->authenticated && cmd->proc != authCommand) {\n addReplyError(c,\"operation not permitted\");\n return REDIS_OK;\n }\n\n /* Handle the maxmemory directive.\n *\n * First we try to free some memory if possible (if there are volatile\n * keys in the dataset). If there are not the only thing we can do\n * is returning an error. */\n if (server.maxmemory) freeMemoryIfNeeded();\n if (server.maxmemory && (cmd->flags & REDIS_CMD_DENYOOM) &&\n zmalloc_used_memory() > server.maxmemory)\n {\n addReplyError(c,\"command not allowed when used memory > 'maxmemory'\");\n return REDIS_OK;\n }\n\n /* Only allow SUBSCRIBE and UNSUBSCRIBE in the context of Pub/Sub */\n if ((dictSize(c->pubsub_channels) > 0 || listLength(c->pubsub_patterns) > 0)\n &&\n cmd->proc != subscribeCommand && cmd->proc != unsubscribeCommand &&\n cmd->proc != psubscribeCommand && cmd->proc != punsubscribeCommand) {\n addReplyError(c,\"only (P)SUBSCRIBE / (P)UNSUBSCRIBE / QUIT allowed in this context\");\n return REDIS_OK;\n }\n\n /* Only allow INFO and SLAVEOF when slave-serve-stale-data is no and\n * we are a slave with a broken link with master. */\n if (server.masterhost && server.replstate != REDIS_REPL_CONNECTED &&\n server.repl_serve_stale_data == 0 &&\n cmd->proc != infoCommand && cmd->proc != slaveofCommand)\n {\n addReplyError(c,\n \"link with MASTER is down and slave-serve-stale-data is set to no\");\n return REDIS_OK;\n }\n\n /* Loading DB? Return an error if the command is not INFO */\n if (server.loading && cmd->proc != infoCommand) {\n addReply(c, shared.loadingerr);\n return REDIS_OK;\n }\n\n /* Exec the command */\n if (c->flags & REDIS_MULTI &&\n cmd->proc != execCommand && cmd->proc != discardCommand &&\n cmd->proc != multiCommand && cmd->proc != watchCommand)\n {\n queueMultiCommand(c,cmd);\n addReply(c,shared.queued);\n } else {\n if (server.vm_enabled && server.vm_max_threads > 0 &&\n blockClientOnSwappedKeys(c,cmd)) return REDIS_ERR;\n call(c,cmd);\n }\n return REDIS_OK;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "static int do_i2c_read(struct cmd_tbl *cmdtp, int flag, int argc,\n\t\t char *const argv[])\n{\n\tuint\tchip;\n\tuint\tdevaddr, length;\n\tuint\talen;\n\tu_char *memaddr;\n\tint ret;\n#if CONFIG_IS_ENABLED(DM_I2C)\n\tstruct udevice *dev;\n#endif\n\n\tif (argc != 5)\n\t\treturn CMD_RET_USAGE;\n\n\t/*\n\t * I2C chip address\n\t */\n\tchip = hextoul(argv[1], NULL);\n\n\t/*\n\t * I2C data address within the chip. This can be 1 or\n\t * 2 bytes long. Some day it might be 3 bytes long :-).\n\t */\n\tdevaddr = hextoul(argv[2], NULL);\n\talen = get_alen(argv[2], DEFAULT_ADDR_LEN);\n\tif (alen > 3)\n\t\treturn CMD_RET_USAGE;\n\n\t/*\n\t * Length is the number of objects, not number of bytes.\n\t */\n\tlength = hextoul(argv[3], NULL);\n\n\t/*\n\t * memaddr is the address where to store things in memory\n\t */\n\tmemaddr = (u_char *)hextoul(argv[4], NULL);\n\n#if CONFIG_IS_ENABLED(DM_I2C)\n\tret = i2c_get_cur_bus_chip(chip, &dev);\n\tif (!ret && alen != -1)\n\t\tret = i2c_set_chip_offset_len(dev, alen);\n\tif (!ret)\n\t\tret = dm_i2c_read(dev, devaddr, memaddr, length);\n#else\n\tret = i2c_read(chip, devaddr, alen, memaddr, length);\n#endif\n\tif (ret)\n\t\treturn i2c_report_err(ret, I2C_ERR_READ);\n\n\treturn 0;\n}", "label": 1, "label_name": "safe"} -{"code": "static int pgx_gethdr(jas_stream_t *in, pgx_hdr_t *hdr)\n{\n\tint c;\n\tuchar buf[2];\n\n\tif ((c = jas_stream_getc(in)) == EOF) {\n\t\tgoto error;\n\t}\n\tbuf[0] = c;\n\tif ((c = jas_stream_getc(in)) == EOF) {\n\t\tgoto error;\n\t}\n\tbuf[1] = c;\n\thdr->magic = buf[0] << 8 | buf[1];\n\tif (hdr->magic != PGX_MAGIC) {\n\t\tjas_eprintf(\"invalid PGX signature\\n\");\n\t\tgoto error;\n\t}\n\tif ((c = pgx_getc(in)) == EOF || !isspace(c)) {\n\t\tgoto error;\n\t}\n\tif (pgx_getbyteorder(in, &hdr->bigendian)) {\n\t\tjas_eprintf(\"cannot get byte order\\n\");\n\t\tgoto error;\n\t}\n\tif (pgx_getsgnd(in, &hdr->sgnd)) {\n\t\tjas_eprintf(\"cannot get signedness\\n\");\n\t\tgoto error;\n\t}\n\tif (pgx_getuint32(in, &hdr->prec)) {\n\t\tjas_eprintf(\"cannot get precision\\n\");\n\t\tgoto error;\n\t}\n\tif (pgx_getuint32(in, &hdr->width)) {\n\t\tjas_eprintf(\"cannot get width\\n\");\n\t\tgoto error;\n\t}\n\tif (pgx_getuint32(in, &hdr->height)) {\n\t\tjas_eprintf(\"cannot get height\\n\");\n\t\tgoto error;\n\t}\n\treturn 0;\n\nerror:\n\treturn -1;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public static function provideGenerateInt() {\n return array(\n array(1, 1, 1),\n array(0, 1, 0),\n array(0, 255, 0),\n array(400, 655, 400),\n array(0, 65535, 257),\n array(65535, 131070, 65792),\n array(0, 16777215, (2<<16) + 2),\n array(-10, 0, -10),\n array(-655, -400, -655),\n array(-131070, -65535, -130813),\n );\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\tfunction edit() {\n\t if (empty($this->params['content_id'])) {\n\t flash('message',gt('An error occurred: No content id set.'));\n expHistory::back(); \n\t } \n /* The global constants can be overridden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];\n// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];\n// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];\n \n \n\t $id = empty($this->params['id']) ? null : $this->params['id'];\n\t $comment = new expComment($id);\n //FIXME here is where we might sanitize the comment before displaying/editing it\n\t\tassign_to_template(array(\n\t\t 'content_id'=>$this->params['content_id'],\n 'content_type'=>$this->params['content_type'],\n\t\t 'comment'=>$comment\n\t\t));\n\t}\t", "label": 0, "label_name": "vulnerable"} -{"code": " public function setBeforeRemovingPasses(array $passes)\n {\n $this->beforeRemovingPasses = $passes;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "PHPAPI char *php_unescape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC)\n{\n\tsize_t retlen;\n\tchar *ret;\n\tenum entity_charset charset;\n\tconst entity_ht *inverse_map = NULL;\n\tsize_t new_size = TRAVERSE_FOR_ENTITIES_EXPAND_SIZE(oldlen);\n\n\tif (all) {\n\t\tcharset = determine_charset(hint_charset TSRMLS_CC);\n\t} else {\n\t\tcharset = cs_8859_1; /* charset shouldn't matter, use ISO-8859-1 for performance */\n\t}\n\n\t/* don't use LIMIT_ALL! */\n\n\tif (oldlen > new_size) {\n\t\t/* overflow, refuse to do anything */\n\t\tret = estrndup((char*)old, oldlen);\n\t\tretlen = oldlen;\n\t\tgoto empty_source;\n\t}\n\tret = emalloc(new_size);\n\t*ret = '\\0';\n\tretlen = oldlen;\n\tif (retlen == 0) {\n\t\tgoto empty_source;\n\t}\n\t\n\tinverse_map = unescape_inverse_map(all, flags);\n\t\n\t/* replace numeric entities */\n\ttraverse_for_entities(old, oldlen, ret, &retlen, all, flags, inverse_map, charset);\n\nempty_source:\t\n\t*newlen = retlen;\n\treturn ret;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public static function thmList()\n {\n //$mod = '';\n $handle = dir(GX_THEME);\n while (false !== ($entry = $handle->read())) {\n if ($entry != '.' && $entry != '..') {\n $dir = GX_THEME.$entry;\n if (is_dir($dir) == true) {\n $thm[] = basename($dir);\n }\n }\n }\n\n $handle->close();\n\n return $thm;\n }", "label": 1, "label_name": "safe"} -{"code": "bool ArcMemory::Unload()\n{\n if (!Loaded)\n return false;\n Loaded=false;\n return true;\n}", "label": 1, "label_name": "safe"} -{"code": " protected function assertValidation($uri, $expect_uri = true)\n {\n if ($expect_uri === true) $expect_uri = $uri;\n $uri = $this->createURI($uri);\n $result = $uri->validate($this->config, $this->context);\n if ($expect_uri === false) {\n $this->assertFalse($result);\n } else {\n $this->assertTrue($result);\n $this->assertIdentical($uri->toString(), $expect_uri);\n }\n }", "label": 1, "label_name": "safe"} -{"code": " ->orWhereExists(function(QueryBuilder $query) use ($tableDetails, $pageMorphClass) {\n $query->select('id')->from('pages')\n ->whereColumn('pages.id', '=', $tableDetails['tableName'] . '.' . $tableDetails['entityIdColumn'])\n ->where($tableDetails['tableName'] . '.' . $tableDetails['entityTypeColumn'], '=', $pageMorphClass)\n ->where('pages.draft', '=', false);\n });", "label": 1, "label_name": "safe"} -{"code": "static int pop_sync_mailbox(struct Context *ctx, int *index_hint)\n{\n int i, j, ret = 0;\n char buf[LONG_STRING];\n struct PopData *pop_data = (struct PopData *) ctx->data;\n struct Progress progress;\n#ifdef USE_HCACHE\n header_cache_t *hc = NULL;\n#endif\n\n pop_data->check_time = 0;\n\n while (true)\n {\n if (pop_reconnect(ctx) < 0)\n return -1;\n\n mutt_progress_init(&progress, _(\"Marking messages deleted...\"),\n MUTT_PROGRESS_MSG, WriteInc, ctx->deleted);\n\n#ifdef USE_HCACHE\n hc = pop_hcache_open(pop_data, ctx->path);\n#endif\n\n for (i = 0, j = 0, ret = 0; ret == 0 && i < ctx->msgcount; i++)\n {\n if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->refno != -1)\n {\n j++;\n if (!ctx->quiet)\n mutt_progress_update(&progress, j, -1);\n snprintf(buf, sizeof(buf), \"DELE %d\\r\\n\", ctx->hdrs[i]->refno);\n ret = pop_query(pop_data, buf, sizeof(buf));\n if (ret == 0)\n {\n mutt_bcache_del(pop_data->bcache, ctx->hdrs[i]->data);\n#ifdef USE_HCACHE\n mutt_hcache_delete(hc, ctx->hdrs[i]->data, strlen(ctx->hdrs[i]->data));\n#endif\n }\n }\n\n#ifdef USE_HCACHE\n if (ctx->hdrs[i]->changed)\n {\n mutt_hcache_store(hc, ctx->hdrs[i]->data, strlen(ctx->hdrs[i]->data),\n ctx->hdrs[i], 0);\n }\n#endif\n }\n\n#ifdef USE_HCACHE\n mutt_hcache_close(hc);\n#endif\n\n if (ret == 0)\n {\n mutt_str_strfcpy(buf, \"QUIT\\r\\n\", sizeof(buf));\n ret = pop_query(pop_data, buf, sizeof(buf));\n }\n\n if (ret == 0)\n {\n pop_data->clear_cache = true;\n pop_clear_cache(pop_data);\n pop_data->status = POP_DISCONNECTED;\n return 0;\n }\n\n if (ret == -2)\n {\n mutt_error(\"%s\", pop_data->err_msg);\n return -1;\n }\n }\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public static String htmlEscape(String text) {\n StringBuilder buf = new StringBuilder(text.length()+64);\n for( int i=0; iaddElement('form', 'Form',\n 'Required: Heading | List | Block | fieldset', 'Common', array(\n 'accept' => 'ContentTypes',\n 'accept-charset' => 'Charsets',\n 'action*' => 'URI',\n 'method' => 'Enum#get,post',\n // really ContentType, but these two are the only ones used today\n 'enctype' => 'Enum#application/x-www-form-urlencoded,multipart/form-data',\n ));\n $form->excludes = array('form' => true);\n\n $input = $this->addElement('input', 'Formctrl', 'Empty', 'Common', array(\n 'accept' => 'ContentTypes',\n 'accesskey' => 'Character',\n 'alt' => 'Text',\n 'checked' => 'Bool#checked',\n 'disabled' => 'Bool#disabled',\n 'maxlength' => 'Number',\n 'name' => 'CDATA',\n 'readonly' => 'Bool#readonly',\n 'size' => 'Number',\n 'src' => 'URI#embedded',\n 'tabindex' => 'Number',\n 'type' => 'Enum#text,password,checkbox,button,radio,submit,reset,file,hidden,image',\n 'value' => 'CDATA',\n ));\n $input->attr_transform_post[] = new HTMLPurifier_AttrTransform_Input();\n\n $this->addElement('select', 'Formctrl', 'Required: optgroup | option', 'Common', array(\n 'disabled' => 'Bool#disabled',\n 'multiple' => 'Bool#multiple',\n 'name' => 'CDATA',\n 'size' => 'Number',\n 'tabindex' => 'Number',\n ));\n\n $this->addElement('option', false, 'Optional: #PCDATA', 'Common', array(\n 'disabled' => 'Bool#disabled',\n 'label' => 'Text',\n 'selected' => 'Bool#selected',\n 'value' => 'CDATA',\n ));\n // It's illegal for there to be more than one selected, but not\n // be multiple. Also, no selected means undefined behavior. This might\n // be difficult to implement; perhaps an injector, or a context variable.\n\n $textarea = $this->addElement('textarea', 'Formctrl', 'Optional: #PCDATA', 'Common', array(\n 'accesskey' => 'Character',\n 'cols*' => 'Number',\n 'disabled' => 'Bool#disabled',\n 'name' => 'CDATA',\n 'readonly' => 'Bool#readonly',\n 'rows*' => 'Number',\n 'tabindex' => 'Number',\n ));\n $textarea->attr_transform_pre[] = new HTMLPurifier_AttrTransform_Textarea();\n\n $button = $this->addElement('button', 'Formctrl', 'Optional: #PCDATA | Heading | List | Block | Inline', 'Common', array(\n 'accesskey' => 'Character',\n 'disabled' => 'Bool#disabled',\n 'name' => 'CDATA',\n 'tabindex' => 'Number',\n 'type' => 'Enum#button,submit,reset',\n 'value' => 'CDATA',\n ));\n\n // For exclusions, ideally we'd specify content sets, not literal elements\n $button->excludes = $this->makeLookup(\n 'form', 'fieldset', // Form\n 'input', 'select', 'textarea', 'label', 'button', // Formctrl\n 'a', // as per HTML 4.01 spec, this is omitted by modularization\n 'isindex', 'iframe' // legacy items\n );\n\n // Extra exclusion: img usemap=\"\" is not permitted within this element.\n // We'll omit this for now, since we don't have any good way of\n // indicating it yet.\n\n // This is HIGHLY user-unfriendly; we need a custom child-def for this\n $this->addElement('fieldset', 'Form', 'Custom: (#WS?,legend,(Flow|#PCDATA)*)', 'Common');\n\n $label = $this->addElement('label', 'Formctrl', 'Optional: #PCDATA | Inline', 'Common', array(\n 'accesskey' => 'Character',\n // 'for' => 'IDREF', // IDREF not implemented, cannot allow\n ));\n $label->excludes = array('label' => true);\n\n $this->addElement('legend', false, 'Optional: #PCDATA | Inline', 'Common', array(\n 'accesskey' => 'Character',\n ));\n\n $this->addElement('optgroup', false, 'Required: option', 'Common', array(\n 'disabled' => 'Bool#disabled',\n 'label*' => 'Text',\n ));\n\n // Don't forget an injector for . This one's a little complex\n // because it maps to multiple elements.\n\n }", "label": 1, "label_name": "safe"} -{"code": " def test_unlimited_security_groups(self):\n self.flags(quota_security_groups=10)\n security_groups = quota.allowed_security_groups(self.context, 100)\n self.assertEqual(security_groups, 10)\n db.quota_create(self.context, self.project_id, 'security_groups', -1)\n security_groups = quota.allowed_security_groups(self.context, 100)\n self.assertEqual(security_groups, 100)\n security_groups = quota.allowed_security_groups(self.context, 101)\n self.assertEqual(security_groups, 101)", "label": 1, "label_name": "safe"} -{"code": " public function actionUpdate($id){\n $model = $this->loadModel($id);\n if (!$this->checkPermissions ($model, 'edit')) $this->denied ();\n\n if(isset($_POST['Media'])){\n // save media info\n $model->lastUpdated = time();\n $model->associationType = $_POST['Media']['associationType'];\n $model->associationId = $_POST['Media']['associationId'];\n $model->private = $_POST['Media']['private'];\n if($_POST['Media']['description'])\n $model->description = $_POST['Media']['description'];\n if (! $model->drive) {\n // Handle setting the name if the Media isn't stored on Drive\n $model->name = $_POST['Media']['name'];\n if (empty($model->name))\n $model->name = $model->fileName;\n }\n if($model->save())\n $this->redirect(array('view', 'id' => $model->id));\n }\n\n $this->render('update', array(\n 'model' => $model,\n ));\n }", "label": 1, "label_name": "safe"} -{"code": " public async Task SerializeToStreamAsync(IRequest req, object response, Stream outputStream)\n {\n var res = req.Response;\n if (req.GetItem(\"HttpResult\") is IHttpResult httpResult && httpResult.Headers.ContainsKey(HttpHeaders.Location) \n && httpResult.StatusCode != System.Net.HttpStatusCode.Created) \n return;\n\n try\n {\n if (res.StatusCode >= 400)\n {\n var responseStatus = response.GetResponseStatus();\n req.Items[ErrorStatusKey] = responseStatus;\n }\n\n if (response is CompressedResult)\n {\n if (res.Dto != null)\n response = res.Dto;\n else \n throw new ArgumentException(\"Cannot use Cached Result as ViewModel\");\n }\n\n foreach (var viewEngine in AppHost.ViewEngines)\n {\n var handled = await viewEngine.ProcessRequestAsync(req, response, outputStream);\n if (handled)\n return;\n }\n }\n catch (Exception ex)\n {\n if (res.StatusCode < 400)\n throw;\n\n //If there was an exception trying to render a Error with a View, \n //It can't handle errors so just write it out here.\n response = DtoUtils.CreateErrorResponse(req.Dto, ex);\n }\n\n //Handle Exceptions returning string\n if (req.ResponseContentType == MimeTypes.PlainText)\n {\n req.ResponseContentType = MimeTypes.Html;\n res.ContentType = MimeTypes.Html;\n }\n\n if (req.ResponseContentType != MimeTypes.Html && req.ResponseContentType != MimeTypes.JsonReport) \n return;\n\n var dto = response.GetDto();\n if (!(dto is string html))\n {\n // Serialize then escape any potential script tags to avoid XSS when displaying as HTML\n var json = JsonDataContractSerializer.Instance.SerializeToString(dto) ?? \"null\";\n json = json.HtmlEncode();\n\n var url = req.ResolveAbsoluteUrl()\n .Replace(\"format=html\", \"\")\n .Replace(\"format=shtm\", \"\")\n .TrimEnd('?', '&')\n .HtmlEncode();\n\n url += url.Contains(\"?\") ? \"&\" : \"?\";\n\n var now = DateTime.UtcNow;\n var requestName = req.OperationName ?? dto.GetType().GetOperationName();\n\n html = HtmlTemplates.GetHtmlFormatTemplate()\n .Replace(\"${Dto}\", json)\n .Replace(\"${Title}\", string.Format(TitleFormat, requestName, now))\n .Replace(\"${MvcIncludes}\", MiniProfiler.Profiler.RenderIncludes().ToString())\n .Replace(\"${Header}\", string.Format(HtmlTitleFormat, requestName, now))\n .Replace(\"${ServiceUrl}\", url)\n .Replace(\"${Humanize}\", Humanize.ToString().ToLower());\n }\n\n var utf8Bytes = html.ToUtf8Bytes();\n await outputStream.WriteAsync(utf8Bytes, 0, utf8Bytes.Length);\n }", "label": 1, "label_name": "safe"} -{"code": " def get_pos_tagger(self):\n from nltk.corpus import brown\n\n regexp_tagger = RegexpTagger(\n [\n (r\"^-?[0-9]+(\\.[0-9]+)?$\", \"CD\"), # cardinal numbers\n (r\"(The|the|A|a|An|an)$\", \"AT\"), # articles\n (r\".*able$\", \"JJ\"), # adjectives\n (r\".*ness$\", \"NN\"), # nouns formed from adjectives\n (r\".*ly$\", \"RB\"), # adverbs\n (r\".*s$\", \"NNS\"), # plural nouns\n (r\".*ing$\", \"VBG\"), # gerunds\n (r\".*ed$\", \"VBD\"), # past tense verbs\n (r\".*\", \"NN\"), # nouns (default)\n ]\n )\n brown_train = brown.tagged_sents(categories=\"news\")\n unigram_tagger = UnigramTagger(brown_train, backoff=regexp_tagger)\n bigram_tagger = BigramTagger(brown_train, backoff=unigram_tagger)\n trigram_tagger = TrigramTagger(brown_train, backoff=bigram_tagger)\n\n # Override particular words\n main_tagger = RegexpTagger(\n [(r\"(A|a|An|an)$\", \"ex_quant\"), (r\"(Every|every|All|all)$\", \"univ_quant\")],\n backoff=trigram_tagger,\n )\n\n return main_tagger", "label": 1, "label_name": "safe"} -{"code": " public function testPutRoutes($uri, $expectedVersion, $expectedController, $expectedAction, $expectedId, $expectedCode)\n {\n $request = new Enlight_Controller_Request_RequestTestCase();\n $request->setMethod('PUT');\n\n $response = new Enlight_Controller_Response_ResponseTestCase();\n\n $request->setPathInfo($uri);\n $this->router->assembleRoute($request, $response);\n\n static::assertEquals($expectedController, $request->getControllerName());\n static::assertEquals($expectedAction, $request->getActionName());\n static::assertEquals($expectedVersion, $request->getParam('version'));\n static::assertEquals($expectedId, $request->getParam('id'));\n static::assertEquals($expectedCode, $response->getHttpResponseCode());\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function testRegular()\n {\n $this->assertParsing(\n 'http://www.example.com/webhp?q=foo#result2',\n 'http', null, 'www.example.com', null, '/webhp', 'q=foo', 'result2'\n );\n }", "label": 1, "label_name": "safe"} -{"code": " public function testSelectOptgroup()\n {\n $this->config->set('HTML.Doctype', 'HTML 4.01 Strict');\n $this->assertResult('\n
\n

\n \n

\n
\n ');\n }", "label": 1, "label_name": "safe"} -{"code": "static void renameTableFunc(\n sqlite3_context *context,\n int NotUsed,\n sqlite3_value **argv\n){\n sqlite3 *db = sqlite3_context_db_handle(context);\n const char *zDb = (const char*)sqlite3_value_text(argv[0]);\n const char *zInput = (const char*)sqlite3_value_text(argv[3]);\n const char *zOld = (const char*)sqlite3_value_text(argv[4]);\n const char *zNew = (const char*)sqlite3_value_text(argv[5]);\n int bTemp = sqlite3_value_int(argv[6]);\n UNUSED_PARAMETER(NotUsed);\n\n if( zInput && zOld && zNew ){\n Parse sParse;\n int rc;\n int bQuote = 1;\n RenameCtx sCtx;\n Walker sWalker;\n\n#ifndef SQLITE_OMIT_AUTHORIZATION\n sqlite3_xauth xAuth = db->xAuth;\n db->xAuth = 0;\n#endif\n\n sqlite3BtreeEnterAll(db);\n\n memset(&sCtx, 0, sizeof(RenameCtx));\n sCtx.pTab = sqlite3FindTable(db, zOld, zDb);\n memset(&sWalker, 0, sizeof(Walker));\n sWalker.pParse = &sParse;\n sWalker.xExprCallback = renameTableExprCb;\n sWalker.xSelectCallback = renameTableSelectCb;\n sWalker.u.pRename = &sCtx;\n\n rc = renameParseSql(&sParse, zDb, 1, db, zInput, bTemp);\n\n if( rc==SQLITE_OK ){\n int isLegacy = (db->flags & SQLITE_LegacyAlter);\n if( sParse.pNewTable ){\n Table *pTab = sParse.pNewTable;\n\n if( pTab->pSelect ){\n if( isLegacy==0 ){\n Select *pSelect = pTab->pSelect;\n NameContext sNC;\n memset(&sNC, 0, sizeof(sNC));\n sNC.pParse = &sParse;\n\n assert( pSelect->selFlags & SF_View );\n pSelect->selFlags &= ~SF_View;\n sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC);\n if( sParse.nErr ) rc = sParse.rc;\n sqlite3WalkSelect(&sWalker, pTab->pSelect);\n }\n }else{\n /* Modify any FK definitions to point to the new table. */\n#ifndef SQLITE_OMIT_FOREIGN_KEY\n if( isLegacy==0 || (db->flags & SQLITE_ForeignKeys) ){\n FKey *pFKey;\n for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){\n if( sqlite3_stricmp(pFKey->zTo, zOld)==0 ){\n renameTokenFind(&sParse, &sCtx, (void*)pFKey->zTo);\n }\n }\n }\n#endif\n\n /* If this is the table being altered, fix any table refs in CHECK\n ** expressions. Also update the name that appears right after the\n ** \"CREATE [VIRTUAL] TABLE\" bit. */\n if( sqlite3_stricmp(zOld, pTab->zName)==0 ){\n sCtx.pTab = pTab;\n if( isLegacy==0 ){\n sqlite3WalkExprList(&sWalker, pTab->pCheck);\n }\n renameTokenFind(&sParse, &sCtx, pTab->zName);\n }\n }\n }\n\n else if( sParse.pNewIndex ){\n renameTokenFind(&sParse, &sCtx, sParse.pNewIndex->zName);\n if( isLegacy==0 ){\n sqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere);\n }\n }\n\n#ifndef SQLITE_OMIT_TRIGGER\n else{\n Trigger *pTrigger = sParse.pNewTrigger;\n TriggerStep *pStep;\n if( 0==sqlite3_stricmp(sParse.pNewTrigger->table, zOld) \n && sCtx.pTab->pSchema==pTrigger->pTabSchema\n ){\n renameTokenFind(&sParse, &sCtx, sParse.pNewTrigger->table);\n }\n\n if( isLegacy==0 ){\n rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb);\n if( rc==SQLITE_OK ){\n renameWalkTrigger(&sWalker, pTrigger);\n for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){\n if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){\n renameTokenFind(&sParse, &sCtx, pStep->zTarget);\n }\n }\n }\n }\n }\n#endif\n }\n\n if( rc==SQLITE_OK ){\n rc = renameEditSql(context, &sCtx, zInput, zNew, bQuote);\n }\n if( rc!=SQLITE_OK ){\n if( sParse.zErrMsg ){\n renameColumnParseError(context, 0, argv[1], argv[2], &sParse);\n }else{\n sqlite3_result_error_code(context, rc);\n }\n }\n\n renameParseCleanup(&sParse);\n renameTokenFree(db, sCtx.pList);\n sqlite3BtreeLeaveAll(db);\n#ifndef SQLITE_OMIT_AUTHORIZATION\n db->xAuth = xAuth;\n#endif\n }\n\n return;\n}", "label": 1, "label_name": "safe"} -{"code": " public function testDeleteTemplateAction()\n {\n $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN);\n\n $fixture = new InvoiceTemplateFixtures();\n $template = $this->importFixture($fixture);\n $id = $template[0]->getId();\n\n $this->request($client, '/invoice/template/' . $id . '/delete');\n $this->assertIsRedirect($client, '/invoice/template');\n $client->followRedirect();\n\n $this->assertTrue($client->getResponse()->isSuccessful());\n $this->assertHasFlashSuccess($client);\n\n $this->assertEquals(0, $this->getEntityManager()->getRepository(InvoiceTemplate::class)->count([]));\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function testRemoveExpiredOnUnserialize()\n {\n $dt = new DateTime();\n $dt->setTimezone(new DateTimeZone('UTC'));\n $dt->modify('+2 seconds');\n\n $this->jar->store(array(\n 'name' => 'foo',\n 'value' => 'bar',\n 'domain' => '.example.com',\n 'path' => '/',\n 'expires' => $dt->format(DateTime::COOKIE),\n ));\n\n $serialized = serialize($this->jar);\n sleep(2);\n $newJar = unserialize($serialized);\n $this->assertEquals(array(), $newJar->getAll());\n }", "label": 0, "label_name": "vulnerable"} -{"code": " it \"should return a 403 if a user attempts to get at the _diagnostics path\" do\n get \"/message-bus/_diagnostics\"\n last_response.status.must_equal 403\n end", "label": 0, "label_name": "vulnerable"} -{"code": " it 'should fail if mask value is more than 32 bits' do\n lambda { @resource[:set_mark] = '1/4294967296'}.should raise_error(\n Puppet::Error, /MARK mask must be integer or hex between 0 and 0xffffffff$/\n )\n end", "label": 0, "label_name": "vulnerable"} -{"code": "function binl2b64(binarray)\n{\n var tab = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n var str = \"\";\n for(var i = 0; i < binarray.length * 4; i += 3)\n {\n var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16)\n | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )\n | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);\n for(var j = 0; j < 4; j++)\n {\n if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;\n else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);\n }\n }\n return str;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "function(O){O=da.apply(this,arguments);var X=this.editorUi,ea=X.editor.graph;if(ea.isEnabled()&&\"1\"==urlParams.sketch){var ka=this.createOption(mxResources.get(\"sketch\"),function(){return Editor.sketchMode},function(ja,U){X.setSketchMode(!Editor.sketchMode);null!=U&&mxEvent.isShiftDown(U)||ea.updateCellStyles({sketch:ja?\"1\":null},ea.getVerticesAndEdges())},{install:function(ja){this.listener=function(){ja(Editor.sketchMode)};X.addListener(\"sketchModeChanged\",this.listener)},destroy:function(){X.removeListener(this.listener)}});", "label": 0, "label_name": "vulnerable"} -{"code": " def gemset_name\n resource[:name]\n end", "label": 0, "label_name": "vulnerable"} -{"code": "def remote(params, request, auth_user)\n remote_cmd_without_pacemaker = {\n :status => method(:node_status),\n :status_all => method(:status_all),\n :cluster_status => method(:cluster_status_remote),\n :auth => method(:auth),\n :check_auth => method(:check_auth),\n :setup_cluster => method(:setup_cluster),\n :create_cluster => method(:create_cluster),\n :get_quorum_info => method(:get_quorum_info),\n :get_cib => method(:get_cib),\n :get_corosync_conf => method(:get_corosync_conf_remote),\n :set_cluster_conf => method(:set_cluster_conf),\n :set_corosync_conf => method(:set_corosync_conf),\n :get_sync_capabilities => method(:get_sync_capabilities),\n :set_sync_options => method(:set_sync_options),\n :get_configs => method(:get_configs),\n :set_configs => method(:set_configs),\n :set_certs => method(:set_certs),\n :pcsd_restart => method(:remote_pcsd_restart),\n :get_permissions => method(:get_permissions_remote),\n :set_permissions => method(:set_permissions_remote),\n :cluster_start => method(:cluster_start),\n :cluster_stop => method(:cluster_stop),\n :config_backup => method(:config_backup),\n :config_restore => method(:config_restore),\n :node_restart => method(:node_restart),\n :node_standby => method(:node_standby),\n :node_unstandby => method(:node_unstandby),\n :cluster_enable => method(:cluster_enable),\n :cluster_disable => method(:cluster_disable),\n :resource_status => method(:resource_status),\n :get_sw_versions => method(:get_sw_versions),\n :node_available => method(:remote_node_available),\n :add_node_all => lambda { |params_, request_, auth_user_|\n remote_add_node(params_, request_, auth_user_, true)\n },\n :add_node => lambda { |params_, request_, auth_user_|\n remote_add_node(params_, request_, auth_user_, false)\n },\n :remove_nodes => method(:remote_remove_nodes),\n :remove_node => method(:remote_remove_node),\n :cluster_destroy => method(:cluster_destroy),\n :get_wizard => method(:get_wizard),\n :wizard_submit => method(:wizard_submit),\n :get_tokens => method(:get_tokens),\n :get_cluster_tokens => method(:get_cluster_tokens),\n :save_tokens => method(:save_tokens),\n :get_cluster_properties_definition => method(:get_cluster_properties_definition)\n }\n remote_cmd_with_pacemaker = {\n :resource_start => method(:resource_start),\n :resource_stop => method(:resource_stop),\n :resource_cleanup => method(:resource_cleanup),\n :resource_form => method(:resource_form),\n :fence_device_form => method(:fence_device_form),\n :update_resource => method(:update_resource),\n :update_fence_device => method(:update_fence_device),\n :resource_metadata => method(:resource_metadata),\n :fence_device_metadata => method(:fence_device_metadata),\n :get_avail_resource_agents => method(:get_avail_resource_agents),\n :get_avail_fence_agents => method(:get_avail_fence_agents),\n :remove_resource => method(:remove_resource),\n :add_constraint_remote => method(:add_constraint_remote),\n :add_constraint_rule_remote => method(:add_constraint_rule_remote),\n :add_constraint_set_remote => method(:add_constraint_set_remote),\n :remove_constraint_remote => method(:remove_constraint_remote),\n :remove_constraint_rule_remote => method(:remove_constraint_rule_remote),\n :add_meta_attr_remote => method(:add_meta_attr_remote),\n :add_group => method(:add_group),\n :update_cluster_settings => method(:update_cluster_settings),\n :add_fence_level_remote => method(:add_fence_level_remote),\n :add_node_attr_remote => method(:add_node_attr_remote),\n :add_acl_role => method(:add_acl_role_remote),\n :remove_acl_roles => method(:remove_acl_roles_remote),\n :add_acl => method(:add_acl_remote),\n :remove_acl => method(:remove_acl_remote),\n :resource_change_group => method(:resource_change_group),\n :resource_master => method(:resource_master),\n :resource_clone => method(:resource_clone),\n :resource_unclone => method(:resource_unclone),\n :resource_ungroup => method(:resource_ungroup),\n :set_resource_utilization => method(:set_resource_utilization),\n :set_node_utilization => method(:set_node_utilization)\n }\n\n command = params[:command].to_sym\n\n if remote_cmd_without_pacemaker.include? command\n return remote_cmd_without_pacemaker[command].call(\n params, request, auth_user\n )\n elsif remote_cmd_with_pacemaker.include? command\n if pacemaker_running?\n return remote_cmd_with_pacemaker[command].call(params, request, auth_user)\n else\n return [200,'{\"pacemaker_not_running\":true}']\n end\n else\n return [404, \"Unknown Request\"]\n end\nend", "label": 1, "label_name": "safe"} -{"code": "TfLiteStatus PreluPrepare(TfLiteContext* context, TfLiteNode* node) {\n TFLITE_DCHECK(node->user_data != nullptr);\n PreluParams* params = static_cast(node->user_data);\n\n const TfLiteTensor* input = GetInput(context, node, 0);\n TF_LITE_ENSURE(context, input != nullptr);\n const TfLiteTensor* alpha = GetInput(context, node, 1);\n TF_LITE_ENSURE(context, alpha != nullptr);\n TfLiteTensor* output = GetOutput(context, node, 0);\n TF_LITE_ENSURE(context, output != nullptr);\n\n return CalculatePreluParams(input, alpha, output, params);\n}", "label": 1, "label_name": "safe"} -{"code": " protected function prepareExport($model) {\n $this->openX2 ('/admin/exportModels?model='.ucfirst($model));\n }", "label": 1, "label_name": "safe"} -{"code": " public function show()\n {\n $task = $this->getTask();\n $subtask = $this->getSubtask();\n\n $this->response->html($this->template->render('subtask_restriction/show', array(\n 'status_list' => array(\n SubtaskModel::STATUS_TODO => t('Todo'),\n SubtaskModel::STATUS_DONE => t('Done'),\n ),\n 'subtask_inprogress' => $this->subtaskStatusModel->getSubtaskInProgress($this->userSession->getId()),\n 'subtask' => $subtask,\n 'task' => $task,\n )));\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function read($path)\n {\n if ( ! $object = $this->readStream($path)) {\n return false;\n }\n\n $object['contents'] = stream_get_contents($object['stream']);\n fclose($object['stream']);\n unset($object['stream']);\n\n return $object;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "static inline void sem_getref(struct sem_array *sma)\n{\n\tsem_lock(sma, NULL, -1);\n\tWARN_ON_ONCE(!ipc_rcu_getref(sma));\n\tsem_unlock(sma, -1);\n}", "label": 1, "label_name": "safe"} -{"code": " public function show()\n {\n $task = $this->getTask();\n $subtask = $this->getSubtask();\n\n $this->response->html($this->template->render('subtask_converter/show', array(\n 'subtask' => $subtask,\n 'task' => $task,\n )));\n }", "label": 0, "label_name": "vulnerable"} -{"code": "func clearKey(key []byte) {\n\tfor i := range key {\n\t\tkey[i] = 0\n\t}\n}", "label": 1, "label_name": "safe"} -{"code": "static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n char\n filename[MagickPathExtent];\n\n FILE\n *file;\n\n Image\n *image,\n *next_image,\n *pwp_image;\n\n ImageInfo\n *read_info;\n\n int\n c,\n unique_file;\n\n MagickBooleanType\n status;\n\n register Image\n *p;\n\n register ssize_t\n i;\n\n size_t\n filesize,\n length;\n\n ssize_t\n count;\n\n unsigned char\n magick[MagickPathExtent];\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImage(image);\n return((Image *) NULL);\n }\n pwp_image=image;\n memset(magick,0,sizeof(magick));\n count=ReadBlob(pwp_image,5,magick);\n if ((count != 5) || (LocaleNCompare((char *) magick,\"SFW95\",5) != 0))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n read_info=CloneImageInfo(image_info);\n (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL,\n (void *) NULL);\n SetImageInfoBlob(read_info,(void *) NULL,0);\n unique_file=AcquireUniqueFileResource(filename);\n (void) FormatLocaleString(read_info->filename,MagickPathExtent,\"sfw:%s\",\n filename);\n for ( ; ; )\n {\n (void) memset(magick,0,sizeof(magick));\n for (c=ReadBlobByte(pwp_image); c != EOF; c=ReadBlobByte(pwp_image))\n {\n for (i=0; i < 17; i++)\n magick[i]=magick[i+1];\n magick[17]=(unsigned char) c;\n if (LocaleNCompare((char *) (magick+12),\"SFW94A\",6) == 0)\n break;\n }\n if (c == EOF)\n {\n (void) RelinquishUniqueFileResource(filename);\n read_info=DestroyImageInfo(read_info);\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n }\n if (LocaleNCompare((char *) (magick+12),\"SFW94A\",6) != 0)\n {\n (void) RelinquishUniqueFileResource(filename);\n read_info=DestroyImageInfo(read_info);\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n }\n /*\n Dump SFW image to a temporary file.\n */\n file=(FILE *) NULL;\n if (unique_file != -1)\n file=fdopen(unique_file,\"wb\");\n if ((unique_file == -1) || (file == (FILE *) NULL))\n {\n (void) RelinquishUniqueFileResource(filename);\n read_info=DestroyImageInfo(read_info);\n ThrowFileException(exception,FileOpenError,\"UnableToWriteFile\",\n image->filename);\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n length=fwrite(\"SFW94A\",1,6,file);\n (void) length;\n filesize=65535UL*magick[2]+256L*magick[1]+magick[0];\n for (i=0; i < (ssize_t) filesize; i++)\n {\n c=ReadBlobByte(pwp_image);\n if (c == EOF)\n break;\n (void) fputc(c,file);\n }\n (void) fclose(file);\n if (c == EOF)\n {\n (void) RelinquishUniqueFileResource(filename);\n read_info=DestroyImageInfo(read_info);\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n }\n next_image=ReadImage(read_info,exception);\n if (next_image == (Image *) NULL)\n break;\n (void) FormatLocaleString(next_image->filename,MagickPathExtent,\n \"slide_%02ld.sfw\",(long) next_image->scene);\n if (image == (Image *) NULL)\n image=next_image;\n else\n {\n /*\n Link image into image list.\n */\n for (p=image; p->next != (Image *) NULL; p=GetNextImageInList(p)) ;\n next_image->previous=p;\n next_image->scene=p->scene+1;\n p->next=next_image;\n }\n if (image_info->number_scenes != 0)\n if (next_image->scene >= (image_info->scene+image_info->number_scenes-1))\n break;\n status=SetImageProgress(image,LoadImagesTag,TellBlob(pwp_image),\n GetBlobSize(pwp_image));\n if (status == MagickFalse)\n break;\n }\n if (unique_file != -1)\n (void) close(unique_file);\n (void) RelinquishUniqueFileResource(filename);\n read_info=DestroyImageInfo(read_info);\n if (image != (Image *) NULL)\n {\n if (EOFBlob(image) != MagickFalse)\n {\n char\n *message;\n\n message=GetExceptionMessage(errno);\n (void) ThrowMagickException(exception,GetMagickModule(),\n CorruptImageError,\"UnexpectedEndOfFile\",\"`%s': %s\",image->filename,\n message);\n message=DestroyString(message);\n }\n (void) CloseBlob(image);\n }\n return(GetFirstImageInList(image));\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function testMultiRowIndexFile()\n {\n $iteration = 3;\n for ($i = 0; $i < $iteration; ++$i) {\n $profile = new Profile('token'.$i);\n $profile->setIp('127.0.0.'.$i);\n $profile->setUrl('http://foo.bar/'.$i);\n\n $this->storage->write($profile);\n $this->storage->write($profile);\n $this->storage->write($profile);\n }\n\n $handle = fopen($this->tmpDir.'/index.csv', 'r');\n for ($i = 0; $i < $iteration; ++$i) {\n $row = fgetcsv($handle);\n $this->assertEquals('token'.$i, $row[0]);\n $this->assertEquals('127.0.0.'.$i, $row[1]);\n $this->assertEquals('http://foo.bar/'.$i, $row[3]);\n }\n $this->assertFalse(fgetcsv($handle));\n }", "label": 0, "label_name": "vulnerable"} -{"code": "static void mbochs_remove(struct mdev_device *mdev)\n{\n\tstruct mdev_state *mdev_state = dev_get_drvdata(&mdev->dev);\n\n\tvfio_unregister_group_dev(&mdev_state->vdev);\n\tatomic_add(mdev_state->type->mbytes, &mbochs_avail_mbytes);\n\tkfree(mdev_state->pages);\n\tkfree(mdev_state->vconfig);\n\tkfree(mdev_state);\n}", "label": 1, "label_name": "safe"} -{"code": "\tdef is_whitelisted(self, method):\n\t\tfn = getattr(self, method, None)\n\t\tif not fn:\n\t\t\traise NotFound(\"Method {0} not found\".format(method))\n\t\telif not getattr(fn, \"whitelisted\", False):\n\t\t\traise Forbidden(\"Method {0} not whitelisted\".format(method))", "label": 0, "label_name": "vulnerable"} -{"code": "static const struct usb_cdc_union_desc *\nims_pcu_get_cdc_union_desc(struct usb_interface *intf)\n{\n\tconst void *buf = intf->altsetting->extra;\n\tsize_t buflen = intf->altsetting->extralen;\n\tstruct usb_cdc_union_desc *union_desc;\n\n\tif (!buf) {\n\t\tdev_err(&intf->dev, \"Missing descriptor data\\n\");\n\t\treturn NULL;\n\t}\n\n\tif (!buflen) {\n\t\tdev_err(&intf->dev, \"Zero length descriptor\\n\");\n\t\treturn NULL;\n\t}\n\n\twhile (buflen > 0) {\n\t\tunion_desc = (struct usb_cdc_union_desc *)buf;\n\n\t\tif (union_desc->bDescriptorType == USB_DT_CS_INTERFACE &&\n\t\t union_desc->bDescriptorSubType == USB_CDC_UNION_TYPE) {\n\t\t\tdev_dbg(&intf->dev, \"Found union header\\n\");\n\t\t\treturn union_desc;\n\t\t}\n\n\t\tbuflen -= union_desc->bLength;\n\t\tbuf += union_desc->bLength;\n\t}\n\n\tdev_err(&intf->dev, \"Missing CDC union descriptor\\n\");\n\treturn NULL;", "label": 0, "label_name": "vulnerable"} -{"code": "static int validate_user_key(struct fscrypt_info *crypt_info,\n\t\t\tstruct fscrypt_context *ctx, u8 *raw_key,\n\t\t\tconst char *prefix)\n{\n\tchar *description;\n\tstruct key *keyring_key;\n\tstruct fscrypt_key *master_key;\n\tconst struct user_key_payload *ukp;\n\tint res;\n\n\tdescription = kasprintf(GFP_NOFS, \"%s%*phN\", prefix,\n\t\t\t\tFS_KEY_DESCRIPTOR_SIZE,\n\t\t\t\tctx->master_key_descriptor);\n\tif (!description)\n\t\treturn -ENOMEM;\n\n\tkeyring_key = request_key(&key_type_logon, description, NULL);\n\tkfree(description);\n\tif (IS_ERR(keyring_key))\n\t\treturn PTR_ERR(keyring_key);\n\n\tif (keyring_key->type != &key_type_logon) {\n\t\tprintk_once(KERN_WARNING\n\t\t\t\t\"%s: key type must be logon\\n\", __func__);\n\t\tres = -ENOKEY;\n\t\tgoto out;\n\t}\n\tdown_read(&keyring_key->sem);\n\tukp = user_key_payload(keyring_key);\n\tif (ukp->datalen != sizeof(struct fscrypt_key)) {\n\t\tres = -EINVAL;\n\t\tup_read(&keyring_key->sem);\n\t\tgoto out;\n\t}\n\tmaster_key = (struct fscrypt_key *)ukp->data;\n\tBUILD_BUG_ON(FS_AES_128_ECB_KEY_SIZE != FS_KEY_DERIVATION_NONCE_SIZE);\n\n\tif (master_key->size != FS_AES_256_XTS_KEY_SIZE) {\n\t\tprintk_once(KERN_WARNING\n\t\t\t\t\"%s: key size incorrect: %d\\n\",\n\t\t\t\t__func__, master_key->size);\n\t\tres = -ENOKEY;\n\t\tup_read(&keyring_key->sem);\n\t\tgoto out;\n\t}\n\tres = derive_key_aes(ctx->nonce, master_key->raw, raw_key);\n\tup_read(&keyring_key->sem);\n\tif (res)\n\t\tgoto out;\n\n\tcrypt_info->ci_keyring_key = keyring_key;\n\treturn 0;\nout:\n\tkey_put(keyring_key);\n\treturn res;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " getItemHtml: function (value) {\n var translatedValue = this.translatedOptions[value] || value;\n\n var html = '' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '' +\n '

' +\n '
';\n\n return html;\n },", "label": 0, "label_name": "vulnerable"} -{"code": "static int gss_iakerbmechglue_init(void)\n{\n struct gss_mech_config mech_iakerb;\n struct gss_config iakerb_mechanism = krb5_mechanism;\n\n /* IAKERB mechanism mirrors krb5, but with different context SPIs */\n iakerb_mechanism.gss_accept_sec_context = iakerb_gss_accept_sec_context;\n iakerb_mechanism.gss_init_sec_context = iakerb_gss_init_sec_context;\n iakerb_mechanism.gss_delete_sec_context = iakerb_gss_delete_sec_context;\n iakerb_mechanism.gss_acquire_cred = iakerb_gss_acquire_cred;\n iakerb_mechanism.gssspi_acquire_cred_with_password\n = iakerb_gss_acquire_cred_with_password;\n\n memset(&mech_iakerb, 0, sizeof(mech_iakerb));\n mech_iakerb.mech = &iakerb_mechanism;\n\n mech_iakerb.mechNameStr = \"iakerb\";\n mech_iakerb.mech_type = (gss_OID)gss_mech_iakerb;\n gssint_register_mechinfo(&mech_iakerb);\n\n return 0;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "(function($,e,t){\"$:nomunge\";var i=[],n=$.resize=$.extend($.resize,{}),a,r=false,s=\"setTimeout\",u=\"resize\",m=u+\"-special-event\",o=\"pendingDelay\",l=\"activeDelay\",f=\"throttleWindow\";n[o]=200;n[l]=20;n[f]=true;$.event.special[u]={setup:function(){if(!n[f]&&this[s]){return false}var e=$(this);i.push(this);e.data(m,{w:e.width(),h:e.height()});if(i.length===1){a=t;h()}},teardown:function(){if(!n[f]&&this[s]){return false}var e=$(this);for(var t=i.length-1;t>=0;t--){if(i[t]==this){i.splice(t,1);break}}e.removeData(m);if(!i.length){if(r){cancelAnimationFrame(a)}else{clearTimeout(a)}a=null}},add:function(e){if(!n[f]&&this[s]){return false}var i;function a(e,n,a){var r=$(this),s=r.data(m)||{};s.w=n!==t?n:r.width();s.h=a!==t?a:r.height();i.apply(this,arguments)}if($.isFunction(e)){i=e;return a}else{i=e.handler;e.handler=a}}};function h(t){if(r===true){r=t||1}for(var s=i.length-1;s>=0;s--){var l=$(i[s]);if(l[0]==e||l.is(\":visible\")){var f=l.width(),c=l.height(),d=l.data(m);if(d&&(f!==d.w||c!==d.h)){l.trigger(u,[d.w=f,d.h=c]);r=t||true}}else{d=l.data(m);d.w=0;d.h=0}}if(a!==null){if(r&&(t==null||t-r<1e3)){a=e.requestAnimationFrame(h)}else{a=setTimeout(h,n[o]);r=false}}}if(!e.requestAnimationFrame){e.requestAnimationFrame=function(){return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t,i){return e.setTimeout(function(){t((new Date).getTime())},n[l])}}()}if(!e.cancelAnimationFrame){e.cancelAnimationFrame=function(){return e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}()}})(jQuery,this);", "label": 0, "label_name": "vulnerable"} -{"code": " public function uploadCustomLogoAction(Request $request)\n {\n $fileExt = File::getFileExtension($_FILES['Filedata']['name']);\n if (!in_array($fileExt, ['svg', 'png', 'jpg'])) {\n throw new \\Exception('Unsupported file format');\n }\n\n if($fileExt === 'svg') {\n if(strpos(file_get_contents($_FILES['Filedata']['tmp_name']), 'writeStream(self::CUSTOM_LOGO_PATH, fopen($_FILES['Filedata']['tmp_name'], 'rb'));\n\n // set content-type to text/html, otherwise (when application/json is sent) chrome will complain in\n // Ext.form.Action.Submit and mark the submission as failed\n\n $response = $this->adminJson(['success' => true]);\n $response->headers->set('Content-Type', 'text/html');\n\n return $response;\n }", "label": 1, "label_name": "safe"} -{"code": " $scope.deleteNode = function(node) {\n bootbox.confirm('Are you sure you want to remove the node ' + node.nodeLabel + '?', function(ok) {\n if (ok) {\n RequisitionsService.startTiming();\n RequisitionsService.deleteNode(node).then(\n function() { // success\n var index = -1;\n for(var i = 0; i < $scope.filteredNodes.length; i++) {\n if ($scope.filteredNodes[i].foreignId === node.foreignId) {\n index = i;\n }\n }\n if (index > -1) {\n $scope.filteredNodes.splice(index,1);\n }\n growl.success('The node ' + node.nodeLabel + ' has been deleted.');\n },\n $scope.errorHandler\n );\n }\n });\n };", "label": 0, "label_name": "vulnerable"} -{"code": " public RecurlyList GetAdjustments(Adjustment.AdjustmentType type = Adjustment.AdjustmentType.All,\n Adjustment.AdjustmentState state = Adjustment.AdjustmentState.Any)\n {\n var adjustments = new AdjustmentList();\n var statusCode = Client.Instance.PerformRequest(Client.HttpRequestMethod.Get,\n UrlPrefix + Uri.EscapeUriString(AccountCode) + \"/adjustments/\"\n + Build.QueryStringWith(Adjustment.AdjustmentState.Any == state ? \"\" : \"state=\" + state.ToString().EnumNameToTransportCase())\n .AndWith(Adjustment.AdjustmentType.All == type ? \"\" : \"type=\" + type.ToString().EnumNameToTransportCase())\n , adjustments.ReadXmlList);\n\n return statusCode == HttpStatusCode.NotFound ? null : adjustments;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function testImgRemoveInvalidAlign()\n {\n $this->assertResult(\n '\"foobar\"',\n '\"foobar\"'\n );\n }", "label": 1, "label_name": "safe"} -{"code": " public void translate(GeyserSession session, SetLocalPlayerAsInitializedPacket packet) {\n if (session.getPlayerEntity().getGeyserId() == packet.getRuntimeEntityId()) {\n if (!session.getUpstream().isInitialized()) {\n session.getUpstream().setInitialized(true);\n session.login();\n\n for (PlayerEntity entity : session.getEntityCache().getEntitiesByType(PlayerEntity.class)) {\n if (!entity.isValid()) {\n SkinManager.requestAndHandleSkinAndCape(entity, session, null);\n entity.sendPlayer(session);\n }\n }\n\n // Send Skulls\n for (PlayerEntity entity : session.getSkullCache().values()) {\n entity.spawnEntity(session);\n\n SkullSkinManager.requestAndHandleSkin(entity, session, (skin) -> {\n entity.getMetadata().getFlags().setFlag(EntityFlag.INVISIBLE, false);\n entity.updateBedrockMetadata(session);\n });\n }\n }\n }\n }", "label": 1, "label_name": "safe"} -{"code": "find_start_brace(void)\t // XXX\n{\n pos_T\t cursor_save;\n pos_T\t *trypos;\n pos_T\t *pos;\n static pos_T pos_copy;\n\n cursor_save = curwin->w_cursor;\n while ((trypos = findmatchlimit(NULL, '{', FM_BLOCKSTOP, 0)) != NULL)\n {\n\tpos_copy = *trypos;\t// copy pos_T, next findmatch will change it\n\ttrypos = &pos_copy;\n\tcurwin->w_cursor = *trypos;\n\tpos = NULL;\n\t// ignore the { if it's in a // or / * * / comment\n\tif ((colnr_T)cin_skip2pos(trypos) == trypos->col\n\t\t && (pos = ind_find_start_CORS(NULL)) == NULL) // XXX\n\t break;\n\tif (pos != NULL)\n\t curwin->w_cursor = *pos;\n }\n curwin->w_cursor = cursor_save;\n return trypos;\n}", "label": 1, "label_name": "safe"} -{"code": "func signatureFromJTI(jti string) string {\n\treturn fmt.Sprintf(\"%x\", sha256.Sum256([]byte(jti)))\n}", "label": 1, "label_name": "safe"} -{"code": " public function edit_discount() {\n $id = empty($this->params['id']) ? null : $this->params['id'];\n $discount = new discounts($id);\n \n //grab all user groups\n $group = new group();\n \n //create two 'default' groups:\n $groups = array( \n -1 => 'ALL LOGGED IN USERS',\n -2 => 'ALL NON-LOGGED IN USERS'\n );\n //loop our groups and append them to the array\n // foreach ($group->find() as $g){\n //this is a workaround for older code. Use the previous line if possible:\n $allGroups = group::getAllGroups();\n if (count($allGroups))\n {\n foreach ($allGroups as $g)\n {\n $groups[$g->id] = $g->name;\n };\n }\n //find our selected groups for this discount already\n // eDebug($discount); \n $selected_groups = array();\n if (!empty($discount->group_ids))\n {\n $selected_groups = expUnserialize($discount->group_ids);\n }\n \n if ($discount->minimum_order_amount == \"\") $discount->minimum_order_amount = 0;\n if ($discount->discount_amount == \"\") $discount->discount_amount = 0;\n if ($discount->discount_percent == \"\") $discount->discount_percent = 0;\n \n // get the shipping options and their methods\n $shipping_services = array();\n $shipping_methods = array();\n// $shipping = new shipping();\n foreach (shipping::listAvailableCalculators() as $calcid=>$name) {\n if (class_exists($name)) {\n $calc = new $name($calcid);\n $shipping_services[$calcid] = $calc->title;\n $shipping_methods[$calcid] = $calc->availableMethods();\n }\n }\n \n assign_to_template(array(\n 'discount'=>$discount,\n 'groups'=>$groups,\n 'selected_groups'=>$selected_groups,\n 'shipping_services'=>$shipping_services,\n 'shipping_methods'=>$shipping_methods\n ));\n }", "label": 0, "label_name": "vulnerable"} -{"code": " print_r($single_error);\n }\n\n echo '';\n }", "label": 0, "label_name": "vulnerable"} -{"code": "def get_wizard(params, request, auth_user)\n if not allowed_for_local_cluster(auth_user, Permissions::READ)\n return 403, 'Permission denied'\n end\n wizard = PCSDWizard.getWizard(params[\"wizard\"])\n if wizard != nil\n return erb wizard.collection_page\n else\n return \"Error finding Wizard - #{params[\"wizard\"]}\"\n end\nend", "label": 1, "label_name": "safe"} -{"code": "Blamer.prototype.blameByFile = function blameByFile(file, args) {\n if (!blamerVCS.hasOwnProperty(this.type)) {\n throw new Error('VCS \"' + this.type + '\" don\\'t supported');\n }\n args = typeof args === 'string' ? args : this.args;\n return blamerVCS[this.type](file, args);\n};", "label": 0, "label_name": "vulnerable"} -{"code": " void testSetOrdersPseudoHeadersCorrectly() {\n final HttpHeadersBase headers = newHttp2Headers();\n final HttpHeadersBase other = newEmptyHeaders();\n other.add(\"name2\", \"value2\");\n other.add(\"name3\", \"value3\");\n other.add(\"name4\", \"value4\");\n other.authority(\"foo\");\n\n final int headersSizeBefore = headers.size();\n headers.set(other);\n verifyPseudoHeadersFirst(headers);\n verifyAllPseudoHeadersPresent(headers);\n assertThat(headers.size()).isEqualTo(headersSizeBefore + 1);\n assertThat(headers.authority()).isEqualTo(\"foo\");\n assertThat(headers.get(\"name2\")).isEqualTo(\"value2\");\n assertThat(headers.get(\"name3\")).isEqualTo(\"value3\");\n assertThat(headers.get(\"name4\")).isEqualTo(\"value4\");\n }", "label": 1, "label_name": "safe"} -{"code": " public function __construct()\n {\n $this->ipv4 = new HTMLPurifier_AttrDef_URI_IPv4();\n $this->ipv6 = new HTMLPurifier_AttrDef_URI_IPv6();\n }", "label": 1, "label_name": "safe"} -{"code": "E=C.createElement(\"output\");C.appendChild(E);C=new mxXmlCanvas2D(E);C.translate(Math.floor((1-z.x)/L),Math.floor((1-z.y)/L));C.scale(1/L);var G=0,P=C.save;C.save=function(){G++;P.apply(this,arguments)};var J=C.restore;C.restore=function(){G--;J.apply(this,arguments)};var F=t.drawShape;t.drawShape=function(H){mxLog.debug(\"entering shape\",H,G);F.apply(this,arguments);mxLog.debug(\"leaving shape\",H,G)};t.drawState(m.getView().getState(m.model.root),C);mxLog.show();mxLog.debug(mxUtils.getXml(E));mxLog.debug(\"stateCounter\",", "label": 1, "label_name": "safe"} -{"code": "func (svc *Service) GetHost(ctx context.Context, id uint) (*fleet.HostDetail, error) {\n\talreadyAuthd := svc.authz.IsAuthenticatedWith(ctx, authz_ctx.AuthnDeviceToken)\n\tif !alreadyAuthd {\n\t\t// First ensure the user has access to list hosts, then check the specific\n\t\t// host once team_id is loaded.\n\t\tif err := svc.authz.Authorize(ctx, &fleet.Host{}, fleet.ActionList); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\thost, err := svc.ds.Host(ctx, id, false)\n\tif err != nil {\n\t\treturn nil, ctxerr.Wrap(ctx, err, \"get host\")\n\t}\n\n\tif !alreadyAuthd {\n\t\t// Authorize again with team loaded now that we have team_id\n\t\tif err := svc.authz.Authorize(ctx, host, fleet.ActionRead); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn svc.getHostDetails(ctx, host)\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function test()\n {\n $this->def = new HTMLPurifier_AttrDef_CSS_Color();\n\n $this->assertDef('#F00');\n $this->assertDef('#fff');\n $this->assertDef('#eeeeee');\n $this->assertDef('#808080');\n\n $this->assertDef('rgb(255, 0, 0)', 'rgb(255,0,0)'); // rm spaces\n $this->assertDef('rgb(100%,0%,0%)');\n $this->assertDef('rgb(50.5%,23.2%,43.9%)'); // decimals okay\n $this->assertDef('rgb(-5,0,0)', 'rgb(0,0,0)'); // negative values\n $this->assertDef('rgb(295,0,0)', 'rgb(255,0,0)'); // max values\n $this->assertDef('rgb(12%,150%,0%)', 'rgb(12%,100%,0%)'); // percentage max values\n\n $this->assertDef('rgba(255, 0, 0, 0)', 'rgba(255,0,0,0)'); // rm spaces\n $this->assertDef('rgba(100%,0%,0%,0.4)');\n $this->assertDef('rgba(38.1%,59.7%,1.8%,0.7)', 'rgba(38.1%,59.7%,1.8%,0.7)'); // decimals okay\n\n $this->assertDef('hsl(275, 45%, 81%)', 'hsl(275,45%,81%)'); // rm spaces\n $this->assertDef('hsl(100,0%,0%)');\n $this->assertDef('hsl(38,59.7%,1.8%)', 'hsl(38,59.7%,1.8%)'); // decimals okay\n $this->assertDef('hsl(-11,-15%,25%)', 'hsl(0,0%,25%)'); // negative values\n $this->assertDef('hsl(380,125%,0%)', 'hsl(360,100%,0%)'); // max values\n\n $this->assertDef('hsla(100, 74%, 29%, 0)', 'hsla(100,74%,29%,0)'); // rm spaces\n $this->assertDef('hsla(154,87%,21%,0.4)');\n $this->assertDef('hsla(45,94.3%,4.1%,0.7)', 'hsla(45,94.3%,4.1%,0.7)'); // decimals okay\n\n $this->assertDef('#G00', false);\n $this->assertDef('cmyk(40, 23, 43, 23)', false);\n $this->assertDef('rgb(0%, 23, 68%)', false); // no mixed type\n $this->assertDef('rgb(231, 144, 28.2%)', false); // no mixed type\n $this->assertDef('hsl(18%,12%,89%)', false); // integer, percentage, percentage\n\n // clip numbers outside sRGB gamut\n $this->assertDef('rgb(200%, -10%, 0%)', 'rgb(100%,0%,0%)');\n $this->assertDef('rgb(256,-23,34)', 'rgb(255,0,34)');\n\n // color keywords, of course\n $this->assertDef('red', '#FF0000');\n\n // malformed hex declaration\n $this->assertDef('808080', '#808080');\n $this->assertDef('000000', '#000000');\n $this->assertDef('fed', '#fed');\n\n // maybe hex transformations would be another nice feature\n // at the very least transform rgb percent to rgb integer\n\n }", "label": 1, "label_name": "safe"} -{"code": "void BlockCodec::runPull()\n{\n\tAFframecount framesToRead = m_outChunk->frameCount;\n\tAFframecount framesRead = 0;\n\n\tassert(framesToRead % m_framesPerPacket == 0);\n\tint blockCount = framesToRead / m_framesPerPacket;\n\n\t// Read the compressed data.\n\tssize_t bytesRead = read(m_inChunk->buffer, m_bytesPerPacket * blockCount);\n\tint blocksRead = bytesRead >= 0 ? bytesRead / m_bytesPerPacket : 0;\n\n\t// Decompress into m_outChunk.\n\tfor (int i=0; i(m_inChunk->buffer) + i * m_bytesPerPacket,\n\t\t\tstatic_cast(m_outChunk->buffer) + i * m_framesPerPacket * m_track->f.channelCount);\n\n\t\tframesRead += m_framesPerPacket;\n\t}\n\n\tm_track->nextfframe += framesRead;\n\n\tassert(tell() == m_track->fpos_next_frame);\n\n\tif (framesRead < framesToRead)\n\t\treportReadError(framesRead, framesToRead);\n\n\tm_outChunk->frameCount = framesRead;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " var VideoDialog = function (context) {\n var self = this;\n var ui = $.summernote.ui;\n\n var $editor = context.layoutInfo.editor;\n var options = context.options;\n var lang = options.langInfo;\n\n this.initialize = function () {\n var $container = options.dialogsInBody ? $(document.body) : $editor;\n\n var body = '
' +\n '' +\n '' +\n '
';\n var footer = '';\n\n this.$dialog = ui.dialog({\n title: lang.video.insert,\n fade: options.dialogsFade,\n body: body,\n footer: footer\n }).render().appendTo($container);\n };\n\n this.destroy = function () {\n ui.hideDialog(this.$dialog);\n this.$dialog.remove();\n };\n\n this.bindEnterKey = function ($input, $btn) {\n $input.on('keypress', function (event) {\n if (event.keyCode === key.code.ENTER) {\n $btn.trigger('click');\n }\n });\n };\n\n this.createVideoNode = function (url) {\n // video url patterns(youtube, instagram, vimeo, dailymotion, youku, mp4, ogg, webm)\n var ytRegExp = /^(?:https?:\\/\\/)?(?:www\\.)?(?:youtu\\.be\\/|youtube\\.com\\/(?:embed\\/|v\\/|watch\\?v=|watch\\?.+&v=))((\\w|-){11})(?:\\S+)?$/;\n var ytMatch = url.match(ytRegExp);\n\n var igRegExp = /\\/\\/instagram.com\\/p\\/(.[a-zA-Z0-9_-]*)/;\n var igMatch = url.match(igRegExp);\n\n var vRegExp = /\\/\\/vine.co\\/v\\/(.[a-zA-Z0-9]*)/;\n var vMatch = url.match(vRegExp);\n\n var vimRegExp = /\\/\\/(player.)?vimeo.com\\/([a-z]*\\/)*([0-9]{6,11})[?]?.*/;\n var vimMatch = url.match(vimRegExp);\n\n var dmRegExp = /.+dailymotion.com\\/(video|hub)\\/([^_]+)[^#]*(#video=([^_&]+))?/;\n var dmMatch = url.match(dmRegExp);\n\n var youkuRegExp = /\\/\\/v\\.youku\\.com\\/v_show\\/id_(\\w+)=*\\.html/;\n var youkuMatch = url.match(youkuRegExp);\n\n var mp4RegExp = /^.+.(mp4|m4v)$/;\n var mp4Match = url.match(mp4RegExp);\n\n var oggRegExp = /^.+.(ogg|ogv)$/;\n var oggMatch = url.match(oggRegExp);\n\n var webmRegExp = /^.+.(webm)$/;\n var webmMatch = url.match(webmRegExp);\n\n var $video;\n if (ytMatch && ytMatch[1].length === 11) {\n var youtubeId = ytMatch[1];\n $video = $('';\r\n core_terminate();\r\n break;\r\n\r\n case 'remove':\r\n // check the theme is not actually used in any website\r\n $usages = $DB->query_single(\r\n 'COUNT(*)',\r\n 'nv_websites',\r\n ' theme = :theme',\r\n null,\r\n array(\r\n ':theme' => $_REQUEST['theme']\r\n )\r\n );\r\n if($usages == 0)\r\n {\r\n try\r\n {\r\n $theme = new theme();\r\n $theme->load($_REQUEST['theme']);\r\n $status = $theme->delete();\r\n echo json_encode($status);\r\n }\r\n catch(Exception $e)\r\n {\r\n echo $e->getMessage();\r\n }\r\n }\r\n else\r\n {\r\n $status = t(537, \"Can't remove the theme because it is currently being used by another website.\");\r\n echo $status;\r\n }\r\n core_terminate();\r\n break;\r\n\r\n /*\r\n case 'export':\r\n $out = themes_export_form();\r\n break;\r\n */\r\n\r\n case 'theme_sample_content_import':\r\n try\r\n {\r\n $theme->import_sample();\r\n $layout->navigate_notification(t(374, \"Item installed successfully.\"), false);\r\n }\r\n catch(Exception $e)\r\n {\r\n $layout->navigate_notification($e->getMessage(), true, true);\r\n }\r\n\r\n $themes = theme::list_available();\r\n $out = themes_grid($themes);\r\n break;\r\n\r\n case 'theme_sample_content_export':\r\n if(empty($_POST))\r\n $out = themes_sample_content_export_form();\r\n else\r\n {\r\n $categories = explode(',', $_POST['categories']);\r\n $folder = $_POST['folder'];\r\n $items = explode(',', $_POST['elements']);\r\n $block_groups = explode(',', $_POST['block_groups']);\r\n $blocks = explode(',', $_POST['blocks']);\r\n $comments = explode(',', $_POST['comments']);\r\n\r\n theme::export_sample($categories, $items, $block_groups, $blocks, $comments, $folder);\r\n\r\n core_terminate();\r\n }\r\n break;\r\n\r\n case 'install_from_hash':\r\n $url = base64_decode($_GET['hash']);\r\n\r\n if(!empty($url) && $user->permission(\"themes.install\")==\"true\")\r\n {\r\n $error = false;\r\n parse_str(parse_url($url, PHP_URL_QUERY), $query);\r\n\r\n $tmp_file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $query['code'] . '.zip';\r\n @core_file_curl($url, $tmp_file);\r\n if(@filesize($tmp_file) == 0)\r\n {\r\n @unlink($tmp_file);\r\n // core file curl failed, try using file_get_contents...\r\n $tmp = @file_get_contents($url);\r\n if(!empty($tmp))\r\n {\r\n @file_put_contents($tmp_file, $tmp);\r\n }\r\n unset($tmp);\r\n }\r\n\r\n if(@filesize($tmp_file) > 0)\r\n {\r\n // uncompress ZIP and copy it to the themes dir\r\n @mkdir(NAVIGATE_PATH.'/themes/'.$query['code']);\r\n\r\n $zip = new ZipArchive();\r\n $zip_open_status = $zip->open($tmp_file);\r\n if($zip_open_status === TRUE)\r\n {\r\n $zip->extractTo(NAVIGATE_PATH.'/themes/'.$query['code']);\r\n $zip->close();\r\n\r\n $layout->navigate_notification(t(374, \"Item installed successfully.\"), false);\r\n }\r\n else // zip extraction failed\r\n {\r\n $layout->navigate_notification('ERROR '.$zip_open_status, true, true);\r\n $error = true;\r\n }\r\n }\r\n else\r\n {\r\n $layout->navigate_notification(t(56, 'Unexpected error'), true, true);\r\n $error = true;\r\n }\r\n\r\n if($error)\r\n {\r\n $layout->add_content('\r\n
\r\n

'.t(529, \"It has not been possible to download the item you have just bought from the marketplace.\").'

\r\n

'.t(530, \"You have to visit your Marketplace Dashboard and download the file, then use the Install from file button you'll find in the actions bar on the right.\").'

\r\n

'.t(531, \"Sorry for the inconvenience.\").'

\r\n '.t(532, \"Navigate CMS Marketplace\").'\r\n
\r\n ');\r\n $layout->add_script('\r\n $(\"#navigate_marketplace_install_from_hash_error\").dialog({\r\n modal: true,\r\n title: \"'.t(56, \"Unexpected error\").'\"\r\n });\r\n ');\r\n }\r\n }\r\n // don't break, we want to show the themes grid right now (theme_upload by browser upload won't trigger)\r\n\r\n case 'theme_upload':\r\n if(isset($_FILES['theme-upload']) && $_FILES['theme-upload']['error']==0 && $user->permission(\"themes.install\")==\"true\")\r\n {\r\n // uncompress ZIP and copy it to the themes dir\r\n $tmp = trim(substr($_FILES['theme-upload']['name'], 0, strpos($_FILES['theme-upload']['name'], '.')));\r\n $theme_name = filter_var($tmp, FILTER_SANITIZE_EMAIL);\r\n\r\n if($tmp!=$theme_name) // INVALID file name\r\n {\r\n $layout->navigate_notification(t(344, 'Security error'), true, true);\r\n }\r\n else\r\n {\r\n @mkdir(NAVIGATE_PATH.'/themes/'.$theme_name);\r\n\r\n $zip = new ZipArchive;\r\n if($zip->open($_FILES['theme-upload']['tmp_name']) === TRUE)\r\n {\r\n $zip->extractTo(NAVIGATE_PATH.'/themes/'.$theme_name);\r\n $zip->close();\r\n\r\n $layout->navigate_notification(t(374, \"Item installed successfully.\"), false);\r\n }\r\n else // zip extraction failed\r\n {\r\n $layout->navigate_notification(t(262, 'Error uploading file'), true, true);\r\n }\r\n }\r\n }\r\n // don't break, we want to show the themes grid right now\r\n\r\n case 'themes':\r\n default:\r\n if(@$_REQUEST['opt']=='install')\r\n {\r\n $ntheme = new theme();\r\n $ntheme->load($_REQUEST['theme']);\r\n\r\n $website->theme = $ntheme->name;\r\n\r\n if(!empty($ntheme->styles))\r\n {\r\n $nst = get_object_vars($ntheme->styles);\r\n $nst = array_keys($nst);\r\n\r\n if(!isset($website->theme_options) || empty($website->theme_options))\r\n $website->theme_options = json_decode('{\"style\": \"\"}');\r\n $website->theme_options->style = array_shift($nst);\r\n }\r\n else\r\n {\r\n if(!isset($website->theme_options) || empty($website->theme_options))\r\n $website->theme_options = json_decode('{\"style\": \"\"}');\r\n else\r\n $website->theme_options->style = \"\";\r\n }\r\n\r\n try\r\n {\r\n $website->update();\r\n $layout->navigate_notification(t(374, \"Item installed successfully.\"), false);\r\n }\r\n catch(Exception $e)\r\n {\r\n $layout->navigate_notification($e->getMessage(), true, true);\r\n }\r\n }\r\n\r\n $themes = theme::list_available();\r\n\r\n $out = themes_grid($themes);\r\n break;\r\n\r\n }\r\n\t\r\n\treturn $out;\r\n}\r", "label": 1, "label_name": "safe"} -{"code": "apiUsers.createPublicAccount = function (req, res) {\n const SettingSchema = require('../../../models/setting')\n\n const response = {}\n response.success = true\n const postData = req.body\n if (!_.isObject(postData)) return res.status(400).json({ success: false, error: 'Invalid Post Data' })\n\n let user, group\n\n async.waterfall(\n [\n function (next) {\n SettingSchema.getSetting('allowUserRegistration:enable', function (err, allowUserRegistration) {\n if (err) return next(err)\n if (!allowUserRegistration) {\n winston.warn('Public account creation was attempted while disabled!')\n return next({ message: 'Public account creation is disabled.' })\n }\n\n return next()\n })\n },\n function (next) {\n SettingSchema.getSetting('role:user:default', function (err, roleDefault) {\n if (err) return next(err)\n if (!roleDefault) {\n winston.error('No Default User Role Set. (Settings > Permissions > Default User Role)')\n return next({ message: 'No Default Role Set. Please contact administrator.' })\n }\n\n return next(null, roleDefault)\n })\n },\n function (roleDefault, next) {\n SettingSchema.getSetting('accountsPasswordComplexity:enable', function (err, passwordComplexitySetting) {\n if (err) return next(err)\n if (!passwordComplexitySetting || passwordComplexitySetting.value === true) {\n const passwordComplexity = require('../../../settings/passwordComplexity')\n if (!passwordComplexity.validate(postData.user.password))\n return next({ message: 'Password does not minimum requirements.' })\n\n return next(null, roleDefault)\n }\n\n return next(null, roleDefault)\n })\n },\n function (roleDefault, next) {\n const UserSchema = require('../../../models/user')\n user = new UserSchema({\n username: postData.user.email,\n password: postData.user.password,\n fullname: postData.user.fullname,\n email: postData.user.email,\n role: roleDefault.value\n })\n\n user.save(function (err, savedUser) {\n if (err) return next(err)\n\n return next(null, savedUser)\n })\n },\n function (savedUser, next) {\n const GroupSchema = require('../../../models/group')\n group = new GroupSchema({\n name: savedUser.email,\n members: [savedUser._id],\n sendMailTo: [savedUser._id],\n public: true\n })\n\n group.save(function (err, savedGroup) {\n if (err) return next(err)\n\n return next(null, { user: savedUser, group: savedGroup })\n })\n }\n ],\n function (err, result) {\n if (err) winston.debug(err)\n if (err) return res.status(400).json({ success: false, error: err.message })\n\n delete result.user.password\n result.user.password = undefined\n\n return res.json({\n success: true,\n userData: { user: result.user, group: result.group }\n })\n }\n )\n}", "label": 1, "label_name": "safe"} -{"code": " is: function(ch, chars) {\n return chars.indexOf(ch) !== -1;\n },", "label": 0, "label_name": "vulnerable"} -{"code": "Graph.fileSupport&&(D.addEventListener(\"dragover\",function(v){v.stopPropagation();v.preventDefault()},!1),D.addEventListener(\"drop\",function(v){v.stopPropagation();v.preventDefault();if(0nicEvent = TRUE;\n //Notify the TCP/IP stack of the event\n flag |= osSetEventFromIsr(&netEvent);\n }\n\n //Packet received?\n if((status & EIR_PKTIF) != 0)\n {\n //Disable PKTIE interrupt\n enc28j60ClearBit(interface, ENC28J60_REG_EIE, EIE_PKTIE);\n\n //Set event flag\n interface->nicEvent = TRUE;\n //Notify the TCP/IP stack of the event\n flag |= osSetEventFromIsr(&netEvent);\n }\n\n //Packet transmission complete?\n if((status & (EIR_TXIF | EIE_TXERIE)) != 0)\n {\n //Clear interrupt flags\n enc28j60ClearBit(interface, ENC28J60_REG_EIR, EIR_TXIF | EIE_TXERIE);\n\n //Notify the TCP/IP stack that the transmitter is ready to send\n flag |= osSetEventFromIsr(&interface->nicTxEvent);\n }\n\n //Once the interrupt has been serviced, the INTIE bit\n //is set again to re-enable interrupts\n enc28j60SetBit(interface, ENC28J60_REG_EIE, EIE_INTIE);\n\n //A higher priority task must be woken?\n return flag;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "\t\t\t\tlocked : !phash ? true : file.rm === void(0) ? false : !file.rm\n\t\t\t};\n\t\t\n\t\tif (file.mime == 'application/x-empty' || file.mime == 'inode/x-empty') {\n\t\t\tinfo.mime = 'text/plain';\n\t\t}\n\t\tif (file.linkTo) {\n\t\t\tinfo.alias = file.linkTo;\n\t\t}\n\n\t\tif (file.linkTo) {\n\t\t\tinfo.linkTo = file.linkTo;\n\t\t}\n\t\t\n\t\tif (file.tmb) {\n\t\t\tinfo.tmb = file.tmb;\n\t\t} else if (info.mime.indexOf('image/') === 0 && tmb) {\n\t\t\tinfo.tmb = 1;\n\t\t\t\n\t\t}\n\n\t\tif (file.dirs && file.dirs.length) {\n\t\t\tinfo.dirs = true;\n\t\t}\n\t\tif (file.dim) {\n\t\t\tinfo.dim = file.dim;\n\t\t}\n\t\tif (file.resize) {\n\t\t\tinfo.resize = file.resize;\n\t\t}\n\t\treturn info;\n\t}", "label": 1, "label_name": "safe"} -{"code": "int ntlm_read_message_fields(wStream* s, NTLM_MESSAGE_FIELDS* fields)\n{\n\tif (Stream_GetRemainingLength(s) < 8)\n\t\treturn -1;\n\n\tStream_Read_UINT16(s, fields->Len); /* Len (2 bytes) */\n\tStream_Read_UINT16(s, fields->MaxLen); /* MaxLen (2 bytes) */\n\tStream_Read_UINT32(s, fields->BufferOffset); /* BufferOffset (4 bytes) */\n\treturn 1;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " private function elementInScope($el, $table = false) {\n if(is_array($el)) {\n foreach($el as $element) {\n if($this->elementInScope($element, $table)) {\n return true;\n }\n }\n\n return false;\n }\n\n $leng = count($this->stack);\n\n for($n = 0; $n < $leng; $n++) {\n /* 1. Initialise node to be the current node (the bottommost node of\n the stack). */\n $node = $this->stack[$leng - 1 - $n];\n\n if($node->tagName === $el) {\n /* 2. If node is the target node, terminate in a match state. */\n return true;\n\n } elseif($node->tagName === 'table') {\n /* 3. Otherwise, if node is a table element, terminate in a failure\n state. */\n return false;\n\n } elseif($table === true && in_array($node->tagName, array('caption', 'td',\n 'th', 'button', 'marquee', 'object'))) {\n /* 4. Otherwise, if the algorithm is the \"has an element in scope\"\n variant (rather than the \"has an element in table scope\" variant),\n and node is one of the following, terminate in a failure state. */\n return false;\n\n } elseif($node === $node->ownerDocument->documentElement) {\n /* 5. Otherwise, if node is an html element (root element), terminate\n in a failure state. (This can only happen if the node is the topmost\n node of the stack of open elements, and prevents the next step from\n being invoked if there are no more elements in the stack.) */\n return false;\n }\n\n /* Otherwise, set node to the previous entry in the stack of open\n elements and return to step 2. (This will never fail, since the loop\n will always terminate in the previous step if the top of the stack\n is reached.) */\n }\n }", "label": 1, "label_name": "safe"} -{"code": " it \"does not raise error if record is not pending\" do\n reviewable = ReviewableUser.needs_review!(target: Fabricate(:user, email: invite.email), created_by: invite.invited_by)\n reviewable.status = Reviewable.statuses[:ignored]\n reviewable.save!\n invite_redeemer.redeem\n\n reviewable.reload\n expect(reviewable.status).to eq(Reviewable.statuses[:ignored])\n end", "label": 0, "label_name": "vulnerable"} -{"code": " title: 'Synchronize Requisition ' + _.escape(requisition.foreignSource),\n buttons: {\n fullSync: {\n label: 'Yes',\n className: 'btn-primary',\n callback: function() {\n doSynchronize(requisition, 'true');\n }\n },\n dbOnlySync: {\n label: 'DB Only',\n className: 'btn-secondary',\n callback: function() {\n doSynchronize(requisition, 'dbonly');\n }\n },\n ignoreExistingSync: {\n label: 'No',\n className: 'btn-secondary',\n callback: function() {\n doSynchronize(requisition, 'false');\n }\n },\n main: {\n label: 'Cancel',\n className: 'btn-secondary'\n }\n }\n });\n }", "label": 1, "label_name": "safe"} -{"code": "\tprivate function _notlinksto( $option ) {\n\t\tif ( $this->parameters->getParameter( 'distinct' ) == 'strict' ) {\n\t\t\t$this->addGroupBy( 'page_title' );\n\t\t}\n\t\tif ( count( $option ) ) {\n\t\t\t$where = $this->tableNames['page'] . '.page_id NOT IN (SELECT ' . $this->tableNames['pagelinks'] . '.pl_from FROM ' . $this->tableNames['pagelinks'] . ' WHERE ';\n\t\t\t$ors = [];\n\t\t\tforeach ( $option as $linkGroup ) {\n\t\t\t\tforeach ( $linkGroup as $link ) {\n\t\t\t\t\t$_or = '(' . $this->tableNames['pagelinks'] . '.pl_namespace=' . intval( $link->getNamespace() );\n\t\t\t\t\tif ( strpos( $link->getDbKey(), '%' ) >= 0 ) {\n\t\t\t\t\t\t$operator = 'LIKE';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$operator = '=';\n\t\t\t\t\t}\n\t\t\t\t\tif ( $this->parameters->getParameter( 'ignorecase' ) ) {\n\t\t\t\t\t\t$_or .= ' AND LOWER(CAST(' . $this->tableNames['pagelinks'] . '.pl_title AS char)) ' . $operator . ' LOWER(' . $this->DB->addQuotes( $link->getDbKey() ) . '))';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$_or .= ' AND ' . $this->tableNames['pagelinks'] . '.pl_title ' . $operator . ' ' . $this->DB->addQuotes( $link->getDbKey() ) . ')';\n\t\t\t\t\t}\n\t\t\t\t\t$ors[] = $_or;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$where .= '(' . implode( ' OR ', $ors ) . '))';\n\t\t}\n\t\t$this->addWhere( $where );\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": " default List getPermissions() {\n List permissions = new ArrayList<>();\n permissions.add(\"*:*\");\n permissions.add(this.getName().replace('_', ':'));\n permissions.add(this.getName().substring(0, this.getName().indexOf('_')) + \":*\");\n return permissions;\n };", "label": 0, "label_name": "vulnerable"} -{"code": " $this->stack[0]->appendChild($comment);\n\n /* An end tag with the tag name \"html\" */\n } elseif($token['type'] === HTML5::ENDTAG && $token['name'] === 'html') {\n /* If the parser was originally created in order to handle the\n setting of an element's innerHTML attribute, this is a parse error;\n ignore the token. (The element will be an html element in this\n case.) (innerHTML case) */\n\n /* Otherwise, switch to the trailing end phase. */\n $this->phase = self::END_PHASE;\n\n /* Anything else */\n } else {\n /* Parse error. Set the insertion mode to \"in body\" and reprocess\n the token. */\n $this->mode = self::IN_BODY;\n return $this->inBody($token);\n }\n }", "label": 1, "label_name": "safe"} -{"code": " def read_config(self, config, **kwargs):\n self.recaptcha_private_key = config.get(\"recaptcha_private_key\")\n self.recaptcha_public_key = config.get(\"recaptcha_public_key\")\n self.enable_registration_captcha = config.get(\n \"enable_registration_captcha\", False\n )\n self.recaptcha_siteverify_api = config.get(\n \"recaptcha_siteverify_api\",\n \"https://www.recaptcha.net/recaptcha/api/siteverify\",\n )\n self.recaptcha_template = self.read_template(\"recaptcha.html\")", "label": 1, "label_name": "safe"} -{"code": " def initialize(string)\n super(\"'#{string}' is not a valid object id.\")\n end", "label": 0, "label_name": "vulnerable"} -{"code": "config_monitor(\n\tconfig_tree *ptree\n\t)\n{\n\tint_node *pfilegen_token;\n\tconst char *filegen_string;\n\tconst char *filegen_file;\n\tFILEGEN *filegen;\n\tfilegen_node *my_node;\n\tattr_val *my_opts;\n\tint filegen_type;\n\tint filegen_flag;\n\n\t/* Set the statistics directory */\n\tif (ptree->stats_dir)\n\t\tstats_config(STATS_STATSDIR, ptree->stats_dir);\n\n\t/* NOTE:\n\t * Calling filegen_get is brain dead. Doing a string\n\t * comparison to find the relavant filegen structure is\n\t * expensive.\n\t *\n\t * Through the parser, we already know which filegen is\n\t * being specified. Hence, we should either store a\n\t * pointer to the specified structure in the syntax tree\n\t * or an index into a filegen array.\n\t *\n\t * Need to change the filegen code to reflect the above.\n\t */\n\n\t/* Turn on the specified statistics */\n\tpfilegen_token = HEAD_PFIFO(ptree->stats_list);\n\tfor (; pfilegen_token != NULL; pfilegen_token = pfilegen_token->link) {\n\t\tfilegen_string = keyword(pfilegen_token->i);\n\t\tfilegen = filegen_get(filegen_string);\n\t\tif (NULL == filegen) {\n\t\t\tmsyslog(LOG_ERR,\n\t\t\t\t\"stats %s unrecognized\",\n\t\t\t\tfilegen_string);\n\t\t\tcontinue;\n\t\t}\n\t\tDPRINTF(4, (\"enabling filegen for %s statistics '%s%s'\\n\",\n\t\t\t filegen_string, filegen->prefix, \n\t\t\t filegen->basename));\n\t\tfilegen->flag |= FGEN_FLAG_ENABLED;\n\t}\n\n\t/* Configure the statistics with the options */\n\tmy_node = HEAD_PFIFO(ptree->filegen_opts);\n\tfor (; my_node != NULL; my_node = my_node->link) {\n\t\tfilegen_file = keyword(my_node->filegen_token);\n\t\tfilegen = filegen_get(filegen_file);\n\t\tif (NULL == filegen) {\n\t\t\tmsyslog(LOG_ERR,\n\t\t\t\t\"filegen category '%s' unrecognized\",\n\t\t\t\tfilegen_file);\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* Initialize the filegen variables to their pre-configuration states */\n\t\tfilegen_flag = filegen->flag;\n\t\tfilegen_type = filegen->type;\n\n\t\t/* \"filegen ... enabled\" is the default (when filegen is used) */\n\t\tfilegen_flag |= FGEN_FLAG_ENABLED;\n\n\t\tmy_opts = HEAD_PFIFO(my_node->options);\n\t\tfor (; my_opts != NULL; my_opts = my_opts->link) {\n\t\t\tswitch (my_opts->attr) {\n\n\t\t\tcase T_File:\n\t\t\t\tfilegen_file = my_opts->value.s;\n\t\t\t\tbreak;\n\n\t\t\tcase T_Type:\n\t\t\t\tswitch (my_opts->value.i) {\n\n\t\t\t\tdefault:\n\t\t\t\t\tNTP_INSIST(0);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_None:\n\t\t\t\t\tfilegen_type = FILEGEN_NONE;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Pid:\n\t\t\t\t\tfilegen_type = FILEGEN_PID;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Day:\n\t\t\t\t\tfilegen_type = FILEGEN_DAY;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Week:\n\t\t\t\t\tfilegen_type = FILEGEN_WEEK;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Month:\n\t\t\t\t\tfilegen_type = FILEGEN_MONTH;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Year:\n\t\t\t\t\tfilegen_type = FILEGEN_YEAR;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Age:\n\t\t\t\t\tfilegen_type = FILEGEN_AGE;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase T_Flag:\n\t\t\t\tswitch (my_opts->value.i) {\n\n\t\t\t\tcase T_Link:\n\t\t\t\t\tfilegen_flag |= FGEN_FLAG_LINK;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Nolink:\n\t\t\t\t\tfilegen_flag &= ~FGEN_FLAG_LINK;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Enable:\n\t\t\t\t\tfilegen_flag |= FGEN_FLAG_ENABLED;\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase T_Disable:\n\t\t\t\t\tfilegen_flag &= ~FGEN_FLAG_ENABLED;\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tmsyslog(LOG_ERR, \n\t\t\t\t\t\t\"Unknown filegen flag token %d\",\n\t\t\t\t\t\tmy_opts->value.i);\n\t\t\t\t\texit(1);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tmsyslog(LOG_ERR,\n\t\t\t\t\t\"Unknown filegen option token %d\",\n\t\t\t\t\tmy_opts->attr);\n\t\t\t\texit(1);\n\t\t\t}\n\t\t}\n\t\tfilegen_config(filegen, filegen_file, filegen_type,\n\t\t\t filegen_flag);\n\t}\n}", "label": 1, "label_name": "safe"} -{"code": "CKEDITOR.ui.prototype={add:function(a,e,b){b.name=a.toLowerCase();var c=this.items[a]={type:e,command:b.command||null,args:Array.prototype.slice.call(arguments,2)};CKEDITOR.tools.extend(c,b)},get:function(a){return this.instances[a]},create:function(a){var e=this.items[a],b=e&&this._.handlers[e.type],c=e&&e.command&&this.editor.getCommand(e.command),b=b&&b.create.apply(this,e.args);this.instances[a]=b;c&&c.uiItems.push(b);if(b&&!b.type)b.type=e.type;return b},addHandler:function(a,e){this._.handlers[a]=\ne},space:function(a){return CKEDITOR.document.getById(this.spaceId(a))},spaceId:function(a){return this.editor.id+\"_\"+a}};CKEDITOR.event.implementOn(CKEDITOR.ui);", "label": 1, "label_name": "safe"} -{"code": " Button.prototype.setState = function (state) {\n var d = 'disabled'\n var $el = this.$element\n var val = $el.is('input') ? 'val' : 'html'\n var data = $el.data()\n\n state += 'Text'\n\n if (data.resetText == null) $el.data('resetText', $el[val]())\n\n // push to event loop to allow forms to submit\n setTimeout($.proxy(function () {\n $el[val](data[state] == null ? this.options[state] : data[state])\n\n if (state == 'loadingText') {\n this.isLoading = true\n $el.addClass(d).attr(d, d)\n } else if (this.isLoading) {\n this.isLoading = false\n $el.removeClass(d).removeAttr(d)\n }\n }, this), 0)\n }", "label": 0, "label_name": "vulnerable"} -{"code": " html: Buffer.from('

Tere, tere

vana kere!

\\n')\n }\n };\n shared.resolveContent(mail.data, 'html', function (err, value) {\n expect(err).to.not.exist;\n expect(value).to.deep.equal(mail.data.html);\n done();\n });\n });", "label": 1, "label_name": "safe"} -{"code": " public static function checkPermissions($permission,$location) {\r\n global $exponent_permissions_r, $router;\r\n\r\n // only applies to the 'manage' method\r\n if (empty($location->src) && empty($location->int) && (!empty($router->params['action']) && $router->params['action'] == 'manage') || strpos($router->current_url, 'action=manage') !== false) {\r\n if (!empty($exponent_permissions_r['navigation'])) foreach ($exponent_permissions_r['navigation'] as $page) {\r\n foreach ($page as $pageperm) {\r\n if (!empty($pageperm['manage'])) return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r", "label": 0, "label_name": "vulnerable"} -{"code": "\twp.updates.requestForCredentialsModalCancel = function() {\n\t\t// no updateLock and no updateQueue means we already have cleared things up\n\t\tvar data, $message;\n\n\t\tif( wp.updates.updateLock === false && wp.updates.updateQueue.length === 0 ){\n\t\t\treturn;\n\t\t}\n\n\t\tdata = wp.updates.updateQueue[0].data;\n\n\t\t// remove the lock, and clear the queue\n\t\twp.updates.updateLock = false;\n\t\twp.updates.updateQueue = [];\n\n\t\twp.updates.requestForCredentialsModalClose();\n\t\tif ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {\n\t\t\t$message = $( '[data-plugin=\"' + data.plugin + '\"]' ).next().find( '.update-message' );\n\t\t} else if ( 'plugin-install' === pagenow ) {\n\t\t\t$message = $( '.plugin-card-' + data.slug ).find( '.update-now' );\n\t\t}\n\n\t\t$message.removeClass( 'updating-message' );\n\t\t$message.html( $message.data( 'originaltext' ) );\n\t\twp.a11y.speak( wp.updates.l10n.updateCancel );\n\t};", "label": 0, "label_name": "vulnerable"} -{"code": "struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)\n{\n\tstruct tcp_options_received tcp_opt;\n\tstruct inet_request_sock *ireq;\n\tstruct tcp_request_sock *treq;\n\tstruct ipv6_pinfo *np = inet6_sk(sk);\n\tstruct tcp_sock *tp = tcp_sk(sk);\n\tconst struct tcphdr *th = tcp_hdr(skb);\n\t__u32 cookie = ntohl(th->ack_seq) - 1;\n\tstruct sock *ret = sk;\n\tstruct request_sock *req;\n\tint mss;\n\tstruct dst_entry *dst;\n\t__u8 rcv_wscale;\n\n\tif (!sysctl_tcp_syncookies || !th->ack || th->rst)\n\t\tgoto out;\n\n\tif (tcp_synq_no_recent_overflow(sk))\n\t\tgoto out;\n\n\tmss = __cookie_v6_check(ipv6_hdr(skb), th, cookie);\n\tif (mss == 0) {\n\t\tNET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SYNCOOKIESFAILED);\n\t\tgoto out;\n\t}\n\n\tNET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SYNCOOKIESRECV);\n\n\t/* check for timestamp cookie support */\n\tmemset(&tcp_opt, 0, sizeof(tcp_opt));\n\ttcp_parse_options(skb, &tcp_opt, 0, NULL);\n\n\tif (!cookie_timestamp_decode(&tcp_opt))\n\t\tgoto out;\n\n\tret = NULL;\n\treq = inet_reqsk_alloc(&tcp6_request_sock_ops, sk, false);\n\tif (!req)\n\t\tgoto out;\n\n\tireq = inet_rsk(req);\n\ttreq = tcp_rsk(req);\n\ttreq->tfo_listener = false;\n\n\tif (security_inet_conn_request(sk, skb, req))\n\t\tgoto out_free;\n\n\treq->mss = mss;\n\tireq->ir_rmt_port = th->source;\n\tireq->ir_num = ntohs(th->dest);\n\tireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr;\n\tireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr;\n\tif (ipv6_opt_accepted(sk, skb, &TCP_SKB_CB(skb)->header.h6) ||\n\t np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo ||\n\t np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) {\n\t\tatomic_inc(&skb->users);\n\t\tireq->pktopts = skb;\n\t}\n\n\tireq->ir_iif = sk->sk_bound_dev_if;\n\t/* So that link locals have meaning */\n\tif (!sk->sk_bound_dev_if &&\n\t ipv6_addr_type(&ireq->ir_v6_rmt_addr) & IPV6_ADDR_LINKLOCAL)\n\t\tireq->ir_iif = tcp_v6_iif(skb);\n\n\tireq->ir_mark = inet_request_mark(sk, skb);\n\n\treq->num_retrans = 0;\n\tireq->snd_wscale\t= tcp_opt.snd_wscale;\n\tireq->sack_ok\t\t= tcp_opt.sack_ok;\n\tireq->wscale_ok\t\t= tcp_opt.wscale_ok;\n\tireq->tstamp_ok\t\t= tcp_opt.saw_tstamp;\n\treq->ts_recent\t\t= tcp_opt.saw_tstamp ? tcp_opt.rcv_tsval : 0;\n\ttreq->snt_synack.v64\t= 0;\n\ttreq->rcv_isn = ntohl(th->seq) - 1;\n\ttreq->snt_isn = cookie;\n\n\t/*\n\t * We need to lookup the dst_entry to get the correct window size.\n\t * This is taken from tcp_v6_syn_recv_sock. Somebody please enlighten\n\t * me if there is a preferred way.\n\t */\n\t{\n\t\tstruct in6_addr *final_p, final;\n\t\tstruct flowi6 fl6;\n\t\tmemset(&fl6, 0, sizeof(fl6));\n\t\tfl6.flowi6_proto = IPPROTO_TCP;\n\t\tfl6.daddr = ireq->ir_v6_rmt_addr;\n\t\tfinal_p = fl6_update_dst(&fl6, np->opt, &final);\n\t\tfl6.saddr = ireq->ir_v6_loc_addr;\n\t\tfl6.flowi6_oif = sk->sk_bound_dev_if;\n\t\tfl6.flowi6_mark = ireq->ir_mark;\n\t\tfl6.fl6_dport = ireq->ir_rmt_port;\n\t\tfl6.fl6_sport = inet_sk(sk)->inet_sport;\n\t\tsecurity_req_classify_flow(req, flowi6_to_flowi(&fl6));\n\n\t\tdst = ip6_dst_lookup_flow(sk, &fl6, final_p);\n\t\tif (IS_ERR(dst))\n\t\t\tgoto out_free;\n\t}\n\n\treq->rsk_window_clamp = tp->window_clamp ? :dst_metric(dst, RTAX_WINDOW);\n\ttcp_select_initial_window(tcp_full_space(sk), req->mss,\n\t\t\t\t &req->rsk_rcv_wnd, &req->rsk_window_clamp,\n\t\t\t\t ireq->wscale_ok, &rcv_wscale,\n\t\t\t\t dst_metric(dst, RTAX_INITRWND));\n\n\tireq->rcv_wscale = rcv_wscale;\n\tireq->ecn_ok = cookie_ecn_ok(&tcp_opt, sock_net(sk), dst);\n\n\tret = tcp_get_cookie_sock(sk, skb, req, dst);\nout:\n\treturn ret;\nout_free:\n\treqsk_free(req);\n\treturn NULL;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "export function updateGlobalState(key: string, value: any) {\n\tif (!globalState) {\n\t\treturn;\n\t}\n\treturn globalState.update(key, value);\n}", "label": 1, "label_name": "safe"} -{"code": " it \"should exist\" do\n expect(Puppet::Parser::Functions.function(\"upcase\")).to eq(\"function_upcase\")\n end", "label": 0, "label_name": "vulnerable"} -{"code": " Status FillCollectiveParams(CollectiveParams* col_params,\n CollectiveType collective_type,\n const Tensor& group_size, const Tensor& group_key,\n const Tensor& instance_key) {\n if (group_size.dims() > 0) {\n return errors::InvalidArgument(\n \"Unexpected dimensions on input group_size, got \",\n group_size.shape().DebugString());\n }\n if (group_key.dims() > 0) {\n return errors::InvalidArgument(\n \"Unexpected dimensions on input group_key, got \",\n group_key.shape().DebugString());\n }\n if (instance_key.dims() > 0) {\n return errors::InvalidArgument(\n \"Unexpected dimensions on input instance_key, got \",\n instance_key.shape().DebugString());\n }\n col_params->name = name_;\n col_params->group.device_type = device_type_;\n col_params->group.group_size = group_size.unaligned_flat()(0);\n if (col_params->group.group_size <= 0) {\n return errors::InvalidArgument(\n \"group_size must be positive integer but got \",\n col_params->group.group_size);\n }\n col_params->group.group_key = group_key.unaligned_flat()(0);\n col_params->instance.type = collective_type;\n col_params->instance.instance_key = instance_key.unaligned_flat()(0);\n col_params->instance.data_type = data_type_;\n col_params->instance.impl_details.communication_hint = communication_hint_;\n col_params->instance.impl_details.timeout_seconds = timeout_seconds_;\n return Status::OK();\n }", "label": 1, "label_name": "safe"} -{"code": " public static Adjustment Get(string uuid)\n {\n var adjustment = new Adjustment();\n Client.Instance.PerformRequest(Client.HttpRequestMethod.Get,\n \"/adjustments/\" + Uri.EscapeUriString(uuid),\n adjustment.ReadXml);\n return adjustment;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "function(k){this.actions.get(\"shapes\").funct();mxEvent.consume(k)}));c.appendChild(e);return c};EditorUi.prototype.handleError=function(c,e,g,k,m,p,v){var x=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},z=null!=c&&null!=c.error?c.error:c;if(null!=c&&(\"1\"==urlParams.test||null!=c.stack)&&null!=c.message)try{v?null!=window.console&&console.error(\"EditorUi.handleError:\",c):EditorUi.logError(\"Caught: \"+(\"\"==c.message&&null!=c.name)?c.name:c.message,c.filename,c.lineNumber,\nc.columnNumber,c,\"INFO\")}catch(q){}if(null!=z||null!=e){v=mxUtils.htmlEntities(mxResources.get(\"unknownError\"));var y=mxResources.get(\"ok\"),L=null;e=null!=e?e:mxResources.get(\"error\");if(null!=z){null!=z.retry&&(y=mxResources.get(\"cancel\"),L=function(){x();z.retry()});if(404==z.code||404==z.status||403==z.code){v=403==z.code?null!=z.message?mxUtils.htmlEntities(z.message):mxUtils.htmlEntities(mxResources.get(\"accessDenied\")):null!=m?m:mxUtils.htmlEntities(mxResources.get(\"fileNotFoundOrDenied\")+(null!=\nthis.drive&&null!=this.drive.user?\" (\"+this.drive.user.displayName+\", \"+this.drive.user.email+\")\":\"\"));var N=null!=m?null:null!=p?p:window.location.hash;if(null!=N&&(\"#G\"==N.substring(0,2)||\"#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D\"==N.substring(0,45))&&(null!=c&&null!=c.error&&(null!=c.error.errors&&0\");H.setAttribute(\"disabled\",\"disabled\");G.appendChild(H)}H=document.createElement(\"option\");mxUtils.write(H,mxResources.get(\"addAccount\"));H.value=C.length;G.appendChild(H)}var C=this.drive.getUsersList(),A=document.createElement(\"div\"),B=document.createElement(\"span\");B.style.marginTop=\"6px\";mxUtils.write(B,mxResources.get(\"changeUser\")+\": \");A.appendChild(B);var G=document.createElement(\"select\");G.style.width=\"200px\";q();mxEvent.addListener(G,\"change\",mxUtils.bind(this,\nfunction(){var M=G.value,H=C.length!=M;H&&this.drive.setUser(C[M]);this.drive.authorize(H,mxUtils.bind(this,function(){H||(C=this.drive.getUsersList(),q())}),mxUtils.bind(this,function(F){this.handleError(F)}),!0)}));A.appendChild(G);A=new CustomDialog(this,A,mxUtils.bind(this,function(){this.loadFile(window.location.hash.substr(1),!0)}));this.showDialog(A.container,300,100,!0,!0)}),mxResources.get(\"cancel\"),mxUtils.bind(this,function(){this.hideDialog();null!=g&&g()}),480,150);return}}null!=z.message?\nv=\"\"==z.message&&null!=z.name?mxUtils.htmlEntities(z.name):mxUtils.htmlEntities(z.message):null!=z.response&&null!=z.response.error?v=mxUtils.htmlEntities(z.response.error):\"undefined\"!==typeof window.App&&(z.code==App.ERROR_TIMEOUT?v=mxUtils.htmlEntities(mxResources.get(\"timeout\")):z.code==App.ERROR_BUSY?v=mxUtils.htmlEntities(mxResources.get(\"busy\")):\"string\"===typeof z&&0faqRecord['id']) && ($this->faqRecord['id'] == $id)) {\n return $this->faqRecord['title'];\n }\n\n $question = '';\n\n $query = sprintf(\n \"SELECT\n thema AS question\n FROM\n %sfaqdata\n WHERE\n id = %d AND lang = '%s'\",\n PMF_Db::getTablePrefix(),\n $id,\n $this->_config->getLanguage()->getLanguage()\n );\n $result = $this->_config->getDb()->query($query);\n\n if ($this->_config->getDb()->numRows($result) > 0) {\n while ($row = $this->_config->getDb()->fetchObject($result)) {\n $question = PMF_String::htmlspecialchars($row->question);\n }\n } else {\n $question = $this->pmf_lang['no_cats'];\n }\n\n return $question;\n }", "label": 1, "label_name": "safe"} -{"code": "m=P.name;v=\"\";O(null,!0)})));k.appendChild(F)})(D[G],G)}100==D.length&&(k.appendChild(A),B=function(){k.scrollTop>=k.scrollHeight-k.offsetHeight&&C()},mxEvent.addListener(k,\"scroll\",B))}),y)});t()};GitHubClient.prototype.logout=function(){this.clearPersistentToken();this.setUser(null);b=null}})();TrelloFile=function(b,e,f){DrawioFile.call(this,b,e);this.meta=f;this.saveNeededCounter=0};mxUtils.extend(TrelloFile,DrawioFile);TrelloFile.prototype.getHash=function(){return\"T\"+encodeURIComponent(this.meta.compoundId)};TrelloFile.prototype.getMode=function(){return App.MODE_TRELLO};TrelloFile.prototype.isAutosave=function(){return!0};TrelloFile.prototype.getTitle=function(){return this.meta.name};TrelloFile.prototype.isRenamable=function(){return!1};TrelloFile.prototype.getSize=function(){return this.meta.bytes};", "label": 0, "label_name": "vulnerable"} -{"code": " public function onKernelRequest(GetResponseEvent $event)\n {\n if (!$event->isMasterRequest()) {\n return;\n }\n\n $request = $event->getRequest();\n $session = $this->getSession();\n if (null === $session || $request->hasSession()) {\n return;\n }\n\n $request->setSession($session);\n }", "label": 0, "label_name": "vulnerable"} -{"code": " function edit_externalalias() {\n $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);\n if ($section->parent == -1) {\n notfoundController::handle_not_found();\n exit;\n } // doesn't work for standalone pages\n if (empty($section->id)) {\n $section->public = 1;\n if (!isset($section->parent)) {\n // This is another precaution. The parent attribute\n // should ALWAYS be set by the caller.\n //FJD - if that's the case, then we should die.\n notfoundController::handle_not_authorized();\n exit;\n //$section->parent = 0;\n }\n }\n assign_to_template(array(\n 'section' => $section,\n 'glyphs' => self::get_glyphs(),\n ));\n }", "label": 1, "label_name": "safe"} -{"code": "Ta3Parser_ParseStringObject(const char *s, PyObject *filename,\n grammar *g, int start,\n perrdetail *err_ret, int *flags)\n{\n struct tok_state *tok;\n int exec_input = start == file_input;\n\n if (initerr(err_ret, filename) < 0)\n return NULL;\n\n if (*flags & PyPARSE_IGNORE_COOKIE)\n tok = Ta3Tokenizer_FromUTF8(s, exec_input);\n else\n tok = Ta3Tokenizer_FromString(s, exec_input);\n if (tok == NULL) {\n err_ret->error = PyErr_Occurred() ? E_DECODE : E_NOMEM;\n return NULL;\n }\n\n#ifndef PGEN\n Py_INCREF(err_ret->filename);\n tok->filename = err_ret->filename;\n#endif\n if (*flags & PyPARSE_ASYNC_ALWAYS)\n tok->async_always = 1;\n return parsetok(tok, g, start, err_ret, flags);\n}", "label": 1, "label_name": "safe"} -{"code": " public function __construct(BarClass $bar)\n {\n $this->bar = $bar;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function testGetDropdownConnect($params, $expected, $session_params = []) {\n $this->login();\n\n $bkp_params = [];\n //set session params if any\n if (count($session_params)) {\n foreach ($session_params as $param => $value) {\n if (isset($_SESSION[$param])) {\n $bkp_params[$param] = $_SESSION[$param];\n }\n $_SESSION[$param] = $value;\n }\n }\n\n $params['_idor_token'] = $this->generateIdor($params);\n\n $result = \\Dropdown::getDropdownConnect($params, false);\n\n //reset session params before executing test\n if (count($session_params)) {\n foreach ($session_params as $param => $value) {\n if (isset($bkp_params[$param])) {\n $_SESSION[$param] = $bkp_params[$param];\n } else {\n unset($_SESSION[$param]);\n }\n }\n }\n\n $this->array($result)->isIdenticalTo($expected);\n }", "label": 1, "label_name": "safe"} -{"code": "func (mr *MockAccessTokenStrategyMockRecorder) GenerateAccessToken(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GenerateAccessToken\", reflect.TypeOf((*MockAccessTokenStrategy)(nil).GenerateAccessToken), arg0, arg1)\n}", "label": 1, "label_name": "safe"} -{"code": " public IESCipher(IESEngine engine, int ivLength)\n {\n this.engine = engine;\n this.ivLength = ivLength;\n }", "label": 1, "label_name": "safe"} -{"code": "0;N>>8;return u};Editor.crc32=function(u){for(var E=-1,J=0;J>>8^Editor.crcTable[(E^u.charCodeAt(J))&255];return(E^-1)>>>0};Editor.writeGraphModelToPng=function(u,E,J,T,N){function Q(Z,fa){var aa=ba;ba+=fa;return Z.substring(aa,ba)}function R(Z){Z=Q(Z,4);return Z.charCodeAt(3)+(Z.charCodeAt(2)<<8)+(Z.charCodeAt(1)<<16)+(Z.charCodeAt(0)<<24)}function Y(Z){return String.fromCharCode(Z>>24&255,Z>>16&255,Z>>8&255,Z&255)}u=u.substring(u.indexOf(\",\")+", "label": 0, "label_name": "vulnerable"} -{"code": "function top_panel($user, $TAB)\n{\n global $panel;\n $command = HESTIA_CMD . 'v-list-user ' . escapeshellarg($user) . \" 'json'\";\n exec($command, $output, $return_var);\n if ($return_var > 0) {\n echo 'ERROR: Unable to retrieve account details.
Please log in again.
';\n destroy_sessions();\n header('Location: /login/');\n exit;\n }\n $panel = json_decode(implode('', $output), true);\n unset($output);\n\n // Log out active sessions for suspended users\n if (($panel[$user]['SUSPENDED'] === 'yes') && ($_SESSION['POLICY_USER_VIEW_SUSPENDED'] !== 'yes')) {\n if(empty($_SESSION['look'])){\n $_SESSION['error_msg'] = 'You have been logged out. Please log in again.';\n destroy_sessions();\n header('Location: /login/');\n }\n }\n\n // Reset user permissions if changed while logged in\n if (($panel[$user]['ROLE']) !== ($_SESSION['userContext']) && (!isset($_SESSION['look']))) {\n unset($_SESSION['userContext']);\n $_SESSION['userContext'] = $panel[$user]['ROLE'];\n }\n\n // Load user's selected theme and do not change it when impersonting user\n if ((isset($panel[$user]['THEME'])) && (!isset($_SESSION['look']))) {\n $_SESSION['userTheme'] = $panel[$user]['THEME'];\n }\n\n // Unset userTheme override variable if POLICY_USER_CHANGE_THEME is set to no\n if ($_SESSION['POLICY_USER_CHANGE_THEME'] === 'no') {\n unset($_SESSION['userTheme']);\n }\n\n // Set preferred sort order\n if (!isset($_SESSION['look'])) {\n $_SESSION['userSortOrder'] = $panel[$user]['PREF_UI_SORT'];\n }\n\n // Set home location URLs\n if (($_SESSION['userContext'] === 'admin') && (!isset($_SESSION['look']))) {\n // Display users list for administrators unless they are impersonating a user account\n $home_url = '/list/user/';\n } else {\n // Set home location URL based on available package features from account\n if ($panel[$user]['WEB_DOMAINS'] != '0') {\n $home_url = '/list/web/';\n } elseif ($panel[$user]['DNS_DOMAINS'] != '0') {\n $home_url = '/list/dns/';\n } elseif ($panel[$user]['MAIL_DOMAINS'] != '0') {\n $home_url = '/list/mail/';\n } elseif ($panel[$user]['DATABASES'] != '0') {\n $home_url = '/list/db/';\n } elseif ($panel[$user]['CRON_JOBS'] != '0') {\n $home_url = '/list/cron/';\n } elseif ($panel[$user]['BACKUPS'] != '0') {\n $home_url = '/list/backups/';\n }\n }\n\n include(dirname(__FILE__) . '/../templates/includes/panel.html');\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function test_nntp_regular()\n {\n $this->assertValidation(\n 'nntp://news.example.com/alt.misc/42#frag'\n );\n }", "label": 1, "label_name": "safe"} -{"code": "error_t httpParseParam(const char_t **pos, HttpParam *param)\n{\n error_t error;\n size_t i;\n uint8_t c;\n bool_t escapeFlag;\n bool_t separatorFound;\n const char_t *p;\n\n //Check parameters\n if(pos == NULL || param == NULL)\n return ERROR_INVALID_PARAMETER;\n\n //Initialize structure\n param->name = NULL;\n param->nameLen = 0;\n param->value = NULL;\n param->valueLen = 0;\n\n //Initialize variables\n escapeFlag = FALSE;\n separatorFound = FALSE;\n\n //Initialize status code\n error = ERROR_IN_PROGRESS;\n\n //Point to the first character\n i = 0;\n p = *pos;\n\n //Loop through the list of parameters\n while(error == ERROR_IN_PROGRESS)\n {\n //Get current character\n c = (uint8_t) p[i];\n\n //Check current state\n if(param->name == NULL)\n {\n //Check current character\n if(c == '\\0')\n {\n //The list of parameters is empty\n error = ERROR_NOT_FOUND;\n }\n else if(c == ' ' || c == '\\t' || c == ',' || c == ';')\n {\n //Discard whitespace and separator characters\n }\n else if(isalnum(c) || osStrchr(\"!#$%&'*+-.^_`|~\", c) || c >= 128)\n {\n //Point to the first character of the parameter name\n param->name = p + i;\n }\n else\n {\n //Invalid character\n error = ERROR_INVALID_SYNTAX;\n }\n }\n else if(param->nameLen == 0)\n {\n //Check current character\n if(c == '\\0' || c == ',' || c == ';')\n {\n //Save the length of the parameter name\n param->nameLen = p + i - param->name;\n //Successful processing\n error = NO_ERROR;\n }\n else if(c == ' ' || c == '\\t')\n {\n //Save the length of the parameter name\n param->nameLen = p + i - param->name;\n }\n else if(c == '=')\n {\n //The key/value separator has been found\n separatorFound = TRUE;\n //Save the length of the parameter name\n param->nameLen = p + i - param->name;\n }\n else if(isalnum(c) || osStrchr(\"!#$%&'*+-.^_`|~\", c) || c >= 128)\n {\n //Advance data pointer\n }\n else\n {\n //Invalid character\n error = ERROR_INVALID_SYNTAX;\n }\n }\n else if(!separatorFound)\n {\n //Check current character\n if(c == '\\0' || c == ',' || c == ';')\n {\n //Successful processing\n error = NO_ERROR;\n }\n else if(c == ' ' || c == '\\t')\n {\n //Discard whitespace characters\n }\n else if(c == '=')\n {\n //The key/value separator has been found\n separatorFound = TRUE;\n }\n else if(c == '\\\"')\n {\n //Point to the first character that follows the parameter name\n i = param->name + param->nameLen - p;\n //Successful processing\n error = NO_ERROR;\n }\n else if(isalnum(c) || osStrchr(\"!#$%&'*+-.^_`|~\", c) || c >= 128)\n {\n //Point to the first character that follows the parameter name\n i = param->name + param->nameLen - p;\n //Successful processing\n error = NO_ERROR;\n }\n else\n {\n //Invalid character\n error = ERROR_INVALID_SYNTAX;\n }\n }\n else if(param->value == NULL)\n {\n //Check current character\n if(c == '\\0' || c == ',' || c == ';')\n {\n //Successful processing\n error = NO_ERROR;\n }\n else if(c == ' ' || c == '\\t')\n {\n //Discard whitespace characters\n }\n else if(c == '\\\"')\n {\n //A string of text is parsed as a single word if it is quoted\n //using double-quote marks (refer to RFC 7230, section 3.2.6)\n param->value = p + i;\n }\n else if(isalnum(c) || osStrchr(\"!#$%&'*+-.^_`|~\", c) || c >= 128)\n {\n //Point to the first character of the parameter value\n param->value = p + i;\n }\n else\n {\n //Invalid character\n error = ERROR_INVALID_SYNTAX;\n }\n }\n else\n {\n //Quoted string?\n if(param->value[0] == '\\\"')\n {\n //Check current character\n if(c == '\\0')\n {\n //The second double quote is missing\n error = ERROR_INVALID_SYNTAX;\n }\n else if(escapeFlag)\n {\n //Recipients that process the value of a quoted-string must\n //handle a quoted-pair as if it were replaced by the octet\n //following the backslash\n escapeFlag = FALSE;\n }\n else if(c == '\\\\')\n {\n //The backslash octet can be used as a single-octet quoting\n //mechanism within quoted-string and comment constructs\n escapeFlag = TRUE;\n }\n else if(c == '\\\"')\n {\n //Advance pointer over the double quote\n i++;\n //Save the length of the parameter value\n param->valueLen = p + i - param->value;\n //Successful processing\n error = NO_ERROR;\n }\n else if(isprint(c) || c == '\\t' || c >= 128)\n {\n //Advance data pointer\n }\n else\n {\n //Invalid character\n error = ERROR_INVALID_SYNTAX;\n }\n }\n else\n {\n //Check current character\n if(c == '\\0' || c == ' ' || c == '\\t' || c == ',' || c == ';')\n {\n //Save the length of the parameter value\n param->valueLen = p + i - param->value;\n //Successful processing\n error = NO_ERROR;\n }\n else if(isalnum(c) || osStrchr(\"!#$%&'*+-.^_`|~\", c) || c >= 128)\n {\n //Advance data pointer\n }\n else\n {\n //Invalid character\n error = ERROR_INVALID_SYNTAX;\n }\n }\n }\n\n //Point to the next character of the string\n if(error == ERROR_IN_PROGRESS)\n i++;\n }\n\n //Check whether the parameter value is a quoted string\n if(param->valueLen >= 2 && param->value[0] == '\\\"')\n {\n //Discard the surrounding quotes\n param->value++;\n param->valueLen -= 2;\n }\n\n //Actual position if the list of parameters\n *pos = p + i;\n\n //Return status code\n return error;\n}", "label": 1, "label_name": "safe"} -{"code": "mxDualRuler.prototype.setUnit=function(b){this.vRuler.setUnit(b);this.hRuler.setUnit(b)};mxDualRuler.prototype.setStyle=function(b){this.vRuler.setStyle(b);this.hRuler.setStyle(b)};mxDualRuler.prototype.destroy=function(){this.vRuler.destroy();this.hRuler.destroy();this.ui.refresh=this.editorUiRefresh;mxGuide.prototype.move=this.origGuideMove;mxGuide.prototype.destroy=this.origGuideDestroy;this.ui.getDiagramContainerOffset=this.editorUiGetDiagContOffset};function mxFreehand(b){var e=null!=b.view&&null!=b.view.canvas?b.view.canvas.ownerSVGElement:null;if(null!=b.container&&null!=e){b.addListener(mxEvent.ESCAPE,mxUtils.bind(this,function(){this.stopDrawing()}));var f=mxFreehand.prototype.NORMAL_SMOOTHING,c=null,m=[],n,v=[],d,g=!1,k=!0,l=!0,p=!0,q=!0,x=[],y=!1,A=!0,B=!1,I={size:12,thinning:.5,smoothing:.5,streamline:.5,start:{taper:0,cap:!0},end:{taper:0,cap:!0}},O=!1;this.setClosedPath=function(K){g=K};this.setAutoClose=function(K){k=K};this.setAutoInsert=", "label": 0, "label_name": "vulnerable"} -{"code": "\t\t\t\t\t\t\t\t .draggable('option', 'cursorAt', {left: 50 - parseInt($(e.currentTarget).css('margin-left')), top: 47});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.on('dragstart', function(e) {\n\t\t\t\t\t\t\tvar dt = e.dataTransfer || e.originalEvent.dataTransfer || null;\n\t\t\t\t\t\t\thelper = null;\n\t\t\t\t\t\t\tif (dt && !fm.UA.IE) {\n\t\t\t\t\t\t\t\tvar p = this.id ? $(this) : $(this).parents('[id]:first'),\n\t\t\t\t\t\t\t\t\telm = $(''),\n\t\t\t\t\t\t\t\t\turl = '',\n\t\t\t\t\t\t\t\t\tdurl = null,\n\t\t\t\t\t\t\t\t\tmurl = null,\n\t\t\t\t\t\t\t\t\tfiles = [],\n\t\t\t\t\t\t\t\t\ticon = function(f) {\n\t\t\t\t\t\t\t\t\t\tvar mime = f.mime, i, tmb = fm.tmb(f);\n\t\t\t\t\t\t\t\t\t\ti = '
';\n\t\t\t\t\t\t\t\t\t\tif (tmb) {\n\t\t\t\t\t\t\t\t\t\t\ti = $(i).addClass(tmb.className).css('background-image', \"url('\"+tmb.url+\"')\").get(0).outerHTML;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn i;\n\t\t\t\t\t\t\t\t\t}, l, geturl = [];\n\t\t\t\t\t\t\t\tp.trigger(evtSelect);\n\t\t\t\t\t\t\t\ttrigger();\n\t\t\t\t\t\t\t\t$.each(selectedFiles, function(i, v) {\n\t\t\t\t\t\t\t\t\tvar file = fm.file(v),\n\t\t\t\t\t\t\t\t\t\tfurl = file.url;\n\t\t\t\t\t\t\t\t\tif (file && file.mime !== 'directory') {\n\t\t\t\t\t\t\t\t\t\tif (!furl) {\n\t\t\t\t\t\t\t\t\t\t\tfurl = fm.url(file.hash);\n\t\t\t\t\t\t\t\t\t\t} else if (furl == '1') {\n\t\t\t\t\t\t\t\t\t\t\tgeturl.push(v);\n\t\t\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (furl) {\n\t\t\t\t\t\t\t\t\t\t\tfurl = fm.convAbsUrl(furl);\n\t\t\t\t\t\t\t\t\t\t\tfiles.push(v);\n\t\t\t\t\t\t\t\t\t\t\t$('').attr('href', furl).text(furl).appendTo(elm);\n\t\t\t\t\t\t\t\t\t\t\turl += furl + \"\\n\";\n\t\t\t\t\t\t\t\t\t\t\tif (!durl) {\n\t\t\t\t\t\t\t\t\t\t\t\tdurl = file.mime + ':' + file.name + ':' + furl;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tif (!murl) {\n\t\t\t\t\t\t\t\t\t\t\t\tmurl = furl + \"\\n\" + file.name;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (geturl.length) {\n\t\t\t\t\t\t\t\t\t$.each(geturl, function(i, v) {\n\t\t\t\t\t\t\t\t\t\tvar rfile = fm.file(v);\n\t\t\t\t\t\t\t\t\t\trfile.url = '';\n\t\t\t\t\t\t\t\t\t\tfm.request({\n\t\t\t\t\t\t\t\t\t\t\tdata : {cmd : 'url', target : v},\n\t\t\t\t\t\t\t\t\t\t\tnotify : {type : 'url', cnt : 1},\n\t\t\t\t\t\t\t\t\t\t\tpreventDefault : true\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\t.always(function(data) {\n\t\t\t\t\t\t\t\t\t\t\trfile.url = data.url? data.url : '1';\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t} else if (url) {\n\t\t\t\t\t\t\t\t\tif (dt.setDragImage) {\n\t\t\t\t\t\t\t\t\t\thelper = $('
').append(icon(fm.file(files[0]))).appendTo($(document.body));\n\t\t\t\t\t\t\t\t\t\tif ((l = files.length) > 1) {\n\t\t\t\t\t\t\t\t\t\t\thelper.append(icon(fm.file(files[l-1])) + ''+l+'');\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdt.setDragImage(helper.get(0), 50, 47);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdt.effectAllowed = 'copyLink';\n\t\t\t\t\t\t\t\t\tdt.setData('DownloadURL', durl);\n\t\t\t\t\t\t\t\t\tdt.setData('text/x-moz-url', murl);\n\t\t\t\t\t\t\t\t\tdt.setData('text/uri-list', url);\n\t\t\t\t\t\t\t\t\tdt.setData('text/plain', url);\n\t\t\t\t\t\t\t\t\tdt.setData('text/html', elm.html());\n\t\t\t\t\t\t\t\t\tdt.setData('elfinderfrom', window.location.href + fm.cwd().hash);\n\t\t\t\t\t\t\t\t\tdt.setData('elfinderfrom:' + dt.getData('elfinderfrom'), '');\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.on('dragend', function(e) {\n\t\t\t\t\t\t\tunselectAll();\n\t\t\t\t\t\t\thelper && helper.remove();\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.draggable(fm.draggable);\n\t\t\t\t\t}", "label": 1, "label_name": "safe"} -{"code": " void validSave() throws Exception\n {\n when(mockClonedDocument.getRCSVersion()).thenReturn(new Version(\"1.2\"));\n when(mockClonedDocument.getComment()).thenReturn(\"My Changes\");\n when(mockClonedDocument.getLock(this.context)).thenReturn(mock(XWikiLock.class));\n when(mockForm.getTemplate()).thenReturn(\"\");\n assertFalse(saveAction.save(this.context));\n assertEquals(new Version(\"1.2\"), this.context.get(\"SaveAction.savedObjectVersion\"));\n\n verify(mockClonedDocument).readFromTemplate(\"\", this.context);\n verify(mockClonedDocument).setAuthor(\"XWiki.FooBar\");\n verify(mockClonedDocument).setMetaDataDirty(true);\n verify(this.xWiki).checkSavingDocument(USER_REFERENCE, mockClonedDocument, \"My Changes\", false, this.context);\n verify(this.xWiki).saveDocument(mockClonedDocument, \"My Changes\", false, this.context);\n verify(mockClonedDocument).removeLock(this.context);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "jpc_ms_t *jpc_getms(jas_stream_t *in, jpc_cstate_t *cstate)\n{\n\tjpc_ms_t *ms;\n\tjpc_mstabent_t *mstabent;\n\tjas_stream_t *tmpstream;\n\n\tif (!(ms = jpc_ms_create(0))) {\n\t\treturn 0;\n\t}\n\n\t/* Get the marker type. */\n\tif (jpc_getuint16(in, &ms->id) || ms->id < JPC_MS_MIN ||\n\t ms->id > JPC_MS_MAX) {\n\t\tjpc_ms_destroy(ms);\n\t\treturn 0;\n\t}\n\n\tmstabent = jpc_mstab_lookup(ms->id);\n\tms->ops = &mstabent->ops;\n\n\t/* Get the marker segment length and parameters if present. */\n\t/* Note: It is tacitly assumed that a marker segment cannot have\n\t parameters unless it has a length field. That is, there cannot\n\t be a parameters field without a length field and vice versa. */\n\tif (JPC_MS_HASPARMS(ms->id)) {\n\t\t/* Get the length of the marker segment. */\n\t\tif (jpc_getuint16(in, &ms->len) || ms->len < 3) {\n\t\t\tjpc_ms_destroy(ms);\n\t\t\treturn 0;\n\t\t}\n\t\t/* Calculate the length of the marker segment parameters. */\n\t\tms->len -= 2;\n\t\t/* Create and prepare a temporary memory stream from which to\n\t\t read the marker segment parameters. */\n\t\t/* Note: This approach provides a simple way of ensuring that\n\t\t we never read beyond the end of the marker segment (even if\n\t\t the marker segment length is errantly set too small). */\n\t\tif (!(tmpstream = jas_stream_memopen(0, 0))) {\n\t\t\tjpc_ms_destroy(ms);\n\t\t\treturn 0;\n\t\t}\n\t\tif (jas_stream_copy(tmpstream, in, ms->len) ||\n\t\t jas_stream_seek(tmpstream, 0, SEEK_SET) < 0) {\n\t\t\tjas_stream_close(tmpstream);\n\t\t\tjpc_ms_destroy(ms);\n\t\t\treturn 0;\n\t\t}\n\t\t/* Get the marker segment parameters. */\n\t\tif ((*ms->ops->getparms)(ms, cstate, tmpstream)) {\n\t\t\tms->ops = 0;\n\t\t\tjpc_ms_destroy(ms);\n\t\t\tjas_stream_close(tmpstream);\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (jas_getdbglevel() > 0) {\n\t\t\tjpc_ms_dump(ms, stderr);\n\t\t}\n\n\t\tif (JAS_CAST(ulong, jas_stream_tell(tmpstream)) != ms->len) {\n\t\t\tjas_eprintf(\n\t\t\t \"warning: trailing garbage in marker segment (%ld bytes)\\n\",\n\t\t\t ms->len - jas_stream_tell(tmpstream));\n\t\t}\n\n\t\t/* Close the temporary stream. */\n\t\tjas_stream_close(tmpstream);\n\n\t} else {\n\t\t/* There are no marker segment parameters. */\n\t\tms->len = 0;\n\n\t\tif (jas_getdbglevel() > 0) {\n\t\t\tjpc_ms_dump(ms, stderr);\n\t\t}\n\t}\n\n\t/* Update the code stream state information based on the type of\n\t marker segment read. */\n\t/* Note: This is a bit of a hack, but I'm not going to define another\n\t type of virtual function for this one special case. */\n\tif (ms->id == JPC_MS_SIZ) {\n\t\tcstate->numcomps = ms->parms.siz.numcomps;\n\t}\n\n\treturn ms;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "enum ImapAuthRes imap_auth_cram_md5(struct ImapData *idata, const char *method)\n{\n char ibuf[LONG_STRING * 2], obuf[LONG_STRING];\n unsigned char hmac_response[MD5_DIGEST_LEN];\n int len;\n int rc;\n\n if (!mutt_bit_isset(idata->capabilities, ACRAM_MD5))\n return IMAP_AUTH_UNAVAIL;\n\n mutt_message(_(\"Authenticating (CRAM-MD5)...\"));\n\n /* get auth info */\n if (mutt_account_getlogin(&idata->conn->account) < 0)\n return IMAP_AUTH_FAILURE;\n if (mutt_account_getpass(&idata->conn->account) < 0)\n return IMAP_AUTH_FAILURE;\n\n imap_cmd_start(idata, \"AUTHENTICATE CRAM-MD5\");\n\n /* From RFC2195:\n * The data encoded in the first ready response contains a presumptively\n * arbitrary string of random digits, a timestamp, and the fully-qualified\n * primary host name of the server. The syntax of the unencoded form must\n * correspond to that of an RFC822 'msg-id' [RFC822] as described in [POP3].\n */\n do\n rc = imap_cmd_step(idata);\n while (rc == IMAP_CMD_CONTINUE);\n\n if (rc != IMAP_CMD_RESPOND)\n {\n mutt_debug(1, \"Invalid response from server: %s\\n\", ibuf);\n goto bail;\n }\n\n len = mutt_b64_decode(obuf, idata->buf + 2);\n if (len == -1)\n {\n mutt_debug(1, \"Error decoding base64 response.\\n\");\n goto bail;\n }\n\n obuf[len] = '\\0';\n mutt_debug(2, \"CRAM challenge: %s\\n\", obuf);\n\n /* The client makes note of the data and then responds with a string\n * consisting of the user name, a space, and a 'digest'. The latter is\n * computed by applying the keyed MD5 algorithm from [KEYED-MD5] where the\n * key is a shared secret and the digested text is the timestamp (including\n * angle-brackets).\n *\n * Note: The user name shouldn't be quoted. Since the digest can't contain\n * spaces, there is no ambiguity. Some servers get this wrong, we'll work\n * around them when the bug report comes in. Until then, we'll remain\n * blissfully RFC-compliant.\n */\n hmac_md5(idata->conn->account.pass, obuf, hmac_response);\n /* dubious optimisation I saw elsewhere: make the whole string in one call */\n int off = snprintf(obuf, sizeof(obuf), \"%s \", idata->conn->account.user);\n mutt_md5_toascii(hmac_response, obuf + off);\n mutt_debug(2, \"CRAM response: %s\\n\", obuf);\n\n /* ibuf must be long enough to store the base64 encoding of obuf,\n * plus the additional debris */\n mutt_b64_encode(ibuf, obuf, strlen(obuf), sizeof(ibuf) - 2);\n mutt_str_strcat(ibuf, sizeof(ibuf), \"\\r\\n\");\n mutt_socket_send(idata->conn, ibuf);\n\n do\n rc = imap_cmd_step(idata);\n while (rc == IMAP_CMD_CONTINUE);\n\n if (rc != IMAP_CMD_OK)\n {\n mutt_debug(1, \"Error receiving server response.\\n\");\n goto bail;\n }\n\n if (imap_code(idata->buf))\n return IMAP_AUTH_SUCCESS;\n\nbail:\n mutt_error(_(\"CRAM-MD5 authentication failed.\"));\n return IMAP_AUTH_FAILURE;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " forwardIn(bindAddr, bindPort, cb) {\n if (!this._sock || !this._sock.writable)\n throw new Error('Not connected');\n\n // Send a request for the server to start forwarding TCP connections to us\n // on a particular address and port\n\n const wantReply = (typeof cb === 'function');\n\n if (wantReply) {\n this._callbacks.push((had_err, data) => {\n if (had_err) {\n cb(had_err !== true\n ? had_err\n : new Error(`Unable to bind to ${bindAddr}:${bindPort}`));\n return;\n }\n\n let realPort = bindPort;\n if (bindPort === 0 && data && data.length >= 4) {\n realPort = readUInt32BE(data, 0);\n if (!(this._protocol._compatFlags & COMPAT.DYN_RPORT_BUG))\n bindPort = realPort;\n }\n\n this._forwarding[`${bindAddr}:${bindPort}`] = realPort;\n\n cb(undefined, realPort);\n });\n }\n\n this._protocol.tcpipForward(bindAddr, bindPort, wantReply);\n\n return this;\n }", "label": 1, "label_name": "safe"} -{"code": " public function setup()\n {\n $this->parser = new HTMLPurifier_StringHashParser();\n }", "label": 1, "label_name": "safe"} -{"code": "\tprepend: function() {\n\t\treturn this.domManip(arguments, true, function(elem){\n\t\t\tif (this.nodeType == 1)\n\t\t\t\tthis.insertBefore( elem, this.firstChild );\n\t\t});\n\t},", "label": 0, "label_name": "vulnerable"} -{"code": " async function doIt() {\n await test.server.serverCertificateManager.trustCertificate(certificate);\n const issuerCertificateFile = m(\"CA/public/cacert.pem\");\n const issuerCertificateRevocationListFile = m(\"CA/crl/revocation_list.der\");\n const issuerCertificate = readCertificate(issuerCertificateFile);\n const issuerCrl = await readCertificateRevocationList(issuerCertificateRevocationListFile);\n await test.server.serverCertificateManager.addIssuer(issuerCertificate);\n await test.server.serverCertificateManager.addRevocationList(issuerCrl);\n callback();\n }", "label": 0, "label_name": "vulnerable"} -{"code": "void PngImg::InitStorage_() {\n rowPtrs_.resize(info_.height, nullptr);\n data_ = new png_byte[info_.height * info_.rowbytes];\n\n for(size_t i = 0; i < info_.height; ++i) {\n rowPtrs_[i] = data_ + i * info_.rowbytes;\n }\n}", "label": 0, "label_name": "vulnerable"} -{"code": "func (e *Environment) resources() container.Resources {\n\tl := e.Configuration.Limits()\n\tpids := l.ProcessLimit()\n\n\treturn container.Resources{\n\t\tMemory: l.BoundedMemoryLimit(),\n\t\tMemoryReservation: l.MemoryLimit * 1_000_000,\n\t\tMemorySwap: l.ConvertedSwap(),\n\t\tCPUQuota: l.ConvertedCpuLimit(),\n\t\tCPUPeriod: 100_000,\n\t\tCPUShares: 1024,\n\t\tBlkioWeight: l.IoWeight,\n\t\tOomKillDisable: &l.OOMDisabled,\n\t\tCpusetCpus: l.Threads,\n\t\tPidsLimit: &pids,\n\t}\n}", "label": 1, "label_name": "safe"} -{"code": "process_demand_active(STREAM s)\n{\n\tuint8 type;\n\tuint16 len_src_descriptor, len_combined_caps;\n\tstruct stream packet = *s;\n\n\t/* at this point we need to ensure that we have ui created */\n\trd_create_ui();\n\n\tin_uint32_le(s, g_rdp_shareid);\n\tin_uint16_le(s, len_src_descriptor);\n\tin_uint16_le(s, len_combined_caps);\n\n\tif (!s_check_rem(s, len_src_descriptor))\n\t{\n\t\trdp_protocol_error(\"rdp_demand_active(), consume of source descriptor from stream would overrun\", &packet);\n\t}\n\tin_uint8s(s, len_src_descriptor);\n\n\tlogger(Protocol, Debug, \"process_demand_active(), shareid=0x%x\", g_rdp_shareid);\n\n\trdp_process_server_caps(s, len_combined_caps);\n\n\trdp_send_confirm_active();\n\trdp_send_synchronise();\n\trdp_send_control(RDP_CTL_COOPERATE);\n\trdp_send_control(RDP_CTL_REQUEST_CONTROL);\n\trdp_recv(&type);\t/* RDP_PDU_SYNCHRONIZE */\n\trdp_recv(&type);\t/* RDP_CTL_COOPERATE */\n\trdp_recv(&type);\t/* RDP_CTL_GRANT_CONTROL */\n\trdp_send_input(0, RDP_INPUT_SYNCHRONIZE, 0,\n\t\t g_numlock_sync ? ui_get_numlock_state(read_keyboard_state()) : 0, 0);\n\n\tif (g_rdp_version >= RDP_V5)\n\t{\n\t\trdp_enum_bmpcache2();\n\t\trdp_send_fonts(3);\n\t}\n\telse\n\t{\n\t\trdp_send_fonts(1);\n\t\trdp_send_fonts(2);\n\t}\n\n\trdp_recv(&type);\t/* RDP_PDU_UNKNOWN 0x28 (Fonts?) */\n\treset_order_state();\n}", "label": 1, "label_name": "safe"} -{"code": "mxActor);Za.prototype.arrowWidth=.3;Za.prototype.arrowSize=.2;Za.prototype.redrawPath=function(c,l,x,p,v){var A=v*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,\"arrowWidth\",this.arrowWidth))));l=p*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,\"arrowSize\",this.arrowSize))));x=(v-A)/2;A=x+A;var B=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2;this.addPoints(c,[new mxPoint(0,x),new mxPoint(p-l,x),new mxPoint(p-l,0),new mxPoint(p,v/2),new mxPoint(p-\nl,v),new mxPoint(p-l,A),new mxPoint(0,A)],this.isRounded,B,!0);c.end()};mxCellRenderer.registerShape(\"singleArrow\",Za);mxUtils.extend(z,mxActor);z.prototype.redrawPath=function(c,l,x,p,v){var A=v*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,\"arrowWidth\",Za.prototype.arrowWidth))));l=p*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,\"arrowSize\",Za.prototype.arrowSize))));x=(v-A)/2;A=x+A;var B=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/", "label": 0, "label_name": "vulnerable"} -{"code": " protected function getDefaultParameters()\n {\n return array(\n 'baz_class' => 'BazClass',\n 'foo_class' => 'Bar\\\\FooClass',\n 'foo' => 'bar',\n );\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function testChameleonRemoveBlockInNodeInInline()\n {\n $this->assertResult(\n '
Not allowed!
',\n 'Not allowed!'\n );\n }", "label": 1, "label_name": "safe"} -{"code": " it { is_expected.to be_enabled }", "label": 0, "label_name": "vulnerable"} -{"code": "def check_against_blacklist(\n ip_address: IPAddress, ip_whitelist: Optional[IPSet], ip_blacklist: IPSet", "label": 1, "label_name": "safe"} -{"code": "archive_read_format_zip_cleanup(struct archive_read *a)\n{\n\tstruct zip *zip;\n\tstruct zip_entry *zip_entry, *next_zip_entry;\n\n\tzip = (struct zip *)(a->format->data);\n\n#ifdef HAVE_ZLIB_H\n\tif (zip->stream_valid)\n\t\tinflateEnd(&zip->stream);\n#endif\n\n#if HAVA_LZMA_H && HAVE_LIBLZMA\n if (zip->zipx_lzma_valid) {\n\t\tlzma_end(&zip->zipx_lzma_stream);\n\t}\n#endif\n\n#ifdef HAVE_BZLIB_H\n\tif (zip->bzstream_valid) {\n\t\tBZ2_bzDecompressEnd(&zip->bzstream);\n\t}\n#endif\n\n\tfree(zip->uncompressed_buffer);\n\n\tif (zip->ppmd8_valid)\n\t\t__archive_ppmd8_functions.Ppmd8_Free(&zip->ppmd8);\n\n\tif (zip->zip_entries) {\n\t\tzip_entry = zip->zip_entries;\n\t\twhile (zip_entry != NULL) {\n\t\t\tnext_zip_entry = zip_entry->next;\n\t\t\tarchive_string_free(&zip_entry->rsrcname);\n\t\t\tfree(zip_entry);\n\t\t\tzip_entry = next_zip_entry;\n\t\t}\n\t}\n\tfree(zip->decrypted_buffer);\n\tif (zip->cctx_valid)\n\t\tarchive_decrypto_aes_ctr_release(&zip->cctx);\n\tif (zip->hctx_valid)\n\t\tarchive_hmac_sha1_cleanup(&zip->hctx);\n\tfree(zip->iv);\n\tfree(zip->erd);\n\tfree(zip->v_data);\n\tarchive_string_free(&zip->format_name);\n\tfree(zip);\n\t(a->format->data) = NULL;\n\treturn (ARCHIVE_OK);\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function transform($attr, $config, $context)\n {\n if (!isset($attr['background'])) {\n return $attr;\n }\n\n $background = $this->confiscateAttr($attr, 'background');\n // some validation should happen here\n\n $this->prependCSS($attr, \"background-image:url($background);\");\n return $attr;\n }", "label": 1, "label_name": "safe"} -{"code": "RemoteFsDevice::Details RemoteDevicePropertiesWidget::details()\n{\n int t=type->itemData(type->currentIndex()).toInt();\n RemoteFsDevice::Details det;\n\n det.name=name->text().trimmed();\n switch (t) {\n case Type_SshFs: {\n det.url.setHost(sshHost->text().trimmed());\n det.url.setUserName(sshUser->text().trimmed());\n det.url.setPath(sshFolder->text().trimmed());\n det.url.setPort(sshPort->value());\n det.url.setScheme(RemoteFsDevice::constSshfsProtocol);\n det.extraOptions=sshExtra->text().trimmed();\n break;\n }\n case Type_File: {\n QString path=fileFolder->text().trimmed();\n if (path.isEmpty()) {\n path=\"/\";\n }\n det.url.setPath(path);\n det.url.setScheme(RemoteFsDevice::constFileProtocol);\n break;\n }\n case Type_Samba:\n det.url.setHost(smbHost->text().trimmed());\n det.url.setUserName(smbUser->text().trimmed());\n det.url.setPath(smbShare->text().trimmed());\n det.url.setPort(smbPort->value());\n det.url.setScheme(RemoteFsDevice::constSambaProtocol);\n det.url.setPassword(smbPassword->text().trimmed());\n if (!smbDomain->text().trimmed().isEmpty()) {\n QUrlQuery q;\n q.addQueryItem(RemoteFsDevice::constDomainQuery, smbDomain->text().trimmed());\n det.url.setQuery(q);\n }\n break;\n case Type_SambaAvahi:\n det.url.setUserName(smbAvahiUser->text().trimmed());\n det.url.setPath(smbAvahiShare->text().trimmed());\n det.url.setPort(0);\n det.url.setScheme(RemoteFsDevice::constSambaAvahiProtocol);\n det.url.setPassword(smbAvahiPassword->text().trimmed());\n if (!smbDomain->text().trimmed().isEmpty() || !smbAvahiName->text().trimmed().isEmpty()) {\n QUrlQuery q;\n if (!smbDomain->text().trimmed().isEmpty()) {\n q.addQueryItem(RemoteFsDevice::constDomainQuery, smbAvahiDomain->text().trimmed());\n }\n if (!smbAvahiName->text().trimmed().isEmpty()) {\n det.serviceName=smbAvahiName->text().trimmed();\n q.addQueryItem(RemoteFsDevice::constServiceNameQuery, det.serviceName);\n }\n det.url.setQuery(q);\n }\n break;\n }\n return det;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function remove()\n {\n $project = $this->getProject();\n $this->checkCSRFParam();\n $column_id = $this->request->getIntegerParam('column_id');\n\n if ($this->columnModel->remove($column_id)) {\n $this->flash->success(t('Column removed successfully.'));\n } else {\n $this->flash->failure(t('Unable to remove this column.'));\n }\n\n $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])));\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public static function is_same($p1, $p2){\r\n if($p1 == $p2){\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n }\r", "label": 0, "label_name": "vulnerable"} -{"code": " $return[] = sprintf('@return %s A %s instance.', 0 === strpos($class, '%') ? 'object' : '\\\\'.ltrim($class, '\\\\'), ltrim($class, '\\\\'));\n } elseif ($definition->getFactory()) {", "label": 0, "label_name": "vulnerable"} -{"code": " def test_underscore_traversal(self):\n # Prevent traversal to names starting with an underscore (_)\n ec = self._makeContext()\n\n with self.assertRaises(NotFound):\n ec.evaluate(\"context/__class__\")\n\n with self.assertRaises(NotFound):\n ec.evaluate(\"nocall: random/_itertools/repeat\")\n\n with self.assertRaises(NotFound):\n ec.evaluate(\"random/_itertools/repeat/foobar\")", "label": 1, "label_name": "safe"} -{"code": " echo '';\n $i++;\n }\n echo '';\n // }\n echo '';\n $j++;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "static int gemsafe_get_cert_len(sc_card_t *card)\n{\n\tint r;\n\tu8 ibuf[GEMSAFE_MAX_OBJLEN];\n\tu8 *iptr;\n\tstruct sc_path path;\n\tstruct sc_file *file;\n\tsize_t objlen, certlen;\n\tunsigned int ind, i=0;\n\n\tsc_format_path(GEMSAFE_PATH, &path);\n\tr = sc_select_file(card, &path, &file);\n\tif (r != SC_SUCCESS || !file)\n\t\treturn SC_ERROR_INTERNAL;\n\n\t/* Initial read */\n\tr = sc_read_binary(card, 0, ibuf, GEMSAFE_READ_QUANTUM, 0);\n\tif (r < 0)\n\t\treturn SC_ERROR_INTERNAL;\n\n\t/* Actual stored object size is encoded in first 2 bytes\n\t * (allocated EF space is much greater!)\n\t */\n\tobjlen = (((size_t) ibuf[0]) << 8) | ibuf[1];\n\tsc_log(card->ctx, \"Stored object is of size: %\"SC_FORMAT_LEN_SIZE_T\"u\",\n\t objlen);\n\tif (objlen < 1 || objlen > GEMSAFE_MAX_OBJLEN) {\n\t sc_log(card->ctx, \"Invalid object size: %\"SC_FORMAT_LEN_SIZE_T\"u\",\n\t\t objlen);\n\t return SC_ERROR_INTERNAL;\n\t}\n\n\t/* It looks like the first thing in the block is a table of\n\t * which keys are allocated. The table is small and is in the\n\t * first 248 bytes. Example for a card with 10 key containers:\n\t * 01 f0 00 03 03 b0 00 03 <= 1st key unallocated\n\t * 01 f0 00 04 03 b0 00 04 <= 2nd key unallocated\n\t * 01 fe 14 00 05 03 b0 00 05 <= 3rd key allocated\n\t * 01 fe 14 01 06 03 b0 00 06 <= 4th key allocated\n\t * 01 f0 00 07 03 b0 00 07 <= 5th key unallocated\n\t * ...\n\t * 01 f0 00 0c 03 b0 00 0c <= 10th key unallocated\n\t * For allocated keys, the fourth byte seems to indicate the\n\t * default key and the fifth byte indicates the key_ref of\n\t * the private key.\n\t */\n\tind = 2; /* skip length */\n\twhile (ibuf[ind] == 0x01) {\n\t\tif (ibuf[ind+1] == 0xFE) {\n\t\t\tgemsafe_prkeys[i].ref = ibuf[ind+4];\n\t\t\tsc_log(card->ctx, \"Key container %d is allocated and uses key_ref %d\",\n\t\t\t\t\ti+1, gemsafe_prkeys[i].ref);\n\t\t\tind += 9;\n\t\t}\n\t\telse {\n\t\t\tgemsafe_prkeys[i].label = NULL;\n\t\t\tgemsafe_cert[i].label = NULL;\n\t\t\tsc_log(card->ctx, \"Key container %d is unallocated\", i+1);\n\t\t\tind += 8;\n\t\t}\n\t\ti++;\n\t}\n\n\t/* Delete additional key containers from the data structures if\n\t * this card can't accommodate them.\n\t */\n\tfor (; i < gemsafe_cert_max; i++) {\n\t\tgemsafe_prkeys[i].label = NULL;\n\t\tgemsafe_cert[i].label = NULL;\n\t}\n\n\t/* Read entire file, then dissect in memory.\n\t * Gemalto ClassicClient seems to do it the same way.\n\t */\n\tiptr = ibuf + GEMSAFE_READ_QUANTUM;\n\twhile ((size_t)(iptr - ibuf) < objlen) {\n\t\tr = sc_read_binary(card, iptr - ibuf, iptr,\n\t\t\t\t MIN(GEMSAFE_READ_QUANTUM, objlen - (iptr - ibuf)), 0);\n\t\tif (r < 0) {\n\t\t\tsc_log(card->ctx, \"Could not read cert object\");\n\t\t\treturn SC_ERROR_INTERNAL;\n\t\t}\n\t\tiptr += GEMSAFE_READ_QUANTUM;\n\t}\n\n\t/* Search buffer for certificates, they start with 0x3082. */\n\ti = 0;\n\twhile (ind < objlen - 1) {\n\t\tif (ibuf[ind] == 0x30 && ibuf[ind+1] == 0x82) {\n\t\t\t/* Find next allocated key container */\n\t\t\twhile (i < gemsafe_cert_max && gemsafe_cert[i].label == NULL)\n\t\t\t\ti++;\n\t\t\tif (i == gemsafe_cert_max) {\n\t\t\t\tsc_log(card->ctx, \"Warning: Found orphaned certificate at offset %d\", ind);\n\t\t\t\treturn SC_SUCCESS;\n\t\t\t}\n\t\t\t/* DER cert len is encoded this way */\n\t\t\tif (ind+3 >= sizeof ibuf)\n\t\t\t\treturn SC_ERROR_INVALID_DATA;\n\t\t\tcertlen = ((((size_t) ibuf[ind+2]) << 8) | ibuf[ind+3]) + 4;\n\t\t\tsc_log(card->ctx,\n\t\t\t \"Found certificate of key container %d at offset %d, len %\"SC_FORMAT_LEN_SIZE_T\"u\",\n\t\t\t i+1, ind, certlen);\n\t\t\tgemsafe_cert[i].index = ind;\n\t\t\tgemsafe_cert[i].count = certlen;\n\t\t\tind += certlen;\n\t\t\ti++;\n\t\t} else\n\t\t\tind++;\n\t}\n\n\t/* Delete additional key containers from the data structures if\n\t * they're missing on the card.\n\t */\n\tfor (; i < gemsafe_cert_max; i++) {\n\t\tif (gemsafe_cert[i].label) {\n\t\t\tsc_log(card->ctx, \"Warning: Certificate of key container %d is missing\", i+1);\n\t\t\tgemsafe_prkeys[i].label = NULL;\n\t\t\tgemsafe_cert[i].label = NULL;\n\t\t}\n\t}\n\n\treturn SC_SUCCESS;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "static long restore_tm_user_regs(struct pt_regs *regs,\n\t\t\t\t struct mcontext __user *sr,\n\t\t\t\t struct mcontext __user *tm_sr)\n{\n\tlong err;\n\tunsigned long msr, msr_hi;\n#ifdef CONFIG_VSX\n\tint i;\n#endif\n\n\t/*\n\t * restore general registers but not including MSR or SOFTE. Also\n\t * take care of keeping r2 (TLS) intact if not a signal.\n\t * See comment in signal_64.c:restore_tm_sigcontexts();\n\t * TFHAR is restored from the checkpointed NIP; TEXASR and TFIAR\n\t * were set by the signal delivery.\n\t */\n\terr = restore_general_regs(regs, tm_sr);\n\terr |= restore_general_regs(¤t->thread.ckpt_regs, sr);\n\n\terr |= __get_user(current->thread.tm_tfhar, &sr->mc_gregs[PT_NIP]);\n\n\terr |= __get_user(msr, &sr->mc_gregs[PT_MSR]);\n\tif (err)\n\t\treturn 1;\n\n\t/* Restore the previous little-endian mode */\n\tregs->msr = (regs->msr & ~MSR_LE) | (msr & MSR_LE);\n\n\t/*\n\t * Do this before updating the thread state in\n\t * current->thread.fpr/vr/evr. That way, if we get preempted\n\t * and another task grabs the FPU/Altivec/SPE, it won't be\n\t * tempted to save the current CPU state into the thread_struct\n\t * and corrupt what we are writing there.\n\t */\n\tdiscard_lazy_cpu_state();\n\n#ifdef CONFIG_ALTIVEC\n\tregs->msr &= ~MSR_VEC;\n\tif (msr & MSR_VEC) {\n\t\t/* restore altivec registers from the stack */\n\t\tif (__copy_from_user(¤t->thread.vr_state, &sr->mc_vregs,\n\t\t\t\t sizeof(sr->mc_vregs)) ||\n\t\t __copy_from_user(¤t->thread.transact_vr,\n\t\t\t\t &tm_sr->mc_vregs,\n\t\t\t\t sizeof(sr->mc_vregs)))\n\t\t\treturn 1;\n\t} else if (current->thread.used_vr) {\n\t\tmemset(¤t->thread.vr_state, 0,\n\t\t ELF_NVRREG * sizeof(vector128));\n\t\tmemset(¤t->thread.transact_vr, 0,\n\t\t ELF_NVRREG * sizeof(vector128));\n\t}\n\n\t/* Always get VRSAVE back */\n\tif (__get_user(current->thread.vrsave,\n\t\t (u32 __user *)&sr->mc_vregs[32]) ||\n\t __get_user(current->thread.transact_vrsave,\n\t\t (u32 __user *)&tm_sr->mc_vregs[32]))\n\t\treturn 1;\n\tif (cpu_has_feature(CPU_FTR_ALTIVEC))\n\t\tmtspr(SPRN_VRSAVE, current->thread.vrsave);\n#endif /* CONFIG_ALTIVEC */\n\n\tregs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1);\n\n\tif (copy_fpr_from_user(current, &sr->mc_fregs) ||\n\t copy_transact_fpr_from_user(current, &tm_sr->mc_fregs))\n\t\treturn 1;\n\n#ifdef CONFIG_VSX\n\tregs->msr &= ~MSR_VSX;\n\tif (msr & MSR_VSX) {\n\t\t/*\n\t\t * Restore altivec registers from the stack to a local\n\t\t * buffer, then write this out to the thread_struct\n\t\t */\n\t\tif (copy_vsx_from_user(current, &sr->mc_vsregs) ||\n\t\t copy_transact_vsx_from_user(current, &tm_sr->mc_vsregs))\n\t\t\treturn 1;\n\t} else if (current->thread.used_vsr)\n\t\tfor (i = 0; i < 32 ; i++) {\n\t\t\tcurrent->thread.fp_state.fpr[i][TS_VSRLOWOFFSET] = 0;\n\t\t\tcurrent->thread.transact_fp.fpr[i][TS_VSRLOWOFFSET] = 0;\n\t\t}\n#endif /* CONFIG_VSX */\n\n#ifdef CONFIG_SPE\n\t/* SPE regs are not checkpointed with TM, so this section is\n\t * simply the same as in restore_user_regs().\n\t */\n\tregs->msr &= ~MSR_SPE;\n\tif (msr & MSR_SPE) {\n\t\tif (__copy_from_user(current->thread.evr, &sr->mc_vregs,\n\t\t\t\t ELF_NEVRREG * sizeof(u32)))\n\t\t\treturn 1;\n\t} else if (current->thread.used_spe)\n\t\tmemset(current->thread.evr, 0, ELF_NEVRREG * sizeof(u32));\n\n\t/* Always get SPEFSCR back */\n\tif (__get_user(current->thread.spefscr, (u32 __user *)&sr->mc_vregs\n\t\t + ELF_NEVRREG))\n\t\treturn 1;\n#endif /* CONFIG_SPE */\n\n\t/* Get the top half of the MSR from the user context */\n\tif (__get_user(msr_hi, &tm_sr->mc_gregs[PT_MSR]))\n\t\treturn 1;\n\tmsr_hi <<= 32;\n\t/* If TM bits are set to the reserved value, it's an invalid context */\n\tif (MSR_TM_RESV(msr_hi))\n\t\treturn 1;\n\t/* Pull in the MSR TM bits from the user context */\n\tregs->msr = (regs->msr & ~MSR_TS_MASK) | (msr_hi & MSR_TS_MASK);\n\t/* Now, recheckpoint. This loads up all of the checkpointed (older)\n\t * registers, including FP and V[S]Rs. After recheckpointing, the\n\t * transactional versions should be loaded.\n\t */\n\ttm_enable();\n\t/* Make sure the transaction is marked as failed */\n\tcurrent->thread.tm_texasr |= TEXASR_FS;\n\t/* This loads the checkpointed FP/VEC state, if used */\n\ttm_recheckpoint(¤t->thread, msr);\n\n\t/* This loads the speculative FP/VEC state, if used */\n\tif (msr & MSR_FP) {\n\t\tdo_load_up_transact_fpu(¤t->thread);\n\t\tregs->msr |= (MSR_FP | current->thread.fpexc_mode);\n\t}\n#ifdef CONFIG_ALTIVEC\n\tif (msr & MSR_VEC) {\n\t\tdo_load_up_transact_altivec(¤t->thread);\n\t\tregs->msr |= MSR_VEC;\n\t}\n#endif\n\n\treturn 0;\n}", "label": 1, "label_name": "safe"} -{"code": "func (m *A) Unmarshal(dAtA []byte) error {\n\tvar hasFields [1]uint64\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowVanity\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: A: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: A: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Strings\", wireType)\n\t\t\t}\n\t\t\tvar stringLen uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowVanity\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tintStringLen := int(stringLen)\n\t\t\tif intStringLen < 0 {\n\t\t\t\treturn ErrInvalidLengthVanity\n\t\t\t}\n\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthVanity\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.Strings = string(dAtA[iNdEx:postIndex])\n\t\t\tiNdEx = postIndex\n\t\tcase 2:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Int\", wireType)\n\t\t\t}\n\t\t\tm.Int = 0\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowVanity\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tm.Int |= int64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\thasFields[0] |= uint64(0x00000001)\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipVanity(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif skippy < 0 {\n\t\t\t\treturn ErrInvalidLengthVanity\n\t\t\t}\n\t\t\tif (iNdEx + skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthVanity\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\tif hasFields[0]&uint64(0x00000001) == 0 {\n\t\treturn github_com_gogo_protobuf_proto.NewRequiredNotSetError(\"Int\")\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 0, "label_name": "vulnerable"} -{"code": " it \"succeeds\" do\n connection.write auth\n reply = Protocol::Reply.deserialize(connection).documents[0]\n reply[\"ok\"].should eq 1.0\n end", "label": 0, "label_name": "vulnerable"} -{"code": " $this->inBody($token);\n\n /* Anything else */\n } else {\n /* Parse error. Ignore the token. */\n }\n }", "label": 1, "label_name": "safe"} -{"code": "void ff_h264_free_tables(H264Context *h, int free_rbsp)\n{\n int i;\n H264Context *hx;\n\n av_freep(&h->intra4x4_pred_mode);\n av_freep(&h->chroma_pred_mode_table);\n av_freep(&h->cbp_table);\n av_freep(&h->mvd_table[0]);\n av_freep(&h->mvd_table[1]);\n av_freep(&h->direct_table);\n av_freep(&h->non_zero_count);\n av_freep(&h->slice_table_base);\n h->slice_table = NULL;\n av_freep(&h->list_counts);\n\n av_freep(&h->mb2b_xy);\n av_freep(&h->mb2br_xy);\n\n av_buffer_pool_uninit(&h->qscale_table_pool);\n av_buffer_pool_uninit(&h->mb_type_pool);\n av_buffer_pool_uninit(&h->motion_val_pool);\n av_buffer_pool_uninit(&h->ref_index_pool);\n\n if (free_rbsp && h->DPB) {\n for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)\n ff_h264_unref_picture(h, &h->DPB[i]);\n memset(h->delayed_pic, 0, sizeof(h->delayed_pic));\n av_freep(&h->DPB);\n } else if (h->DPB) {\n for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)\n h->DPB[i].needs_realloc = 1;\n }\n\n h->cur_pic_ptr = NULL;\n\n for (i = 0; i < H264_MAX_THREADS; i++) {\n hx = h->thread_context[i];\n if (!hx)\n continue;\n av_freep(&hx->top_borders[1]);\n av_freep(&hx->top_borders[0]);\n av_freep(&hx->bipred_scratchpad);\n av_freep(&hx->edge_emu_buffer);\n av_freep(&hx->dc_val_base);\n av_freep(&hx->er.mb_index2xy);\n av_freep(&hx->er.error_status_table);\n av_freep(&hx->er.er_temp_buffer);\n av_freep(&hx->er.mbintra_table);\n av_freep(&hx->er.mbskip_table);\n\n if (free_rbsp) {\n av_freep(&hx->rbsp_buffer[1]);\n av_freep(&hx->rbsp_buffer[0]);\n hx->rbsp_buffer_size[0] = 0;\n hx->rbsp_buffer_size[1] = 0;\n }\n if (i)\n av_freep(&h->thread_context[i]);\n }\n}", "label": 1, "label_name": "safe"} -{"code": " public function testWith()\n {\n $token = new HTMLPurifier_Token_Start('tag');\n $this->context->register('CurrentToken', $token);\n $this->with->expectOnce('validate');\n $this->with->returns('validate', 'foo');\n $this->assertDef('bar', 'foo');\n }", "label": 1, "label_name": "safe"} -{"code": " public function getConfiguration(array $config, ContainerBuilder $container)\n {\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function testProcess()\n {\n $container = new ContainerBuilder();\n $def = $container\n ->register('foo')\n ->setArguments(array(new Reference('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE)))\n ->addMethodCall('foo', array(new Reference('moo', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)))\n ;\n\n $this->process($container);\n\n $arguments = $def->getArguments();\n $this->assertNull($arguments[0]);\n $this->assertCount(0, $def->getMethodCalls());\n }", "label": 0, "label_name": "vulnerable"} -{"code": "Status ShapeRefiner::InferShapesForFunctionSubNode(\n const Node* node, InferenceContext* outer_context) {\n TF_RETURN_IF_ERROR(AddNodeInternal(node, outer_context));\n InferenceContext* node_context = CHECK_NOTNULL(GetContext(node));\n\n if (StringPiece(node->type_string()) == kArgOp) {\n // Handle special node: function input.\n // Shapes for these nodes are provided in the outer inference\n // context.\n\n int index;\n TF_RETURN_IF_ERROR(GetNodeAttr(AttrSlice(node->def()), \"index\", &index));\n\n if (index < 0 || outer_context->num_inputs() <= index) {\n return errors::Internal(\n \"Function instantiation included invalid input index: \", index,\n \" not in [0, \", outer_context->num_inputs(), \").\");\n }\n\n // TODO(b/134547156): TEMPORARY WORKAROUND. If input shape handle is not set\n // in outer context, set _Arg node output shape to unknown.\n if (outer_context->input(index).SameHandle(ShapeHandle())) {\n VLOG(1) << \"Function instantiation has undefined input shape at \"\n << \"index: \" << index << \" in the outer inference context.\";\n node_context->set_output(0, node_context->UnknownShape());\n } else {\n node_context->set_output(0, outer_context->input(index));\n }\n\n auto* resource = outer_context->input_handle_shapes_and_types(index);\n if (resource) {\n node_context->set_output_handle_shapes_and_types(0, *resource);\n }\n } else if (StringPiece(node->type_string()) == kRetvalOp) {\n // Handle special node: function output.\n // Shapes inferred for these nodes go into the outer inference\n // context.\n\n int index;\n TF_RETURN_IF_ERROR(GetNodeAttr(AttrSlice(node->def()), \"index\", &index));\n\n if (index < 0 || outer_context->num_outputs() <= index) {\n return errors::Internal(\n \"Function instantiation included invalid output index: \", index,\n \" not in [0, \", outer_context->num_outputs(), \").\");\n }\n\n // outer_context outlives node_context, therefore we need to create\n // a new shape handle owned by outer_context instead.\n ShapeHandle handle;\n TensorShapeProto proto;\n node_context->ShapeHandleToProto(node_context->input(0), &proto);\n TF_RETURN_IF_ERROR(outer_context->MakeShapeFromShapeProto(proto, &handle));\n outer_context->set_output(index, handle);\n\n auto* resource = node_context->input_handle_shapes_and_types(0);\n if (resource) {\n outer_context->set_output_handle_shapes_and_types(index, *resource);\n }\n }\n\n return Status::OK();\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function comments_count()\r\n {\r\n global $DB;\r\n\r\n if(empty($this->_comments_count))\r\n {\r\n $DB->query('\r\n SELECT COUNT(*) as total\r\n FROM nv_comments\r\n WHERE website = ' . intval($this->website) . '\r\n AND object_type = \"product\"\r\n AND object_id = ' . intval($this->id) . '\r\n AND status = 0'\r\n );\r\n\r\n $out = $DB->result('total');\r\n $this->_comments_count = $out[0];\r\n }\r\n\r\n return $this->_comments_count;\r\n }\r", "label": 1, "label_name": "safe"} -{"code": "win_new_tabpage(int after)\n{\n tabpage_T\t*tp = curtab;\n tabpage_T\t*prev_tp = curtab;\n tabpage_T\t*newtp;\n int\t\tn;\n\n#ifdef FEAT_CMDWIN\n if (cmdwin_type != 0)\n {\n\temsg(_(e_invalid_in_cmdline_window));\n\treturn FAIL;\n }\n#endif\n\n newtp = alloc_tabpage();\n if (newtp == NULL)\n\treturn FAIL;\n\n // Remember the current windows in this Tab page.\n if (leave_tabpage(curbuf, TRUE) == FAIL)\n {\n\tvim_free(newtp);\n\treturn FAIL;\n }\n curtab = newtp;\n\n newtp->tp_localdir = (tp->tp_localdir == NULL)\n\t\t\t\t ? NULL : vim_strsave(tp->tp_localdir);\n // Create a new empty window.\n if (win_alloc_firstwin(tp->tp_curwin) == OK)\n {\n\t// Make the new Tab page the new topframe.\n\tif (after == 1)\n\t{\n\t // New tab page becomes the first one.\n\t newtp->tp_next = first_tabpage;\n\t first_tabpage = newtp;\n\t}\n\telse\n\t{\n\t if (after > 0)\n\t {\n\t\t// Put new tab page before tab page \"after\".\n\t\tn = 2;\n\t\tfor (tp = first_tabpage; tp->tp_next != NULL\n\t\t\t\t\t && n < after; tp = tp->tp_next)\n\t\t ++n;\n\t }\n\t newtp->tp_next = tp->tp_next;\n\t tp->tp_next = newtp;\n\t}\n\tnewtp->tp_firstwin = newtp->tp_lastwin = newtp->tp_curwin = curwin;\n\n\twin_init_size();\n\tfirstwin->w_winrow = tabline_height();\n\twin_comp_scroll(curwin);\n\n\tnewtp->tp_topframe = topframe;\n\tlast_status(FALSE);\n\n\tlastused_tabpage = prev_tp;\n\n#if defined(FEAT_GUI)\n\t// When 'guioptions' includes 'L' or 'R' may have to remove or add\n\t// scrollbars. Have to update them anyway.\n\tgui_may_update_scrollbars();\n#endif\n#ifdef FEAT_JOB_CHANNEL\n\tentering_window(curwin);\n#endif\n\n\tredraw_all_later(NOT_VALID);\n\tapply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_TABNEW, NULL, NULL, FALSE, curbuf);\n\tapply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);\n\treturn OK;\n }\n\n // Failed, get back the previous Tab page\n enter_tabpage(curtab, curbuf, TRUE, TRUE);\n return FAIL;\n}", "label": 1, "label_name": "safe"} -{"code": " def handle_delete_user(self, req):\n \"\"\"Handles the DELETE v2// call for deleting a user from an\n account.\n\n Can only be called by an account .admin.\n\n :param req: The swob.Request to process.\n :returns: swob.Response, 2xx on success.\n \"\"\"\n # Validate path info\n account = req.path_info_pop()\n user = req.path_info_pop()\n if req.path_info or not account or account[0] == '.' or not user or \\\n user[0] == '.':\n return HTTPBadRequest(request=req)\n\n # if user to be deleted is reseller_admin, then requesting\n # user must be the super_admin\n is_reseller_admin = self.is_user_reseller_admin(req, account, user)\n if not is_reseller_admin and not req.credentials_valid:\n # if user to be deleted can't be found, return 404\n return HTTPNotFound(request=req)\n elif is_reseller_admin and not self.is_super_admin(req):\n return HTTPForbidden(request=req)\n\n if not self.is_account_admin(req, account):\n return self.denied_response(req)\n\n # Delete the user's existing token, if any.\n path = quote('/v1/%s/%s/%s' % (self.auth_account, account, user))\n resp = self.make_pre_authed_request(\n req.environ, 'HEAD', path).get_response(self.app)\n if resp.status_int == 404:\n return HTTPNotFound(request=req)\n elif resp.status_int // 100 != 2:\n raise Exception('Could not obtain user details: %s %s' %\n (path, resp.status))\n candidate_token = resp.headers.get('x-object-meta-auth-token')\n if candidate_token:\n object_name = self._get_concealed_token(candidate_token)\n path = quote('/v1/%s/.token_%s/%s' %\n (self.auth_account, object_name[-1], object_name))\n resp = self.make_pre_authed_request(\n req.environ, 'DELETE', path).get_response(self.app)\n if resp.status_int // 100 != 2 and resp.status_int != 404:\n raise Exception('Could not delete possibly existing token: '\n '%s %s' % (path, resp.status))\n # Delete the user entry itself.\n path = quote('/v1/%s/%s/%s' % (self.auth_account, account, user))\n resp = self.make_pre_authed_request(\n req.environ, 'DELETE', path).get_response(self.app)\n if resp.status_int // 100 != 2 and resp.status_int != 404:\n raise Exception('Could not delete the user object: %s %s' %\n (path, resp.status))\n return HTTPNoContent(request=req)", "label": 1, "label_name": "safe"} -{"code": " async exec () {\n if (this.npm.config.get('global')) {\n const err = new Error('`npm ci` does not work for global packages')\n err.code = 'ECIGLOBAL'\n throw err\n }\n\n const where = this.npm.prefix\n const opts = {\n ...this.npm.flatOptions,\n path: where,\n log,\n save: false, // npm ci should never modify the lockfile or package.json\n workspaces: this.workspaceNames,\n }\n\n const arb = new Arborist(opts)\n await Promise.all([\n arb.loadVirtual().catch(er => {\n log.verbose('loadVirtual', er.stack)\n const msg =\n 'The `npm ci` command can only install with an existing package-lock.json or\\n' +\n 'npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or\\n' +\n 'later to generate a package-lock.json file, then try again.'\n throw new Error(msg)\n }),\n removeNodeModules(where),\n ])\n\n // retrieves inventory of packages from loaded virtual tree (lock file)\n const virtualInventory = new Map(arb.virtualTree.inventory)\n\n // build ideal tree step needs to come right after retrieving the virtual\n // inventory since it's going to erase the previous ref to virtualTree\n await arb.buildIdealTree()\n\n // verifies that the packages from the ideal tree will match\n // the same versions that are present in the virtual tree (lock file)\n // throws a validation error in case of mismatches\n const errors = validateLockfile(virtualInventory, arb.idealTree.inventory)\n if (errors.length) {\n throw new Error(\n '`npm ci` can only install packages when your package.json and ' +\n 'package-lock.json or npm-shrinkwrap.json are in sync. Please ' +\n 'update your lock file with `npm install` ' +\n 'before continuing.\\n\\n' +\n errors.join('\\n') + '\\n'\n )\n }\n\n await arb.reify(opts)\n\n const ignoreScripts = this.npm.config.get('ignore-scripts')\n // run the same set of scripts that `npm install` runs.\n if (!ignoreScripts) {\n const scripts = [\n 'preinstall',\n 'install',\n 'postinstall',\n 'prepublish', // XXX should we remove this finally??\n 'preprepare',\n 'prepare',\n 'postprepare',\n ]\n const scriptShell = this.npm.config.get('script-shell') || undefined\n for (const event of scripts) {\n await runScript({\n path: where,\n args: [],\n scriptShell,\n stdio: 'inherit',\n stdioString: true,\n banner: log.level !== 'silent',\n event,\n })\n }\n }\n await reifyFinish(this.npm, arb)\n }", "label": 1, "label_name": "safe"} -{"code": "def test_unicode_url():\n mw = _get_mw()\n req = SplashRequest(\n # note unicode URL\n u\"http://example.com/\", endpoint='execute')\n req2 = mw.process_request(req, None) or req\n res = {'html': 'Hello'}\n res_body = json.dumps(res)\n response = TextResponse(\"http://mysplash.example.com/execute\",\n # Scrapy doesn't pass request to constructor\n # request=req2,\n headers={b'Content-Type': b'application/json'},\n body=res_body.encode('utf8'))\n response2 = mw.process_response(req2, response, None)\n assert response2.url == \"http://example.com/\"", "label": 1, "label_name": "safe"} -{"code": "\"1\":null},ea.getVerticesAndEdges())},{install:function(ja){this.listener=function(){ja(Editor.sketchMode)};X.addListener(\"sketchModeChanged\",this.listener)},destroy:function(){X.removeListener(this.listener)}});O.appendChild(ka)}return O};var ba=Menus.prototype.init;Menus.prototype.init=function(){ba.apply(this,arguments);var O=this.editorUi,X=O.editor.graph;O.actions.get(\"editDiagram\").label=mxResources.get(\"formatXml\")+\"...\";O.actions.get(\"createShape\").label=mxResources.get(\"shape\")+\"...\";O.actions.get(\"outline\").label=", "label": 1, "label_name": "safe"} -{"code": " public bool UpdateNotes(Dictionary notes)\n {\n Client.Instance.PerformRequest(Client.HttpRequestMethod.Put,\n UrlPrefix + Uri.EscapeUriString(Uuid) + \"/notes\",\n WriteSubscriptionNotesXml(notes),\n ReadXml);\n\n CustomerNotes = notes[\"CustomerNotes\"];\n TermsAndConditions = notes[\"TermsAndConditions\"];\n VatReverseChargeNotes = notes[\"VatReverseChargeNotes\"];\n\n return true;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "async function mockStdInForAuthExpectError(t, mockLogger, ...text) {\n const stdin = stream.Readable.from(text);\n await t.throwsAsync(async () => util.getGitHubAuth(mockLogger, undefined, true, stdin));\n}", "label": 1, "label_name": "safe"} -{"code": "NO_INLINE JsVar *jspeStatement() {\n#ifdef USE_DEBUGGER\n if (execInfo.execute&EXEC_DEBUGGER_NEXT_LINE &&\n lex->tk!=';' &&\n JSP_SHOULD_EXECUTE) {\n lex->tokenLastStart = jsvStringIteratorGetIndex(&lex->tokenStart.it)-1;\n jsiDebuggerLoop();\n }\n#endif\n if (lex->tk==LEX_ID ||\n lex->tk==LEX_INT ||\n lex->tk==LEX_FLOAT ||\n lex->tk==LEX_STR ||\n lex->tk==LEX_TEMPLATE_LITERAL ||\n lex->tk==LEX_REGEX ||\n lex->tk==LEX_R_NEW ||\n lex->tk==LEX_R_NULL ||\n lex->tk==LEX_R_UNDEFINED ||\n lex->tk==LEX_R_TRUE ||\n lex->tk==LEX_R_FALSE ||\n lex->tk==LEX_R_THIS ||\n lex->tk==LEX_R_DELETE ||\n lex->tk==LEX_R_TYPEOF ||\n lex->tk==LEX_R_VOID ||\n lex->tk==LEX_R_SUPER ||\n lex->tk==LEX_PLUSPLUS ||\n lex->tk==LEX_MINUSMINUS ||\n lex->tk=='!' ||\n lex->tk=='-' ||\n lex->tk=='+' ||\n lex->tk=='~' ||\n lex->tk=='[' ||\n lex->tk=='(') {\n /* Execute a simple statement that only contains basic arithmetic... */\n return jspeExpression();\n } else if (lex->tk=='{') {\n /* A block of code */\n if (!jspCheckStackPosition()) return 0;\n jspeBlock();\n return 0;\n } else if (lex->tk==';') {\n /* Empty statement - to allow things like ;;; */\n JSP_ASSERT_MATCH(';');\n return 0;\n } else if (lex->tk==LEX_R_VAR ||\n lex->tk==LEX_R_LET ||\n lex->tk==LEX_R_CONST) {\n return jspeStatementVar();\n } else if (lex->tk==LEX_R_IF) {\n return jspeStatementIf();\n } else if (lex->tk==LEX_R_DO) {\n return jspeStatementDoOrWhile(false);\n } else if (lex->tk==LEX_R_WHILE) {\n return jspeStatementDoOrWhile(true);\n } else if (lex->tk==LEX_R_FOR) {\n return jspeStatementFor();\n } else if (lex->tk==LEX_R_TRY) {\n return jspeStatementTry();\n } else if (lex->tk==LEX_R_RETURN) {\n return jspeStatementReturn();\n } else if (lex->tk==LEX_R_THROW) {\n return jspeStatementThrow();\n } else if (lex->tk==LEX_R_FUNCTION) {\n return jspeStatementFunctionDecl(false/* function */);\n#ifndef SAVE_ON_FLASH\n } else if (lex->tk==LEX_R_CLASS) {\n return jspeStatementFunctionDecl(true/* class */);\n#endif\n } else if (lex->tk==LEX_R_CONTINUE) {\n JSP_ASSERT_MATCH(LEX_R_CONTINUE);\n if (JSP_SHOULD_EXECUTE) {\n if (!(execInfo.execute & EXEC_IN_LOOP))\n jsExceptionHere(JSET_SYNTAXERROR, \"CONTINUE statement outside of FOR or WHILE loop\");\n else\n execInfo.execute = (execInfo.execute & (JsExecFlags)~EXEC_RUN_MASK) | EXEC_CONTINUE;\n }\n } else if (lex->tk==LEX_R_BREAK) {\n JSP_ASSERT_MATCH(LEX_R_BREAK);\n if (JSP_SHOULD_EXECUTE) {\n if (!(execInfo.execute & (EXEC_IN_LOOP|EXEC_IN_SWITCH)))\n jsExceptionHere(JSET_SYNTAXERROR, \"BREAK statement outside of SWITCH, FOR or WHILE loop\");\n else\n execInfo.execute = (execInfo.execute & (JsExecFlags)~EXEC_RUN_MASK) | EXEC_BREAK;\n }\n } else if (lex->tk==LEX_R_SWITCH) {\n return jspeStatementSwitch();\n } else if (lex->tk==LEX_R_DEBUGGER) {\n JSP_ASSERT_MATCH(LEX_R_DEBUGGER);\n#ifdef USE_DEBUGGER\n if (JSP_SHOULD_EXECUTE)\n jsiDebuggerLoop();\n#endif\n } else JSP_MATCH(LEX_EOF);\n return 0;\n}", "label": 1, "label_name": "safe"} -{"code": "\t\t\t\t\t: function oneTimeInterceptedExpression(\n\t\t\t\t\t\t\tscope,\n\t\t\t\t\t\t\tlocals,\n\t\t\t\t\t\t\tassign,\n\t\t\t\t\t\t\tinputs\n\t\t\t\t\t ) {\n\t\t\t\t\t\t\tvar value = parsedExpression(scope, locals, assign, inputs);\n\t\t\t\t\t\t\tvar result = interceptorFn(value, scope, locals);\n\t\t\t\t\t\t\t// we only return the interceptor's result if the\n\t\t\t\t\t\t\t// initial value is defined (for bind-once)\n\t\t\t\t\t\t\treturn isDefined(value) ? result : value;\n\t\t\t\t\t };", "label": 1, "label_name": "safe"} -{"code": " didSet {\n guard stream != oldValue else { return }\n updateCaptureState()\n }", "label": 1, "label_name": "safe"} -{"code": "file_rlookup(const char *filename)\t/* I - Filename */\n{\n int\t\ti;\t\t\t/* Looping var */\n cache_t\t*wc;\t\t\t/* Current cache file */\n\n\n for (i = web_files, wc = web_cache; i > 0; i --, wc ++)\n {\n if (!strcmp(wc->name, filename))\n {\n if (!strncmp(wc->url, \"data:\", 5))\n return (\"data URL\");\n else\n return (wc->url);\n }\n }\n\n return (filename);\n}", "label": 1, "label_name": "safe"} -{"code": "bool WebSocketProtocol::handleFragment(char *data, size_t length, unsigned int remainingBytes, int opCode, bool fin, void *user) {\n uS::Socket s((uv_poll_t *) user);\n typename WebSocket::Data *webSocketData = (typename WebSocket::Data *) s.getSocketData();\n\n if (opCode < 3) {\n if (!remainingBytes && fin && !webSocketData->fragmentBuffer.length()) {\n if (webSocketData->compressionStatus == WebSocket::Data::CompressionStatus::COMPRESSED_FRAME) {\n webSocketData->compressionStatus = WebSocket::Data::CompressionStatus::ENABLED;\n Hub *hub = ((Group *) s.getSocketData()->nodeData)->hub;\n data = hub->inflate(data, length);\n if (!data) {\n forceClose(user);\n return true;\n }\n }\n\n if (opCode == 1 && !isValidUtf8((unsigned char *) data, length)) {\n forceClose(user);\n return true;\n }\n\n ((Group *) s.getSocketData()->nodeData)->messageHandler(WebSocket(s), data, length, (OpCode) opCode);\n if (s.isClosed() || s.isShuttingDown()) {\n return true;\n }\n } else {\n webSocketData->fragmentBuffer.append(data, length);\n if (!remainingBytes && fin) {\n length = webSocketData->fragmentBuffer.length();\n if (webSocketData->compressionStatus == WebSocket::Data::CompressionStatus::COMPRESSED_FRAME) {\n webSocketData->compressionStatus = WebSocket::Data::CompressionStatus::ENABLED;\n Hub *hub = ((Group *) s.getSocketData()->nodeData)->hub;\n webSocketData->fragmentBuffer.append(\"....\");\n data = hub->inflate((char *) webSocketData->fragmentBuffer.data(), length);\n if (!data) {\n forceClose(user);\n return true;\n }\n } else {\n data = (char *) webSocketData->fragmentBuffer.data();\n }\n\n if (opCode == 1 && !isValidUtf8((unsigned char *) data, length)) {\n forceClose(user);\n return true;\n }\n\n ((Group *) s.getSocketData()->nodeData)->messageHandler(WebSocket(s), data, length, (OpCode) opCode);\n if (s.isClosed() || s.isShuttingDown()) {\n return true;\n }\n webSocketData->fragmentBuffer.clear();\n }\n }\n } else {\n // todo: we don't need to buffer up in most cases!\n webSocketData->controlBuffer.append(data, length);\n if (!remainingBytes && fin) {\n if (opCode == CLOSE) {\n CloseFrame closeFrame = parseClosePayload((char *) webSocketData->controlBuffer.data(), webSocketData->controlBuffer.length());\n WebSocket(s).close(closeFrame.code, closeFrame.message, closeFrame.length);\n return true;\n } else {\n if (opCode == PING) {\n WebSocket(s).send(webSocketData->controlBuffer.data(), webSocketData->controlBuffer.length(), (OpCode) OpCode::PONG);\n ((Group *) s.getSocketData()->nodeData)->pingHandler(WebSocket(s), (char *) webSocketData->controlBuffer.data(), webSocketData->controlBuffer.length());\n if (s.isClosed() || s.isShuttingDown()) {\n return true;\n }\n } else if (opCode == PONG) {\n ((Group *) s.getSocketData()->nodeData)->pongHandler(WebSocket(s), (char *) webSocketData->controlBuffer.data(), webSocketData->controlBuffer.length());\n if (s.isClosed() || s.isShuttingDown()) {\n return true;\n }\n }\n }\n webSocketData->controlBuffer.clear();\n }\n }\n\n return false;\n}", "label": 1, "label_name": "safe"} -{"code": "TEST_F(ListenerManagerImplQuicOnlyTest, QuicListenerFactoryWithWrongCodec) {\n const std::string yaml = TestEnvironment::substitute(R\"EOF(\naddress:\n socket_address:\n address: 127.0.0.1\n protocol: UDP\n port_value: 1234\nfilter_chains:\n- filter_chain_match:\n transport_protocol: \"quic\"\n filters: []\n transport_socket:\n name: envoy.transport_sockets.quic\n typed_config:\n \"@type\": type.googleapis.com/envoy.extensions.transport_sockets.quic.v3.QuicDownstreamTransport\n downstream_tls_context:\n common_tls_context:\n tls_certificates:\n - certificate_chain:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_cert.pem\"\n private_key:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_uri_key.pem\"\n validation_context:\n trusted_ca:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem\"\n match_typed_subject_alt_names:\n - matcher:\n exact: localhost\n san_type: URI\n - matcher:\n exact: 127.0.0.1\n san_type: IP_ADDRESS\nudp_listener_config:\n quic_options: {}\n )EOF\",\n Network::Address::IpVersion::v4);\n\n envoy::config::listener::v3::Listener listener_proto = parseListenerFromV3Yaml(yaml);\n\n#if defined(ENVOY_ENABLE_QUIC)\n EXPECT_THROW_WITH_REGEX(manager_->addOrUpdateListener(listener_proto, \"\", true), EnvoyException,\n \"error building network filter chain for quic listener: requires exactly \"\n \"one http_connection_manager filter.\");\n#else\n EXPECT_THROW_WITH_REGEX(manager_->addOrUpdateListener(listener_proto, \"\", true), EnvoyException,\n \"QUIC is configured but not enabled in the build.\");\n#endif\n}", "label": 1, "label_name": "safe"} -{"code": " this.disableChatSoundUser = function(inst)\n {\n \tif (inst.find('> i').text() == 'volume_off') {\n \t\t$.get(this.wwwDir+ 'user/setsettingajax/chat_message/1');\n \t\tconfLH.new_message_sound_user_enabled = 1;\n \t\tinst.find('> i').text('volume_up');\n \t} else {\n \t\t$.get(this.wwwDir+ 'user/setsettingajax/chat_message/0');\n \t\tconfLH.new_message_sound_user_enabled = 0;\n \t\tinst.find('> i').text('volume_off');\n \t};\n\n \tif (!!window.postMessage && parent) {\n \t\tif (inst.find('> i').text() == 'volume_off') {\n \t\t\tparent.postMessage(\"lhc_ch:s:0\", '*');\n \t\t} else {\n \t\t\tparent.postMessage(\"lhc_ch:s:1\", '*');\n \t\t}\n \t};\n\n \treturn false;\n };", "label": 0, "label_name": "vulnerable"} -{"code": " void Compute(OpKernelContext* c) override {\n PartialTensorShape element_shape;\n OP_REQUIRES_OK(c, TensorShapeFromTensor(c->input(0), &element_shape));\n int32 num_elements = c->input(1).scalar()();\n OP_REQUIRES(c, num_elements >= 0,\n errors::InvalidArgument(\"The num_elements to reserve must be a \"\n \"non negative number, but got \",\n num_elements));\n TensorList output;\n output.element_shape = element_shape;\n output.element_dtype = element_dtype_;\n output.tensors().resize(num_elements, Tensor(DT_INVALID));\n Tensor* result;\n AllocatorAttributes attr;\n attr.set_on_host(true);\n OP_REQUIRES_OK(c, c->allocate_output(0, TensorShape{}, &result, attr));\n result->scalar()() = std::move(output);\n }", "label": 1, "label_name": "safe"} -{"code": "def main(req: func.HttpRequest) -> func.HttpResponse:\n response = ok(\n Info(\n resource_group=get_base_resource_group(),\n region=get_base_region(),\n subscription=get_subscription(),\n versions=versions(),\n instance_id=get_instance_id(),\n insights_appid=get_insights_appid(),\n insights_instrumentation_key=get_insights_instrumentation_key(),\n )\n )\n\n return response", "label": 0, "label_name": "vulnerable"} +{"code": " def __init__(self, formats=None, content_types=None, datetime_formatting=None):\n self.supported_formats = []\n self.datetime_formatting = getattr(settings, 'TASTYPIE_DATETIME_FORMATTING', 'iso-8601')\n\n if formats is not None:\n self.formats = formats\n\n if content_types is not None:\n self.content_types = content_types\n\n if datetime_formatting is not None:\n self.datetime_formatting = datetime_formatting\n\n for format in self.formats:\n try:\n self.supported_formats.append(self.content_types[format])\n except KeyError:\n raise ImproperlyConfigured(\"Content type for specified type '%s' not found. Please provide it at either the class level or via the arguments.\" % format)", "label": 1, "label_name": "safe"} +{"code": "def make_sydent(test_config={}):\n \"\"\"Create a new sydent\n\n Args:\n test_config (dict): any configuration variables for overriding the default sydent\n config\n \"\"\"\n # Use an in-memory SQLite database. Note that the database isn't cleaned up between\n # tests, so by default the same database will be used for each test if changed to be\n # a file on disk.\n if 'db' not in test_config:\n test_config['db'] = {'db.file': ':memory:'}\n else:\n test_config['db'].setdefault('db.file', ':memory:')\n\n reactor = MemoryReactorClock()\n return Sydent(reactor=reactor, cfg=parse_config_dict(test_config))", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic static function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) {\n\t\t$config = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'globalnewfiles' );\n\n\t\tif ( $config->get( 'CreateWikiDatabase' ) === $config->get( 'DBname' ) ) {\n\t\t\t$updater->addExtensionTable(\n\t\t\t\t'gnf_files',\n\t\t\t\t__DIR__ . '/../sql/gnf_files.sql'\n\t\t\t);\n\n\t\t\t$updater->modifyExtensionField(\n\t\t\t\t'gnf_files',\n\t\t\t\t'files_timestamp',\n\t\t\t\t__DIR__ . '/../sql/patches/patch-gnf_files-binary.sql'\n\t\t\t);\n\n\t\t\t$updater->modifyTable(\n \t\t\t\t'gnf_files',\n \t\t\t\t__DIR__ . '/../sql/patches/patch-gnf_files-add-indexes.sql',\n\t\t\t\ttrue\n \t\t\t);\n\t\t}\n\n\t\treturn true;\n\t}", "label": 1, "label_name": "safe"} +{"code": "Status GetInitOp(const string& export_dir, const MetaGraphDef& meta_graph_def,\n string* init_op_name) {\n const auto& sig_def_map = meta_graph_def.signature_def();\n const auto& init_op_sig_it =\n meta_graph_def.signature_def().find(kSavedModelInitOpSignatureKey);\n if (init_op_sig_it != sig_def_map.end()) {\n const auto& sig_def_outputs = init_op_sig_it->second.outputs();\n const auto& sig_def_outputs_it =\n sig_def_outputs.find(kSavedModelInitOpSignatureKey);\n if (sig_def_outputs_it == sig_def_outputs.end()) {\n return errors::FailedPrecondition(\"Could not find output \",\n kSavedModelInitOpSignatureKey);\n }\n *init_op_name = sig_def_outputs_it->second.name();\n return Status::OK();\n }\n\n const auto& collection_def_map = meta_graph_def.collection_def();\n string init_op_collection_key;\n if (collection_def_map.find(kSavedModelMainOpKey) !=\n collection_def_map.end()) {\n init_op_collection_key = kSavedModelMainOpKey;\n } else {\n init_op_collection_key = kSavedModelLegacyInitOpKey;\n }\n\n const auto init_op_it = collection_def_map.find(init_op_collection_key);\n if (init_op_it != collection_def_map.end()) {\n if (init_op_it->second.node_list().value_size() != 1) {\n return errors::FailedPrecondition(\n strings::StrCat(\"Expected exactly one main op in : \", export_dir));\n }\n *init_op_name = init_op_it->second.node_list().value(0);\n }\n return Status::OK();\n}", "label": 1, "label_name": "safe"} +{"code": " value = value.replace(/src=\" *javascript\\:(.*?)\"/gi, function(m, $1) {\n return 'removed=\"\"';\n });", "label": 1, "label_name": "safe"} +{"code": "fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc)\n{\n\ttmsize_t stride = PredictorState(tif)->stride;\n\tuint32 bps = tif->tif_dir.td_bitspersample / 8;\n\ttmsize_t wc = cc / bps;\n\ttmsize_t count;\n\tuint8 *cp = (uint8 *) cp0;\n\tuint8 *tmp;\n\n if((cc%(bps*stride))!=0)\n {\n TIFFErrorExt(tif->tif_clientdata, \"fpDiff\",\n \"%s\", \"(cc%(bps*stride))!=0\");\n return 0;\n }\n\n tmp = (uint8 *)_TIFFmalloc(cc);\n\tif (!tmp)\n\t\treturn 0;\n\n\t_TIFFmemcpy(tmp, cp0, cc);\n\tfor (count = 0; count < wc; count++) {\n\t\tuint32 byte;\n\t\tfor (byte = 0; byte < bps; byte++) {\n\t\t\t#if WORDS_BIGENDIAN\n\t\t\tcp[byte * wc + count] = tmp[bps * count + byte];\n\t\t\t#else\n\t\t\tcp[(bps - byte - 1) * wc + count] =\n\t\t\t\ttmp[bps * count + byte];\n\t\t\t#endif\n\t\t}\n\t}\n\t_TIFFfree(tmp);\n\n\tcp = (uint8 *) cp0;\n\tcp += cc - stride - 1;\n\tfor (count = cc; count > stride; count -= stride)\n\t\tREPEAT4(stride, cp[stride] = (unsigned char)((cp[stride] - cp[0])&0xff); cp--)\n return 1;\n}", "label": 1, "label_name": "safe"} +{"code": " it { should be_enabled }", "label": 0, "label_name": "vulnerable"} +{"code": " public function updateForgottenPassword(array $input) {\n $condition = [\n 'glpi_users.is_active' => 1,\n 'glpi_users.is_deleted' => 0, [\n 'OR' => [\n ['glpi_users.begin_date' => null],\n ['glpi_users.begin_date' => ['<', new QueryExpression('NOW()')]]\n ],\n ], [\n 'OR' => [\n ['glpi_users.end_date' => null],\n ['glpi_users.end_date' => ['>', new QueryExpression('NOW()')]]\n ]\n ]\n ];\n if ($this->getFromDBbyEmail($input['email'], $condition)) {\n if (($this->fields[\"authtype\"] == Auth::DB_GLPI)\n || !Auth::useAuthExt()) {\n\n if (($input['password_forget_token'] == $this->fields['password_forget_token'])\n && (abs(strtotime($_SESSION[\"glpi_currenttime\"])\n -strtotime($this->fields['password_forget_token_date'])) < DAY_TIMESTAMP)) {\n\n $input['id'] = $this->fields['id'];\n Config::validatePassword($input[\"password\"], false); // Throws exception if password is invalid\n if (!$this->update($input)) {\n return false;\n }\n $input2 = [\n 'password_forget_token' => '',\n 'password_forget_token_date' => null,\n 'id' => $this->fields['id']\n ];\n $this->update($input2);\n return true;\n\n } else {\n throw new ForgetPasswordException(__('Your password reset request has expired or is invalid. Please renew it.'));\n }\n\n } else {\n throw new ForgetPasswordException(__(\"The authentication method configuration doesn't allow you to change your password.\"));\n }\n\n } else {\n throw new ForgetPasswordException(__('Email address not found.'));\n }\n\n return false;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " it 'returns false' do\n provider.class.stubs(:mongo).returns(< INT_MAX) {\n\t\t/* string length is int in 5.x so we can not read more than int */\n\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Length parameter must be no more than %d\", INT_MAX);\n\t\tRETURN_FALSE;\n\t}\n\n\tZ_STRVAL_P(return_value) = emalloc(len + 1);\n\tZ_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);\n\n\t/* needed because recv/read/gzread doesnt put a null at the end*/\n\tZ_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;\n\tZ_TYPE_P(return_value) = IS_STRING;\n}", "label": 1, "label_name": "safe"} +{"code": " public function setFile($file)\n {\n $this->changes['file'] = true;\n\n return parent::setFile($file);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "transientObjectPutErrorMessage(Runtime *runtime, Handle<> base, SymbolID id) {\n // Emit an error message that looks like:\n // \"Cannot create property '%{id}' on ${typeof base} '${String(base)}'\".\n StringView propName =\n runtime->getIdentifierTable().getStringView(runtime, id);\n Handle baseType =\n runtime->makeHandle(vmcast(typeOf(runtime, base)));\n StringView baseTypeAsString =\n StringPrimitive::createStringView(runtime, baseType);\n MutableHandle valueAsString{runtime};\n if (base->isSymbol()) {\n // Special workaround for Symbol which can't be stringified.\n auto str = symbolDescriptiveString(runtime, Handle::vmcast(base));\n if (str != ExecutionStatus::EXCEPTION) {\n valueAsString = *str;\n } else {\n runtime->clearThrownValue();\n valueAsString = StringPrimitive::createNoThrow(\n runtime, \"<>\");\n }\n } else {\n auto str = toString_RJS(runtime, base);\n assert(\n str != ExecutionStatus::EXCEPTION &&\n \"Primitives should be convertible to string without exceptions\");\n valueAsString = std::move(*str);\n }\n StringView valueAsStringPrintable =\n StringPrimitive::createStringView(runtime, valueAsString);\n\n SmallU16String<32> tmp;\n return runtime->raiseTypeError(\n TwineChar16(\"Cannot create property '\") + propName + \"' on \" +\n baseTypeAsString.getUTF16Ref(tmp) + \" '\" +\n valueAsStringPrintable.getUTF16Ref(tmp) + \"'\");\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testSanitizeDde(string $input)\n {\n self::assertEquals(\"' \" . $input, StringHelper::sanitizeDDE($input));\n }", "label": 1, "label_name": "safe"} +{"code": "pidfile_write(const char *pid_file, int pid)\n{\n\tFILE *pidfile = NULL;\n\tint pidfd = open(pid_file, O_NOFOLLOW | O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);\n\n\tif (pidfd != -1) pidfile = fdopen(pidfd, \"w\");\n\n\tif (!pidfile) {\n\t\tlog_message(LOG_INFO, \"pidfile_write : Cannot open %s pidfile\",\n\t\t pid_file);\n\t\treturn 0;\n\t}\n\tfprintf(pidfile, \"%d\\n\", pid);\n\tfclose(pidfile);\n\treturn 1;\n}", "label": 1, "label_name": "safe"} +{"code": " function process_subsections($parent_section, $subtpl) {\n global $db, $router;\n\n $section = new stdClass();\n $section->parent = $parent_section->id;\n $section->name = $subtpl->name;\n $section->sef_name = $router->encode($section->name);\n $section->subtheme = $subtpl->subtheme;\n $section->active = $subtpl->active;\n $section->public = $subtpl->public;\n $section->rank = $subtpl->rank;\n $section->page_title = $subtpl->page_title;\n $section->keywords = $subtpl->keywords;\n $section->description = $subtpl->description;\n $section->id = $db->insertObject($section, 'section');\n self::process_section($section, $subtpl);\n }", "label": 1, "label_name": "safe"} +{"code": " render() {},", "label": 1, "label_name": "safe"} +{"code": " public function validate() {\n global $db;\n // check for an sef url field. If it exists make sure it's valid and not a duplicate\n //this needs to check for SEF URLS being turned on also: TODO\n\n if (property_exists($this, 'sef_url') && !(in_array('sef_url', $this->do_not_validate))) {\n if (empty($this->sef_url)) $this->makeSefUrl();\n if (!isset($this->validates['is_valid_sef_name']['sef_url'])) $this->validates['is_valid_sef_name']['sef_url'] = array();\n if (!isset($this->validates['uniqueness_of']['sef_url'])) $this->validates['uniqueness_of']['sef_url'] = array();\n }\n\n // safeguard again loc data not being pass via forms...sometimes this happens when you're in a router\n // mapped view and src hasn't been passed in via link to the form \n if (isset($this->id) && empty($this->location_data)) {\n $loc = $db->selectValue($this->tablename, 'location_data', 'id=' . $this->id);\n if (!empty($loc)) $this->location_data = $loc;\n }\n\n // run the validation as defined in the models\n if (!isset($this->validates)) return true;\n $messages = array();\n $post = empty($_POST) ? array() : expString::sanitize($_POST);\n foreach ($this->validates as $validation=> $field) {\n foreach ($field as $key=> $value) {\n $fieldname = is_numeric($key) ? $value : $key;\n $opts = is_numeric($key) ? array() : $value;\n $ret = expValidator::$validation($fieldname, $this, $opts);\n if (!is_bool($ret)) {\n $messages[] = $ret;\n expValidator::setErrorField($fieldname);\n unset($post[$fieldname]);\n }\n }\n }\n\n if (count($messages) >= 1) expValidator::failAndReturnToForm($messages, $post);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "func (m *MockRequester) GetRequestedAt() time.Time {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetRequestedAt\")\n\tret0, _ := ret[0].(time.Time)\n\treturn ret0\n}", "label": 1, "label_name": "safe"} +{"code": "function ma(na,Ja,Ga){if(null!=na&&mxUtils.isAncestorNode(document.body,ca)&&(na=mxUtils.parseXml(na),na=Editor.extractGraphModel(na.documentElement,!0),null!=na)){\"mxfile\"==na.nodeName&&(na=Editor.parseDiagramNode(na.getElementsByTagName(\"diagram\")[0]));var Ra=new mxCodec(na.ownerDocument),Sa=new mxGraphModel;Ra.decode(na,Sa);na=Sa.root.getChildAt(0).children||[];b.sidebar.createTooltip(ca,na,Math.min((window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)-80,1E3),Math.min((window.innerHeight||\ndocument.documentElement.clientHeight||document.body.clientHeight)-80,800),null!=fa.title?mxResources.get(fa.title,null,fa.title):null,!0,new mxPoint(Ja,Ga),!0,null,!0);var Ha=document.createElement(\"div\");Ha.className=\"geTempDlgDialogMask\";Q.appendChild(Ha);var Na=b.sidebar.hideTooltip;b.sidebar.hideTooltip=function(){Ha&&(Q.removeChild(Ha),Ha=null,Na.apply(this,arguments),b.sidebar.hideTooltip=Na)};mxEvent.addListener(Ha,\"click\",function(){b.sidebar.hideTooltip()})}}var qa=null;if(Ca||b.sidebar.currentElt==", "label": 1, "label_name": "safe"} +{"code": " $dbfield = $this->GetFieldFromProp(str_replace(\"_IsEmpty\", \"\", $prop));\n $this->_where .= $this->_where_delim . \" \" . $dbfield . \" = ''\";\n $this->_where_delim = \" and\";\n } elseif (substr($prop, - 11) == \"_IsNotEmpty\" && $this->$prop ?? '') {", "label": 1, "label_name": "safe"} +{"code": "void snd_usb_mixer_disconnect(struct usb_mixer_interface *mixer)\n{\n\tusb_kill_urb(mixer->urb);\n\tusb_kill_urb(mixer->rc_urb);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function generateChildDefCallback($matches) {\n return $this->info[$matches[0]];\n }", "label": 1, "label_name": "safe"} +{"code": "def test_query_customer_user(\n staff_api_client,\n customer_user,\n gift_card_used,\n gift_card_expiry_date,\n address,\n permission_manage_users,\n permission_manage_orders,\n media_root,\n settings,", "label": 1, "label_name": "safe"} +{"code": "\t\theader: function(elem){\n\t\t\treturn /h\\d/i.test( elem.nodeName );\n\t\t},", "label": 0, "label_name": "vulnerable"} +{"code": "static void vmx_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu)\n{\n\tstruct vcpu_vmx *vmx = to_vmx(vcpu);\n\n\tvmcs_write32(PIN_BASED_VM_EXEC_CONTROL, vmx_pin_based_exec_ctrl(vmx));\n\tif (cpu_has_secondary_exec_ctrls()) {\n\t\tif (kvm_vcpu_apicv_active(vcpu))\n\t\t\tvmcs_set_bits(SECONDARY_VM_EXEC_CONTROL,\n\t\t\t\t SECONDARY_EXEC_APIC_REGISTER_VIRT |\n\t\t\t\t SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY);\n\t\telse\n\t\t\tvmcs_clear_bits(SECONDARY_VM_EXEC_CONTROL,\n\t\t\t\t\tSECONDARY_EXEC_APIC_REGISTER_VIRT |\n\t\t\t\t\tSECONDARY_EXEC_VIRTUAL_INTR_DELIVERY);\n\t}\n\n\tif (cpu_has_vmx_msr_bitmap())\n\t\tvmx_set_msr_bitmap(vcpu);\n}", "label": 1, "label_name": "safe"} +{"code": " public function getUserList()\n {\n $result = [];\n $users = CodeModel::all(User::tableName(), 'nick', 'nick', false);\n foreach ($users as $codeModel) {\n if ($codeModel->code != 'admin') {\n $result[$codeModel->code] = $codeModel->description;\n }\n }\n\n return $result;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "elFinder.prototype.commands.copy = function() {\n\t\n\tthis.shortcuts = [{\n\t\tpattern : 'ctrl+c ctrl+insert'\n\t}];\n\t\n\tthis.getstate = function(sel) {\n\t\tvar sel = this.files(sel),\n\t\t\tcnt = sel.length;\n\n\t\treturn cnt && $.map(sel, function(f) { return f.phash && f.read ? f : null }).length == cnt ? 0 : -1;\n\t}\n\t\n\tthis.exec = function(hashes) {\n\t\tvar fm = this.fm,\n\t\t\tdfrd = $.Deferred()\n\t\t\t\t.fail(function(error) {\n\t\t\t\t\tfm.error(error);\n\t\t\t\t});\n\n\t\t$.each(this.files(hashes), function(i, file) {\n\t\t\tif (!(file.read && file.phash)) {\n\t\t\t\treturn !dfrd.reject(['errCopy', file.name, 'errPerm']);\n\t\t\t}\n\t\t});\n\t\t\n\t\treturn dfrd.state() == 'rejected' ? dfrd : dfrd.resolve(fm.clipboard(this.hashes(hashes)));\n\t}\n\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public static function go($input, $path, $allowed='', $uniq=false, $size='', $width = '', $height = ''){\r\n $filename = Typo::cleanX($_FILES[$input]['name']);\r\n $filename = str_replace(' ', '_', $filename);\r\n if(isset($_FILES[$input]) && $_FILES[$input]['error'] == 0){\r\n if($uniq == true){\r\n $site = Typo::slugify(Options::v('sitename'));\r\n $uniqfile = $site.'-'.sha1(microtime().$filename).'-';\r\n }else{\r\n $uniqfile = '';\r\n }\r\n \r\n $extension = pathinfo($_FILES[$input]['name'], PATHINFO_EXTENSION);\r\n $filetmp = $_FILES[$input]['tmp_name'];\r\n $filepath = GX_PATH.$path.$uniqfile.$filename;\r\n\r\n if(!in_array(strtolower($extension), $allowed)){\r\n $result['error'] = 'File not allowed';\r\n }else{\r\n if(move_uploaded_file(\r\n $filetmp, \r\n $filepath)\r\n ){\r\n $result['filesize'] = filesize($filepath);\r\n $result['filename'] = $uniqfile.$filename;\r\n $result['path'] = $path.$uniqfile.$filename;\r\n $result['filepath'] = $filepath;\r\n $result['fileurl'] = Site::$url.$path.$uniqfile.$filename;\r\n\r\n }else{\r\n $result['error'] = 'Cannot upload to directory, please check \r\n if directory is exist or You had permission to write it.';\r\n }\r\n }\r\n\r\n \r\n }else{\r\n //$result['error'] = $_FILES[$input]['error'];\r\n $result['error'] = '';\r\n }\r\n\r\n return $result;\r\n\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": " public function testTagWithoutNameThrowsException()\n {\n $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));\n try {\n $loader->load('badtag2.yml');\n $this->fail('->load() should throw an exception when a tag is missing the name key');\n } catch (\\Exception $e) {\n $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if a tag is missing the name key');\n $this->assertStringStartsWith('A \"tags\" entry is missing a \"name\" key for service ', $e->getMessage(), '->load() throws an InvalidArgumentException if a tag is missing the name key');\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static GCObject **correctgraylist (GCObject **p) {\n GCObject *curr;\n while ((curr = *p) != NULL) {\n switch (curr->tt) {\n case LUA_VTABLE: case LUA_VUSERDATA: {\n GCObject **next = getgclist(curr);\n if (getage(curr) == G_TOUCHED1) { /* touched in this cycle? */\n lua_assert(isgray(curr));\n gray2black(curr); /* make it black, for next barrier */\n changeage(curr, G_TOUCHED1, G_TOUCHED2);\n p = next; /* go to next element */\n }\n else { /* not touched in this cycle */\n if (!iswhite(curr)) { /* not white? */\n lua_assert(isold(curr));\n if (getage(curr) == G_TOUCHED2) /* advance from G_TOUCHED2... */\n changeage(curr, G_TOUCHED2, G_OLD); /* ... to G_OLD */\n gray2black(curr); /* make it black */\n }\n /* else, object is white: just remove it from this list */\n *p = *next; /* remove 'curr' from gray list */\n }\n break;\n }\n case LUA_VTHREAD: {\n lua_State *th = gco2th(curr);\n lua_assert(!isblack(th));\n if (iswhite(th)) /* new object? */\n *p = th->gclist; /* remove from gray list */\n else /* old threads remain gray */\n p = &th->gclist; /* go to next element */\n break;\n }\n default: lua_assert(0); /* nothing more could be gray here */\n }\n }\n return p;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "function makeMsg(what, msg) {\n if (msg === undefined)\n msg = what;\n if (tests[t])\n what = tests[t].what;\n else\n what = '';\n return '[' + group + what + ']: ' + msg;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " saveCurrentNode: function () {\n if (this.currentNode) {\n if (this.currentNode != \"root\") {\n this.currentNode.applyData();\n } else {\n // save root node data\n var items = this.rootPanel.queryBy(function(item) {\n if (item == this.compositeIndicesPanel) {\n return false;\n }\n return true;\n });\n\n for (var i = 0; i < items.length; i++) {\n var item = items[i];\n if (typeof item.getValue == \"function\") {\n let value = item.getValue();\n if (typeof item.config.xtype !== 'undefined' && item.config.xtype === 'textfield') {\n value = Ext.util.Format.htmlEncode(value);\n }\n\n this.data[item.name] = value;\n }\n }\n\n if (this.compositeIndicesPanel) {\n this.collectCompositeIndices();\n }\n }\n }\n },", "label": 1, "label_name": "safe"} +{"code": "int test_sqr(BIO *bp, BN_CTX *ctx)\n\t{\n\tBIGNUM a,c,d,e;\n\tint i;\n\n\tBN_init(&a);\n\tBN_init(&c);\n\tBN_init(&d);\n\tBN_init(&e);\n\n\tfor (i=0; i_columnNames);\n $column_index < $nb;\n $column_index++\n ) {\n $html_output .= '';\n $odd_row = !$odd_row;\n //If 'Function' column is present\n $html_output .= $this->_getGeomFuncHtml($column_index);\n //Displays column's name, type, collation and value\n $html_output .= ''\n . htmlspecialchars($this->_columnNames[$column_index]) . '';\n $properties = $this->getColumnProperties($column_index, $column_index);\n $html_output .= '' . $properties['type'] . '';\n $html_output .= '' . $properties['collation'] . '';\n $html_output .= '' . $properties['func'] . '';\n // here, the data-type attribute is needed for a date/time picker\n $html_output .= '' . $properties['value'] . '';\n $html_output .= '';\n //Displays hidden fields\n $html_output .= '';\n $html_output .= '_columnNames[$column_index])\n . '\" />';\n $html_output .= '_columnTypes[$column_index] . '\" />';\n $html_output .= '_columnCollations[$column_index] . '\" />';\n $html_output .= '';\n } // end for", "label": 0, "label_name": "vulnerable"} +{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n expect { scope.function_unique([]) }.to( raise_error(Puppet::ParseError))\n end", "label": 0, "label_name": "vulnerable"} +{"code": " it \"returns the group permissions for everyone group too\" do\n category.set_permissions(everyone: :readonly)\n category.save!\n\n json = described_class.new(category, scope: Guardian.new(admin), root: false).as_json\n\n expect(json[:group_permissions]).to eq([\n { permission_type: CategoryGroup.permission_types[:readonly], group_name: 'everyone' },\n ])\n end", "label": 0, "label_name": "vulnerable"} +{"code": " func testThatCompleteImageDownloadFilterDoesNotPickUpUsersWithInvalidAssetId() {\n syncMOC.performGroupedBlockAndWait {\n // GIVEN\n let predicate = ZMUser.completeImageDownloadFilter\n let user = ZMUser(remoteID: UUID.create(), createIfNeeded: true, in: self.syncMOC)\n user?.completeProfileAssetIdentifier = \"not+valid+id\"\n user?.setImage(data: \"foo\".data(using: .utf8), size: .complete)\n\n // THEN\n XCTAssertFalse(predicate.evaluate(with: user))\n }\n }", "label": 1, "label_name": "safe"} +{"code": "function AuthContext(stream, username, service, method, cb) {\n EventEmitter.call(this);\n\n var self = this;\n\n this.username = this.user = username;\n this.service = service;\n this.method = method;\n this._initialResponse = false;\n this._finalResponse = false;\n this._multistep = false;\n this._cbfinal = function(allowed, methodsLeft, isPartial) {\n if (!self._finalResponse) {\n self._finalResponse = true;\n cb(self, allowed, methodsLeft, isPartial);\n }\n };\n this._stream = stream;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " protected function assertSigFig($n, $sigfigs)\n {\n $converter = new HTMLPurifier_UnitConverter();\n $result = $converter->getSigFigs($n);\n $this->assertIdentical($result, $sigfigs);\n }", "label": 1, "label_name": "safe"} +{"code": " function searchName() { return gt('Webpage'); }", "label": 1, "label_name": "safe"} +{"code": " public function save()\n {\n $project = $this->getProject();\n $values = $this->request->getValues();\n $values['project_id'] = $project['id'];\n\n list($valid, $errors) = $this->taskValidator->validateCreation($values);\n\n if (! $valid) {\n $this->flash->failure(t('Unable to create your task.'));\n $this->show($values, $errors);\n } else if (! $this->helper->projectRole->canCreateTaskInColumn($project['id'], $values['column_id'])) {\n $this->flash->failure(t('You cannot create tasks in this column.'));\n $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id'])), true);\n } else {\n $task_id = $this->taskCreationModel->create($values);\n\n if ($task_id > 0) {\n $this->flash->success(t('Task created successfully.'));\n $this->afterSave($project, $values, $task_id);\n } else {\n $this->flash->failure(t('Unable to create this task.'));\n $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id'])), true);\n }\n }\n }", "label": 1, "label_name": "safe"} +{"code": " jQuery.cleanData = function(elems) {\n var events;\n for (var i = 0, elem; (elem = elems[i]) != null; i++) {\n events = jQuery._data(elem, 'events');\n if (events && events.$destroy) {\n jQuery(elem).triggerHandler('$destroy');\n }\n }\n originalCleanData(elems);\n };", "label": 0, "label_name": "vulnerable"} +{"code": " def any_context?(taxonomy)\n taxonomy.blank?\n end", "label": 1, "label_name": "safe"} +{"code": " public function getName()\n {\n return 'router';\n }", "label": 0, "label_name": "vulnerable"} +{"code": " private static void HandleError(WebSocket websocket, Exception error)\n {\n Console.WriteLine(error.StackTrace + \" \" + error.Message);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function getMissingAmount()\n {\n if (empty($this->_id)) {\n return (double)$this->amount;\n }\n\n try {\n $select = $this->zdb->select(Contribution::TABLE);\n $select->columns(\n array(\n 'sum' => new Expression('SUM(montant_cotis)')\n )\n )->where([self::PK => $this->_id]);\n\n $results = $this->zdb->execute($select);\n $result = $results->current();\n $dispatched_amount = $result->sum;\n return (double)$this->_amount - (double)$dispatched_amount;\n } catch (Throwable $e) {\n Analog::log(\n 'An error occurred retrieving missing amounts | ' .\n $e->getMessage(),\n Analog::ERROR\n );\n throw $e;\n }\n }", "label": 1, "label_name": "safe"} +{"code": "func (m *MockAccessRequester) GetGrantedScopes() fosite.Arguments {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetGrantedScopes\")\n\tret0, _ := ret[0].(fosite.Arguments)\n\treturn ret0\n}", "label": 1, "label_name": "safe"} {"code": " public function getSourceKey()\n {\n return $this->sourceKey;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " private static void testInvalidHeaders0(String requestStr) {\n EmbeddedChannel channel = new EmbeddedChannel(new HttpRequestDecoder());\n assertTrue(channel.writeInbound(Unpooled.copiedBuffer(requestStr, CharsetUtil.US_ASCII)));\n HttpRequest request = channel.readInbound();\n assertTrue(request.decoderResult().isFailure());\n assertTrue(request.decoderResult().cause() instanceof IllegalArgumentException);\n assertFalse(channel.finish());\n }", "label": 0, "label_name": "vulnerable"} -{"code": "cosine_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,\n\tBuffer *buf, int *err, gchar **err_info)\n{\n\tchar\tline[COSINE_LINE_LENGTH];\n\n\tif (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)\n\t\treturn FALSE;\n\n\tif (file_gets(line, COSINE_LINE_LENGTH, wth->random_fh) == NULL) {\n\t\t*err = file_error(wth->random_fh, err_info);\n\t\tif (*err == 0) {\n\t\t\t*err = WTAP_ERR_SHORT_READ;\n\t\t}\n\t\treturn FALSE;\n\t}\n\n\t/* Parse the header and convert the ASCII hex dump to binary data */\n\treturn parse_cosine_packet(wth->random_fh, phdr, buf, line, err,\n\t err_info);\n}", "label": 1, "label_name": "safe"} -{"code": " public function make($string)\n {\n return new HTMLPurifier_AttrDef_HTML_Bool($string);\n }", "label": 1, "label_name": "safe"} -{"code": " public String resolveDriverClassName(DriverClassNameResolveRequest request) {\n return driverResources.resolveDriverClassName(request.getJdbcDriverFileUrl());\n }", "label": 1, "label_name": "safe"} -{"code": "function(qb,yb){var ub=tb.apply(this,arguments);return null==ub||qb.view.graph.isCustomLink(ub)?null:ub};pa.getLinkTargetForCellState=function(qb,yb){return qb.view.graph.getLinkTargetForCell(qb.cell)};pa.drawCellState=function(qb,yb){for(var ub=qb.view.graph,vb=null!=Ta?Ta.get(qb.cell):ub.isCellSelected(qb.cell),wb=ub.model.getParent(qb.cell);!(ia&&null==Ta||vb)&&null!=wb;)vb=null!=Ta?Ta.get(wb):ub.isCellSelected(wb),wb=ub.model.getParent(wb);(ia&&null==Ta||vb)&&gb.apply(this,arguments)};pa.drawState(this.getView().getState(this.model.root),", "label": 0, "label_name": "vulnerable"} -{"code": "var M=mxText.prototype.redraw;mxText.prototype.redraw=function(){M.apply(this,arguments);null!=this.node&&\"DIV\"==this.node.nodeName&&Graph.processFontAttributes(this.node)};Graph.prototype.createTagsDialog=function(p,C,I){function T(){for(var la=R.getSelectionCells(),Aa=[],Fa=0;FagenerateFilePath($config);\n if (!file_exists($file)) {\n return false;\n }\n return unlink($file);\n }", "label": 1, "label_name": "safe"} -{"code": "func (m *MyType) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowAsym\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: MyType: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: MyType: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipAsym(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif skippy < 0 {\n\t\t\t\treturn ErrInvalidLengthAsym\n\t\t\t}\n\t\t\tif (iNdEx + skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthAsym\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 0, "label_name": "vulnerable"} -{"code": " def make_homeserver(self, reactor, clock):\n hs = self.setup_test_homeserver(\n \"server\", http_client=None, federation_sender=Mock()\n )\n return hs", "label": 0, "label_name": "vulnerable"} -{"code": " public function doValidate(&$uri, $config, $context)\n {\n $uri->query = null;\n\n // typecode check\n $semicolon_pos = strrpos($uri->path, ';'); // reverse\n if ($semicolon_pos !== false) {\n $type = substr($uri->path, $semicolon_pos + 1); // no semicolon\n $uri->path = substr($uri->path, 0, $semicolon_pos);\n $type_ret = '';\n if (strpos($type, '=') !== false) {\n // figure out whether or not the declaration is correct\n list($key, $typecode) = explode('=', $type, 2);\n if ($key !== 'type') {\n // invalid key, tack it back on encoded\n $uri->path .= '%3B' . $type;\n } elseif ($typecode === 'a' || $typecode === 'i' || $typecode === 'd') {\n $type_ret = \";type=$typecode\";\n }\n } else {\n $uri->path .= '%3B' . $type;\n }\n $uri->path = str_replace(';', '%3B', $uri->path);\n $uri->path .= $type_ret;\n }\n return true;\n }", "label": 1, "label_name": "safe"} -{"code": "func (c *criService) containerSpec(id string, sandboxID string, sandboxPid uint32, netNSPath string, containerName string,\n\tconfig *runtime.ContainerConfig, sandboxConfig *runtime.PodSandboxConfig, imageConfig *imagespec.ImageConfig,\n\textraMounts []*runtime.Mount, ociRuntime config.Runtime) (_ *runtimespec.Spec, retErr error) {\n\n\tspecOpts := []oci.SpecOpts{\n\t\tcustomopts.WithoutRunMount,\n\t}\n\t// only clear the default security settings if the runtime does not have a custom\n\t// base runtime spec spec. Admins can use this functionality to define\n\t// default ulimits, seccomp, or other default settings.\n\tif ociRuntime.BaseRuntimeSpec == \"\" {\n\t\tspecOpts = append(specOpts, customopts.WithoutDefaultSecuritySettings)\n\t}\n\tspecOpts = append(specOpts,\n\t\tcustomopts.WithRelativeRoot(relativeRootfsPath),\n\t\tcustomopts.WithProcessArgs(config, imageConfig),\n\t\toci.WithDefaultPathEnv,\n\t\t// this will be set based on the security context below\n\t\toci.WithNewPrivileges,\n\t)\n\tif config.GetWorkingDir() != \"\" {\n\t\tspecOpts = append(specOpts, oci.WithProcessCwd(config.GetWorkingDir()))\n\t} else if imageConfig.WorkingDir != \"\" {\n\t\tspecOpts = append(specOpts, oci.WithProcessCwd(imageConfig.WorkingDir))\n\t}\n\n\tif config.GetTty() {\n\t\tspecOpts = append(specOpts, oci.WithTTY)\n\t}\n\n\t// Add HOSTNAME env.\n\tvar (\n\t\terr error\n\t\thostname = sandboxConfig.GetHostname()\n\t)\n\tif hostname == \"\" {\n\t\tif hostname, err = c.os.Hostname(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tspecOpts = append(specOpts, oci.WithEnv([]string{hostnameEnv + \"=\" + hostname}))\n\n\t// Apply envs from image config first, so that envs from container config\n\t// can override them.\n\tenv := imageConfig.Env\n\tfor _, e := range config.GetEnvs() {\n\t\tenv = append(env, e.GetKey()+\"=\"+e.GetValue())\n\t}\n\tspecOpts = append(specOpts, oci.WithEnv(env))\n\n\tsecurityContext := config.GetLinux().GetSecurityContext()\n\tlabelOptions, err := toLabel(securityContext.GetSelinuxOptions())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(labelOptions) == 0 {\n\t\t// Use pod level SELinux config\n\t\tif sandbox, err := c.sandboxStore.Get(sandboxID); err == nil {\n\t\t\tlabelOptions, err = selinux.DupSecOpt(sandbox.ProcessLabel)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\tprocessLabel, mountLabel, err := label.InitLabels(labelOptions)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to init selinux options %+v\", securityContext.GetSelinuxOptions())\n\t}\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\t_ = label.ReleaseLabel(processLabel)\n\t\t}\n\t}()\n\n\tspecOpts = append(specOpts, customopts.WithMounts(c.os, config, extraMounts, mountLabel))\n\n\tif !c.config.DisableProcMount {\n\t\t// Apply masked paths if specified.\n\t\t// If the container is privileged, this will be cleared later on.\n\t\tif maskedPaths := securityContext.GetMaskedPaths(); maskedPaths != nil {\n\t\t\tspecOpts = append(specOpts, oci.WithMaskedPaths(maskedPaths))\n\t\t}\n\n\t\t// Apply readonly paths if specified.\n\t\t// If the container is privileged, this will be cleared later on.\n\t\tif readonlyPaths := securityContext.GetReadonlyPaths(); readonlyPaths != nil {\n\t\t\tspecOpts = append(specOpts, oci.WithReadonlyPaths(readonlyPaths))\n\t\t}\n\t}\n\n\tif securityContext.GetPrivileged() {\n\t\tif !sandboxConfig.GetLinux().GetSecurityContext().GetPrivileged() {\n\t\t\treturn nil, errors.New(\"no privileged container allowed in sandbox\")\n\t\t}\n\t\tspecOpts = append(specOpts, oci.WithPrivileged)\n\t\tif !ociRuntime.PrivilegedWithoutHostDevices {\n\t\t\tspecOpts = append(specOpts, oci.WithHostDevices, oci.WithAllDevicesAllowed)\n\t\t} else {\n\t\t\t// add requested devices by the config as host devices are not automatically added\n\t\t\tspecOpts = append(specOpts, customopts.WithDevices(c.os, config), customopts.WithCapabilities(securityContext))\n\t\t}\n\t} else { // not privileged\n\t\tspecOpts = append(specOpts, customopts.WithDevices(c.os, config), customopts.WithCapabilities(securityContext))\n\t}\n\n\t// Clear all ambient capabilities. The implication of non-root + caps\n\t// is not clearly defined in Kubernetes.\n\t// See https://github.com/kubernetes/kubernetes/issues/56374\n\t// Keep docker's behavior for now.\n\tspecOpts = append(specOpts,\n\t\tcustomopts.WithoutAmbientCaps,\n\t\tcustomopts.WithSelinuxLabels(processLabel, mountLabel),\n\t)\n\n\t// TODO: Figure out whether we should set no new privilege for sandbox container by default\n\tif securityContext.GetNoNewPrivs() {\n\t\tspecOpts = append(specOpts, oci.WithNoNewPrivileges)\n\t}\n\t// TODO(random-liu): [P1] Set selinux options (privileged or not).\n\tif securityContext.GetReadonlyRootfs() {\n\t\tspecOpts = append(specOpts, oci.WithRootFSReadonly())\n\t}\n\n\tif c.config.DisableCgroup {\n\t\tspecOpts = append(specOpts, customopts.WithDisabledCgroups)\n\t} else {\n\t\tspecOpts = append(specOpts, customopts.WithResources(config.GetLinux().GetResources(), c.config.TolerateMissingHugetlbController, c.config.DisableHugetlbController))\n\t\tif sandboxConfig.GetLinux().GetCgroupParent() != \"\" {\n\t\t\tcgroupsPath := getCgroupsPath(sandboxConfig.GetLinux().GetCgroupParent(), id)\n\t\t\tspecOpts = append(specOpts, oci.WithCgroup(cgroupsPath))\n\t\t}\n\t}\n\n\tsupplementalGroups := securityContext.GetSupplementalGroups()\n\n\tfor pKey, pValue := range getPassthroughAnnotations(sandboxConfig.Annotations,\n\t\tociRuntime.PodAnnotations) {\n\t\tspecOpts = append(specOpts, customopts.WithAnnotation(pKey, pValue))\n\t}\n\n\tfor pKey, pValue := range getPassthroughAnnotations(config.Annotations,\n\t\tociRuntime.ContainerAnnotations) {\n\t\tspecOpts = append(specOpts, customopts.WithAnnotation(pKey, pValue))\n\t}\n\n\tspecOpts = append(specOpts,\n\t\tcustomopts.WithOOMScoreAdj(config, c.config.RestrictOOMScoreAdj),\n\t\tcustomopts.WithPodNamespaces(securityContext, sandboxPid),\n\t\tcustomopts.WithSupplementalGroups(supplementalGroups),\n\t\tcustomopts.WithAnnotation(annotations.ContainerType, annotations.ContainerTypeContainer),\n\t\tcustomopts.WithAnnotation(annotations.SandboxID, sandboxID),\n\t\tcustomopts.WithAnnotation(annotations.ContainerName, containerName),\n\t)\n\t// cgroupns is used for hiding /sys/fs/cgroup from containers.\n\t// For compatibility, cgroupns is not used when running in cgroup v1 mode or in privileged.\n\t// https://github.com/containers/libpod/issues/4363\n\t// https://github.com/kubernetes/enhancements/blob/0e409b47497e398b369c281074485c8de129694f/keps/sig-node/20191118-cgroups-v2.md#cgroup-namespace\n\tif cgroups.Mode() == cgroups.Unified && !securityContext.GetPrivileged() {\n\t\tspecOpts = append(specOpts, oci.WithLinuxNamespace(\n\t\t\truntimespec.LinuxNamespace{\n\t\t\t\tType: runtimespec.CgroupNamespace,\n\t\t\t}))\n\t}\n\treturn c.runtimeSpec(id, ociRuntime.BaseRuntimeSpec, specOpts...)\n}", "label": 0, "label_name": "vulnerable"} -{"code": "eb);this.updateSvgLinks(Da,ua,!0);this.addForeignObjectWarning(eb,Da);return Da}finally{Pa&&(this.useCssTransforms=!0,this.view.revalidate(),this.sizeDidChange())}};Graph.prototype.addForeignObjectWarning=function(z,L){if(\"0\"!=urlParams[\"svg-warning\"]&&0_width 1234 */\n\tgdCtxPuts(out, \"#define \");\n\tgdCtxPuts(out, name);\n\tgdCtxPuts(out, \"_width \");\n\tgdCtxPrintf(out, \"%d\\n\", gdImageSX(image));\n\n\t/* #define _height 1234 */\n\tgdCtxPuts(out, \"#define \");\n\tgdCtxPuts(out, name);\n\tgdCtxPuts(out, \"_height \");\n\tgdCtxPrintf(out, \"%d\\n\", gdImageSY(image));\n\n\t/* static unsigned char _bits[] = {\\n */\n\tgdCtxPuts(out, \"static unsigned char \");\n\tgdCtxPuts(out, name);\n\tgdCtxPuts(out, \"_bits[] = {\\n \");\n\n\tfree(name);\n\n\tb = 1;\n\tp = 0;\n\tc = 0;\n\tsx = gdImageSX(image);\n\tsy = gdImageSY(image);\n\tfor (y = 0; y < sy; y++) {\n\t\tfor (x = 0; x < sx; x++) {\n\t\t\tif (gdImageGetPixel(image, x, y) == fg) {\n\t\t\t\tc |= b;\n\t\t\t}\n\t\t\tif ((b == 128) || (x == sx && y == sy)) {\n\t\t\t\tb = 1;\n\t\t\t\tif (p) {\n\t\t\t\t\tgdCtxPuts(out, \", \");\n\t\t\t\t\tif (!(p%12)) {\n\t\t\t\t\t\tgdCtxPuts(out, \"\\n \");\n\t\t\t\t\t\tp = 12;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tp++;\n\t\t\t\tgdCtxPrintf(out, \"0x%02X\", c);\n\t\t\t\tc = 0;\n\t\t\t} else {\n\t\t\t\tb <<= 1;\n\t\t\t}\n\t\t}\n\t}\n\tgdCtxPuts(out, \"};\\n\");\n}", "label": 1, "label_name": "safe"} -{"code": " internal static bool ValidateHeaders( \n KeyValuePair>[] requestHeaders, \n string cookieToken,\n out string failedReason)\n {\n failedReason = \"\";\n\n if (requestHeaders.Any(z => z.Key.InvariantEquals(AngularHeadername)) == false)\n {\n failedReason = \"Missing token\";\n return false;\n }\n\n var headerToken = requestHeaders\n .Where(z => z.Key.InvariantEquals(AngularHeadername))\n .Select(z => z.Value)\n .SelectMany(z => z)\n .FirstOrDefault();\n \n // both header and cookie must be there\n if (cookieToken == null || headerToken == null)\n {\n failedReason = \"Missing token null\";\n return false;\n }\n\n if (ValidateTokens(cookieToken, headerToken) == false)\n {\n failedReason = \"Invalid token\";\n return false;\n }\n\n return true;\n }", "label": 1, "label_name": "safe"} -{"code": " Status check_index_ordering(const Tensor& indices) {\n if (indices.NumElements() == 0) {\n return errors::InvalidArgument(\"Indices are empty\");\n }\n\n auto findices = indices.flat();\n\n for (std::size_t i = 0; i < findices.dimension(0) - 1; ++i) {\n if (findices(i) < findices(i + 1)) {\n continue;\n }\n\n return errors::InvalidArgument(\"Indices are not strictly ordered\");\n }\n\n return Status::OK();\n }", "label": 1, "label_name": "safe"} -{"code": "this.showDialog(d.container,300,(p?25:0)+(l?125:210),!0,!0)};EditorUi.prototype.showExportDialog=function(d,g,k,l,p,q,x,y,A){x=null!=x?x:Editor.defaultIncludeDiagram;var B=document.createElement(\"div\");B.style.whiteSpace=\"nowrap\";var I=this.editor.graph,O=\"jpeg\"==y?220:300,t=document.createElement(\"h3\");mxUtils.write(t,d);t.style.cssText=\"width:100%;text-align:center;margin-top:0px;margin-bottom:10px\";B.appendChild(t);mxUtils.write(B,mxResources.get(\"zoom\")+\":\");var z=document.createElement(\"input\");\nz.setAttribute(\"type\",\"text\");z.style.marginRight=\"16px\";z.style.width=\"60px\";z.style.marginLeft=\"4px\";z.style.marginRight=\"12px\";z.value=this.lastExportZoom||\"100%\";B.appendChild(z);mxUtils.write(B,mxResources.get(\"borderWidth\")+\":\");var L=document.createElement(\"input\");L.setAttribute(\"type\",\"text\");L.style.marginRight=\"16px\";L.style.width=\"60px\";L.style.marginLeft=\"4px\";L.value=this.lastExportBorder||\"0\";B.appendChild(L);mxUtils.br(B);var C=this.addCheckbox(B,mxResources.get(\"selectionOnly\"),!1,\nI.isSelectionEmpty()),E=document.createElement(\"input\");E.style.marginTop=\"16px\";E.style.marginRight=\"8px\";E.style.marginLeft=\"24px\";E.setAttribute(\"disabled\",\"disabled\");E.setAttribute(\"type\",\"checkbox\");var G=document.createElement(\"select\");G.style.marginTop=\"16px\";G.style.marginLeft=\"8px\";d=[\"selectionOnly\",\"diagram\",\"page\"];var P={};for(t=0;tprivate_data;\n\tstruct perf_event_context *ctx;\n\tlong ret;\n\n\tctx = perf_event_ctx_lock(event);\n\tret = _perf_ioctl(event, cmd, arg);\n\tperf_event_ctx_unlock(event, ctx);\n\n\treturn ret;\n}", "label": 1, "label_name": "safe"} -{"code": "this.graph.getTooltip(c,d,e,f);this.show(k,e,f);this.state=c;this.node=d;this.stateSource=g}}),this.delay)}};mxTooltipHandler.prototype.hide=function(){this.resetTimer();this.hideTooltip()};mxTooltipHandler.prototype.hideTooltip=function(){null!=this.div&&(this.div.style.visibility=\"hidden\",this.div.innerText=\"\")};", "label": 1, "label_name": "safe"} -{"code": " it \"inherits the query's database\" do\n cursor.get_more_op.database.should eq query_operation.database\n end", "label": 0, "label_name": "vulnerable"} -{"code": " protected function getIcon()\n {\n try {\n $adapter = $this->fs->getAdapter();\n } catch (\\Exception $e) {\n $adapter = null;\n }\n\n if ($adapter instanceof League\\Flysystem\\Adapter\\AbstractFtpAdapter) {\n $icon = 'volume_icon_ftp.png';\n } elseif ($adapter instanceof League\\Flysystem\\Dropbox\\DropboxAdapter) {\n $icon = 'volume_icon_dropbox.png';\n } else {\n $icon = 'volume_icon_local.png';\n }\n\n $parentUrl = defined('ELFINDER_IMG_PARENT_URL')? (rtrim(ELFINDER_IMG_PARENT_URL, '/').'/') : '';\n return $parentUrl . 'img/' . $icon;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public static function client()\n {\n if (is_null(self::$client)) new CertificateAuthenticate();\n return self::$client;\n }", "label": 1, "label_name": "safe"} -{"code": "c.getMode())try{this.addRecent({id:c.getHash(),title:c.getTitle(),mode:c.getMode()})}catch(v){}try{mxSettings.setOpenCounter(mxSettings.getOpenCounter()+1),mxSettings.save()}catch(v){}}catch(v){this.fileLoadedError=v;if(null!=c)try{c.close()}catch(x){}if(EditorUi.enableLogging&&!this.isOffline())try{EditorUi.logEvent({category:\"ERROR-LOAD-FILE-\"+(null!=c?c.getHash():\"none\"),action:\"message_\"+v.message,label:\"stack_\"+v.stack})}catch(x){}c=mxUtils.bind(this,function(){null!=urlParams.url&&this.spinner.spin(document.body,\nmxResources.get(\"reconnecting\"))?window.location.search=this.getSearch([\"url\"]):null!=g?this.fileLoaded(g)||m():m()});e?c():this.handleError(v,mxResources.get(\"errorLoadingFile\"),c,!0,null,null,!0)}else m();return k};EditorUi.prototype.getHashValueForPages=function(c,e){var g=0,k=new mxGraphModel,m=new mxCodec;null!=e&&(e.byteCount=0,e.attrCount=0,e.eltCount=0,e.nodeCount=0);for(var q=0;qcolumns*tile_image->rows),sizeof(*xcfdata));\n if (xcfdata == (XCFPixelInfo *) NULL)\n ThrowBinaryException(ResourceLimitError,\"MemoryAllocationFailed\",\n image->filename);\n xcfodata=xcfdata;\n graydata=(unsigned char *) xcfdata; /* used by gray and indexed */\n count=ReadBlob(image,data_length,(unsigned char *) xcfdata);\n if (count != (ssize_t) data_length)\n ThrowBinaryException(CorruptImageError,\"NotEnoughPixelData\",\n image->filename);\n for (y=0; y < (ssize_t) tile_image->rows; y++)\n {\n q=GetAuthenticPixels(tile_image,0,y,tile_image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n if (inDocInfo->image_type == GIMP_GRAY)\n {\n for (x=0; x < (ssize_t) tile_image->columns; x++)\n {\n SetPixelGray(tile_image,ScaleCharToQuantum(*graydata),q);\n SetPixelAlpha(tile_image,ScaleCharToQuantum((unsigned char)\n inLayerInfo->alpha),q);\n graydata++;\n q+=GetPixelChannels(tile_image);\n }\n }\n else\n if (inDocInfo->image_type == GIMP_RGB)\n {\n for (x=0; x < (ssize_t) tile_image->columns; x++)\n {\n SetPixelRed(tile_image,ScaleCharToQuantum(xcfdata->red),q);\n SetPixelGreen(tile_image,ScaleCharToQuantum(xcfdata->green),q);\n SetPixelBlue(tile_image,ScaleCharToQuantum(xcfdata->blue),q);\n SetPixelAlpha(tile_image,xcfdata->alpha == 255U ? TransparentAlpha :\n ScaleCharToQuantum((unsigned char) inLayerInfo->alpha),q);\n xcfdata++;\n q+=GetPixelChannels(tile_image);\n }\n }\n if (SyncAuthenticPixels(tile_image,exception) == MagickFalse)\n break;\n }\n xcfodata=(XCFPixelInfo *) RelinquishMagickMemory(xcfodata);\n return MagickTrue;\n}", "label": 1, "label_name": "safe"} -{"code": " synchronize: function(requisition, errorHandler) {\n /**\n * @param {object} requisition The requisition object\n * @param {string} rescanExisting true to perform a full scan, false to only add/remove nodes without scan, dbonly for all DB operations without scan\n */\n var doSynchronize = function(requisition, rescanExisting) {\n RequisitionsService.startTiming();\n RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then(\n function() { // success\n growl.success('The import operation has been started for ' + _.escape(requisition.foreignSource) + ' (rescanExisting? ' + rescanExisting + ')
Use refresh to update the deployed statistics');\n requisition.setDeployed(true);\n },\n errorHandler\n );\n };\n bootbox.dialog({\n message: 'Do you want to rescan existing nodes ?

' +\n 'Choose yes to synchronize all the nodes with the database executing the scan phase.
' +\n 'Choose no to synchronize only the new and deleted nodes with the database executing the scan phase only for new nodes.
' +\n 'Choose dbonly to synchronize all the nodes with the database skipping the scan phase.
' +\n 'Choose cancel to abort the request.',\n title: 'Synchronize Requisition ' + _.escape(requisition.foreignSource),\n buttons: {\n fullSync: {\n label: 'Yes',\n className: 'btn-primary',\n callback: function() {\n doSynchronize(requisition, 'true');\n }\n },\n dbOnlySync: {\n label: 'DB Only',\n className: 'btn-secondary',\n callback: function() {\n doSynchronize(requisition, 'dbonly');\n }\n },\n ignoreExistingSync: {\n label: 'No',\n className: 'btn-secondary',\n callback: function() {\n doSynchronize(requisition, 'false');\n }\n },\n main: {\n label: 'Cancel',\n className: 'btn-secondary'\n }\n }\n });\n }\n };\n }]);", "label": 1, "label_name": "safe"} -{"code": " public function isQmail()\n {\n $ini_sendmail_path = ini_get('sendmail_path');\n\n if (!stristr($ini_sendmail_path, 'qmail')) {\n $this->Sendmail = '/var/qmail/bin/qmail-inject';\n } else {\n $this->Sendmail = $ini_sendmail_path;\n }\n $this->Mailer = 'qmail';\n }", "label": 1, "label_name": "safe"} -{"code": " func loadSecret(_ command: CDVInvokedUrlCommand) {\n let data = command.arguments[0] as AnyObject?;\n var prompt = \"Authentication\"\n if let description = data?[\"description\"] as! String? {\n prompt = description;\n }\n var pluginResult: CDVPluginResult\n do {\n let result = try Secret().load(prompt)\n pluginResult = CDVPluginResult(status: CDVCommandStatus_OK, messageAs: result);\n } catch {\n var code = PluginError.BIOMETRIC_UNKNOWN_ERROR.rawValue\n var message = error.localizedDescription\n if let err = error as? KeychainError {\n code = err.pluginError.rawValue\n message = err.localizedDescription\n }\n let errorResult = [\"code\": code, \"message\": message] as [String : Any]\n pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAs: errorResult);\n }\n self.commandDelegate.send(pluginResult, callbackId:command.callbackId)\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\t\t\tresize = function() {\n\t\t\t\t! dialog.data('draged') && dialog.is(':visible') && dialog.elfinderdialog('posInit');\n\t\t\t};", "label": 1, "label_name": "safe"} -{"code": "TEE_Result syscall_asymm_operate(unsigned long state,\n\t\t\tconst struct utee_attribute *usr_params,\n\t\t\tsize_t num_params, const void *src_data, size_t src_len,\n\t\t\tvoid *dst_data, uint64_t *dst_len)\n{\n\tTEE_Result res;\n\tstruct tee_cryp_state *cs;\n\tstruct tee_ta_session *sess;\n\tuint64_t dlen64;\n\tsize_t dlen;\n\tstruct tee_obj *o;\n\tvoid *label = NULL;\n\tsize_t label_len = 0;\n\tsize_t n;\n\tint salt_len;\n\tTEE_Attribute *params = NULL;\n\tstruct user_ta_ctx *utc;\n\n\tres = tee_ta_get_current_session(&sess);\n\tif (res != TEE_SUCCESS)\n\t\treturn res;\n\tutc = to_user_ta_ctx(sess->ctx);\n\n\tres = tee_svc_cryp_get_state(sess, tee_svc_uref_to_vaddr(state), &cs);\n\tif (res != TEE_SUCCESS)\n\t\treturn res;\n\n\tres = tee_mmu_check_access_rights(\n\t\tutc,\n\t\tTEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_ANY_OWNER,\n\t\t(uaddr_t) src_data, src_len);\n\tif (res != TEE_SUCCESS)\n\t\treturn res;\n\n\tres = tee_svc_copy_from_user(&dlen64, dst_len, sizeof(dlen64));\n\tif (res != TEE_SUCCESS)\n\t\treturn res;\n\tdlen = dlen64;\n\n\tres = tee_mmu_check_access_rights(\n\t\tutc,\n\t\tTEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_WRITE |\n\t\t\tTEE_MEMORY_ACCESS_ANY_OWNER,\n\t\t(uaddr_t) dst_data, dlen);\n\tif (res != TEE_SUCCESS)\n\t\treturn res;\n\n\tsize_t alloc_size = 0;\n\n\tif (MUL_OVERFLOW(sizeof(TEE_Attribute), num_params, &alloc_size))\n\t\treturn TEE_ERROR_OVERFLOW;\n\n\tparams = malloc(alloc_size);\n\tif (!params)\n\t\treturn TEE_ERROR_OUT_OF_MEMORY;\n\tres = copy_in_attrs(utc, usr_params, num_params, params);\n\tif (res != TEE_SUCCESS)\n\t\tgoto out;\n\n\tres = tee_obj_get(utc, cs->key1, &o);\n\tif (res != TEE_SUCCESS)\n\t\tgoto out;\n\tif ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) == 0) {\n\t\tres = TEE_ERROR_GENERIC;\n\t\tgoto out;\n\t}\n\n\tswitch (cs->algo) {\n\tcase TEE_ALG_RSA_NOPAD:\n\t\tif (cs->mode == TEE_MODE_ENCRYPT) {\n\t\t\tres = crypto_acipher_rsanopad_encrypt(o->attr, src_data,\n\t\t\t\t\t\t\t src_len, dst_data,\n\t\t\t\t\t\t\t &dlen);\n\t\t} else if (cs->mode == TEE_MODE_DECRYPT) {\n\t\t\tres = crypto_acipher_rsanopad_decrypt(o->attr, src_data,\n\t\t\t\t\t\t\t src_len, dst_data,\n\t\t\t\t\t\t\t &dlen);\n\t\t} else {\n\t\t\t/*\n\t\t\t * We will panic because \"the mode is not compatible\n\t\t\t * with the function\"\n\t\t\t */\n\t\t\tres = TEE_ERROR_GENERIC;\n\t\t}\n\t\tbreak;\n\n\tcase TEE_ALG_RSAES_PKCS1_V1_5:\n\tcase TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA1:\n\tcase TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA224:\n\tcase TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA256:\n\tcase TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA384:\n\tcase TEE_ALG_RSAES_PKCS1_OAEP_MGF1_SHA512:\n\t\tfor (n = 0; n < num_params; n++) {\n\t\t\tif (params[n].attributeID == TEE_ATTR_RSA_OAEP_LABEL) {\n\t\t\t\tlabel = params[n].content.ref.buffer;\n\t\t\t\tlabel_len = params[n].content.ref.length;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (cs->mode == TEE_MODE_ENCRYPT) {\n\t\t\tres = crypto_acipher_rsaes_encrypt(cs->algo, o->attr,\n\t\t\t\t\t\t\t label, label_len,\n\t\t\t\t\t\t\t src_data, src_len,\n\t\t\t\t\t\t\t dst_data, &dlen);\n\t\t} else if (cs->mode == TEE_MODE_DECRYPT) {\n\t\t\tres = crypto_acipher_rsaes_decrypt(\n\t\t\t\t\tcs->algo, o->attr, label, label_len,\n\t\t\t\t\tsrc_data, src_len, dst_data, &dlen);\n\t\t} else {\n\t\t\tres = TEE_ERROR_BAD_PARAMETERS;\n\t\t}\n\t\tbreak;\n\n#if defined(CFG_CRYPTO_RSASSA_NA1)\n\tcase TEE_ALG_RSASSA_PKCS1_V1_5:\n#endif\n\tcase TEE_ALG_RSASSA_PKCS1_V1_5_MD5:\n\tcase TEE_ALG_RSASSA_PKCS1_V1_5_SHA1:\n\tcase TEE_ALG_RSASSA_PKCS1_V1_5_SHA224:\n\tcase TEE_ALG_RSASSA_PKCS1_V1_5_SHA256:\n\tcase TEE_ALG_RSASSA_PKCS1_V1_5_SHA384:\n\tcase TEE_ALG_RSASSA_PKCS1_V1_5_SHA512:\n\tcase TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA1:\n\tcase TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA224:\n\tcase TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA256:\n\tcase TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA384:\n\tcase TEE_ALG_RSASSA_PKCS1_PSS_MGF1_SHA512:\n\t\tif (cs->mode != TEE_MODE_SIGN) {\n\t\t\tres = TEE_ERROR_BAD_PARAMETERS;\n\t\t\tbreak;\n\t\t}\n\t\tsalt_len = pkcs1_get_salt_len(params, num_params, src_len);\n\t\tres = crypto_acipher_rsassa_sign(cs->algo, o->attr, salt_len,\n\t\t\t\t\t\t src_data, src_len, dst_data,\n\t\t\t\t\t\t &dlen);\n\t\tbreak;\n\n\tcase TEE_ALG_DSA_SHA1:\n\tcase TEE_ALG_DSA_SHA224:\n\tcase TEE_ALG_DSA_SHA256:\n\t\tres = crypto_acipher_dsa_sign(cs->algo, o->attr, src_data,\n\t\t\t\t\t src_len, dst_data, &dlen);\n\t\tbreak;\n\tcase TEE_ALG_ECDSA_P192:\n\tcase TEE_ALG_ECDSA_P224:\n\tcase TEE_ALG_ECDSA_P256:\n\tcase TEE_ALG_ECDSA_P384:\n\tcase TEE_ALG_ECDSA_P521:\n\t\tres = crypto_acipher_ecc_sign(cs->algo, o->attr, src_data,\n\t\t\t\t\t src_len, dst_data, &dlen);\n\t\tbreak;\n\n\tdefault:\n\t\tres = TEE_ERROR_BAD_PARAMETERS;\n\t\tbreak;\n\t}\n\nout:\n\tfree(params);\n\n\tif (res == TEE_SUCCESS || res == TEE_ERROR_SHORT_BUFFER) {\n\t\tTEE_Result res2;\n\n\t\tdlen64 = dlen;\n\t\tres2 = tee_svc_copy_to_user(dst_len, &dlen64, sizeof(*dst_len));\n\t\tif (res2 != TEE_SUCCESS)\n\t\t\treturn res2;\n\t}\n\n\treturn res;\n}", "label": 1, "label_name": "safe"} -{"code": "func (m *NinOptEnumDefault) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: NinOptEnumDefault: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: NinOptEnumDefault: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Field1\", wireType)\n\t\t\t}\n\t\t\tvar v TheTestEnum\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tv |= TheTestEnum(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tm.Field1 = &v\n\t\tcase 2:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Field2\", wireType)\n\t\t\t}\n\t\t\tvar v YetAnotherTestEnum\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tv |= YetAnotherTestEnum(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tm.Field2 = &v\n\t\tcase 3:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Field3\", wireType)\n\t\t\t}\n\t\t\tvar v YetYetAnotherTestEnum\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tv |= YetYetAnotherTestEnum(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tm.Field3 = &v\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipThetest(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif skippy < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif (iNdEx + skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 0, "label_name": "vulnerable"} -{"code": " def validate_url\n return unless trigger_rules['url']\n\n errors.add(:url, 'invalid') if inbox.inbox_type == 'Website' && !url_valid?(trigger_rules['url'])\n end", "label": 1, "label_name": "safe"} -{"code": "def run_cmd(auth_user, *args)\n options = {}\n return run_cmd_options(auth_user, options, *args)\nend", "label": 1, "label_name": "safe"} -{"code": "static int handle_exception(struct kvm_vcpu *vcpu)\n{\n\tstruct vcpu_vmx *vmx = to_vmx(vcpu);\n\tstruct kvm_run *kvm_run = vcpu->run;\n\tu32 intr_info, ex_no, error_code;\n\tunsigned long cr2, rip, dr6;\n\tu32 vect_info;\n\tenum emulation_result er;\n\n\tvect_info = vmx->idt_vectoring_info;\n\tintr_info = vmx->exit_intr_info;\n\n\tif (is_machine_check(intr_info))\n\t\treturn handle_machine_check(vcpu);\n\n\tif ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR)\n\t\treturn 1; /* already handled by vmx_vcpu_run() */\n\n\tif (is_no_device(intr_info)) {\n\t\tvmx_fpu_activate(vcpu);\n\t\treturn 1;\n\t}\n\n\tif (is_invalid_opcode(intr_info)) {\n\t\tif (is_guest_mode(vcpu)) {\n\t\t\tkvm_queue_exception(vcpu, UD_VECTOR);\n\t\t\treturn 1;\n\t\t}\n\t\ter = emulate_instruction(vcpu, EMULTYPE_TRAP_UD);\n\t\tif (er != EMULATE_DONE)\n\t\t\tkvm_queue_exception(vcpu, UD_VECTOR);\n\t\treturn 1;\n\t}\n\n\terror_code = 0;\n\tif (intr_info & INTR_INFO_DELIVER_CODE_MASK)\n\t\terror_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE);\n\n\t/*\n\t * The #PF with PFEC.RSVD = 1 indicates the guest is accessing\n\t * MMIO, it is better to report an internal error.\n\t * See the comments in vmx_handle_exit.\n\t */\n\tif ((vect_info & VECTORING_INFO_VALID_MASK) &&\n\t !(is_page_fault(intr_info) && !(error_code & PFERR_RSVD_MASK))) {\n\t\tvcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;\n\t\tvcpu->run->internal.suberror = KVM_INTERNAL_ERROR_SIMUL_EX;\n\t\tvcpu->run->internal.ndata = 3;\n\t\tvcpu->run->internal.data[0] = vect_info;\n\t\tvcpu->run->internal.data[1] = intr_info;\n\t\tvcpu->run->internal.data[2] = error_code;\n\t\treturn 0;\n\t}\n\n\tif (is_page_fault(intr_info)) {\n\t\t/* EPT won't cause page fault directly */\n\t\tBUG_ON(enable_ept);\n\t\tcr2 = vmcs_readl(EXIT_QUALIFICATION);\n\t\ttrace_kvm_page_fault(cr2, error_code);\n\n\t\tif (kvm_event_needs_reinjection(vcpu))\n\t\t\tkvm_mmu_unprotect_page_virt(vcpu, cr2);\n\t\treturn kvm_mmu_page_fault(vcpu, cr2, error_code, NULL, 0);\n\t}\n\n\tex_no = intr_info & INTR_INFO_VECTOR_MASK;\n\n\tif (vmx->rmode.vm86_active && rmode_exception(vcpu, ex_no))\n\t\treturn handle_rmode_exception(vcpu, ex_no, error_code);\n\n\tswitch (ex_no) {\n\tcase AC_VECTOR:\n\t\tkvm_queue_exception_e(vcpu, AC_VECTOR, error_code);\n\t\treturn 1;\n\tcase DB_VECTOR:\n\t\tdr6 = vmcs_readl(EXIT_QUALIFICATION);\n\t\tif (!(vcpu->guest_debug &\n\t\t (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))) {\n\t\t\tvcpu->arch.dr6 &= ~15;\n\t\t\tvcpu->arch.dr6 |= dr6 | DR6_RTM;\n\t\t\tif (!(dr6 & ~DR6_RESERVED)) /* icebp */\n\t\t\t\tskip_emulated_instruction(vcpu);\n\n\t\t\tkvm_queue_exception(vcpu, DB_VECTOR);\n\t\t\treturn 1;\n\t\t}\n\t\tkvm_run->debug.arch.dr6 = dr6 | DR6_FIXED_1;\n\t\tkvm_run->debug.arch.dr7 = vmcs_readl(GUEST_DR7);\n\t\t/* fall through */\n\tcase BP_VECTOR:\n\t\t/*\n\t\t * Update instruction length as we may reinject #BP from\n\t\t * user space while in guest debugging mode. Reading it for\n\t\t * #DB as well causes no harm, it is not used in that case.\n\t\t */\n\t\tvmx->vcpu.arch.event_exit_inst_len =\n\t\t\tvmcs_read32(VM_EXIT_INSTRUCTION_LEN);\n\t\tkvm_run->exit_reason = KVM_EXIT_DEBUG;\n\t\trip = kvm_rip_read(vcpu);\n\t\tkvm_run->debug.arch.pc = vmcs_readl(GUEST_CS_BASE) + rip;\n\t\tkvm_run->debug.arch.exception = ex_no;\n\t\tbreak;\n\tdefault:\n\t\tkvm_run->exit_reason = KVM_EXIT_EXCEPTION;\n\t\tkvm_run->ex.exception = ex_no;\n\t\tkvm_run->ex.error_code = error_code;\n\t\tbreak;\n\t}\n\treturn 0;\n}", "label": 1, "label_name": "safe"} -{"code": "generic_ret *init_2_svc(krb5_ui_4 *arg, struct svc_req *rqstp)\n{\n static generic_ret ret;\n gss_buffer_desc client_name,\n service_name;\n kadm5_server_handle_t handle;\n OM_uint32 minor_stat;\n const char *errmsg = NULL;\n size_t clen, slen;\n char *cdots, *sdots;\n\n xdr_free(xdr_generic_ret, &ret);\n\n if ((ret.code = new_server_handle(*arg, rqstp, &handle)))\n goto exit_func;\n if (! (ret.code = check_handle((void *)handle))) {\n ret.api_version = handle->api_version;\n }\n\n free_server_handle(handle);\n\n if (setup_gss_names(rqstp, &client_name, &service_name) < 0) {\n ret.code = KADM5_FAILURE;\n goto exit_func;\n }\n\n if (ret.code != 0)\n errmsg = krb5_get_error_message(NULL, ret.code);\n\n clen = client_name.length;\n trunc_name(&clen, &cdots);\n slen = service_name.length;\n trunc_name(&slen, &sdots);\n /* okay to cast lengths to int because trunc_name limits max value */\n krb5_klog_syslog(LOG_NOTICE, _(\"Request: kadm5_init, %.*s%s, %s, \"\n \"client=%.*s%s, service=%.*s%s, addr=%s, \"\n \"vers=%d, flavor=%d\"),\n (int)clen, (char *)client_name.value, cdots,\n errmsg ? errmsg : _(\"success\"),\n (int)clen, (char *)client_name.value, cdots,\n (int)slen, (char *)service_name.value, sdots,\n client_addr(rqstp->rq_xprt),\n ret.api_version & ~(KADM5_API_VERSION_MASK),\n rqstp->rq_cred.oa_flavor);\n if (errmsg != NULL)\n krb5_free_error_message(NULL, errmsg);\n gss_release_buffer(&minor_stat, &client_name);\n gss_release_buffer(&minor_stat, &service_name);\n\nexit_func:\n return(&ret);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "\t\t\t\t\tfunction updateGraph(xml)\n\t\t\t\t\t{\n\t\t\t\t\t\tspinner.stop();\n\t\t\t\t\t\terrorNode.innerHTML = '';\n\t\t\t\t\t\tvar doc = mxUtils.parseXml(xml);\n\t\t\t\t\t\tvar node = editorUi.editor.extractGraphModel(doc.documentElement, true);\n\n\t\t\t\t\t\tif (node != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpageSelect.style.display = 'none';\n\t\t\t\t\t\t\tpageSelect.innerHTML = '';\n\t\t\t\t\t\t\tcurrentDoc = doc;\n\t\t\t\t\t\t\tcurrentXml = xml;\n\t\t\t\t\t\t\tparseSelectFunction = null;\n\t\t\t\t\t\t\tdiagrams = null;\n\t\t\t\t\t\t\trealPage = 0;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction parseGraphModel(dataNode)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvar bg = dataNode.getAttribute('background');\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (bg == null || bg == '' || bg == mxConstants.NONE)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tbg = graph.defaultPageBackgroundColor;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tcontainer.style.backgroundColor = bg;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tvar codec = new mxCodec(dataNode.ownerDocument);\n\t\t\t\t\t\t\t\tcodec.decode(dataNode, graph.getModel());\n\t\t\t\t\t\t\t\tgraph.maxFitScale = 1;\n\t\t\t\t\t\t\t\tgraph.fit(8);\n\t\t\t\t\t\t\t\tgraph.center();\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\treturn dataNode;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction parseDiagram(diagramNode)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (diagramNode != null)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tdiagramNode = parseGraphModel(Editor.parseDiagramNode(diagramNode));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\treturn diagramNode;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (node.nodeName == 'mxfile')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// Workaround for \"invalid calling object\" error in IE\n\t\t\t\t\t\t\t\tvar tmp = node.getElementsByTagName('diagram');\n\t\t\t\t\t\t\t\tdiagrams = [];\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tfor (var i = 0; i < tmp.length; i++)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tdiagrams.push(tmp[i]);\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\trealPage = Math.min(currentPage, diagrams.length - 1);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (diagrams.length > 0)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tparseDiagram(diagrams[realPage]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (diagrams.length > 1)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tpageSelect.removeAttribute('disabled');\n\t\t\t\t\t\t\t\t\tpageSelect.style.display = '';\n\n\t\t\t\t\t\t\t\t\tfor (var i = 0; i < diagrams.length; i++)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tvar pageOption = document.createElement('option');\n\t\t\t\t\t\t\t\t\t\tmxUtils.write(pageOption, diagrams[i].getAttribute('name') ||\n\t\t\t\t\t\t\t\t\t\t\tmxResources.get('pageWithNumber', [i + 1]));\n\t\t\t\t\t\t\t\t\t\tpageOption.setAttribute('value', i);\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tif (i == realPage)\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tpageOption.setAttribute('selected', 'selected');\n\t\t\t\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t\t\t\tpageSelect.appendChild(pageOption);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tpageSelectFunction = function()\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttry\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tvar temp = parseInt(pageSelect.value);\n\t\t\t\t\t\t\t\t\t\tcurrentPage = temp;\n\t\t\t\t\t\t\t\t\t\trealPage = currentPage;\n\t\t\t\t\t\t\t\t\t\tparseDiagram(diagrams[temp]);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcatch (e)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tpageSelect.value = currentPage;\n\t\t\t\t\t\t\t\t\t\teditorUi.handleError(e);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tparseGraphModel(node);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar shortUser = item.lastModifyingUserName;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (shortUser != null && shortUser.length > 20)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tshortUser = shortUser.substring(0, 20) + '...';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfileInfo.innerHTML = '';\n\t\t\t\t\t\t\tmxUtils.write(fileInfo, ((shortUser != null) ?\n\t\t\t\t\t\t\t\t(shortUser + ' ') : '') + ts.toLocaleDateString() +\n\t\t\t\t\t\t\t\t' ' + ts.toLocaleTimeString());\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfileInfo.setAttribute('title', row.getAttribute('title'));\n\t\t\t\t\t\t\tzoomInBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\tzoomOutBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\tzoomFitBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\tzoomActualBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\tcompareBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (file == null || !file.isRestricted())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (editorUi.editor.graph.isEnabled())\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\trestoreBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tdownloadBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\t\tshowBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\t\tnewBtn.removeAttribute('disabled');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tmxUtils.setOpacity(zoomInBtn, 60);\n\t\t\t\t\t\t\tmxUtils.setOpacity(zoomOutBtn, 60);\n\t\t\t\t\t\t\tmxUtils.setOpacity(zoomFitBtn, 60);\n\t\t\t\t\t\t\tmxUtils.setOpacity(zoomActualBtn, 60);\n\t\t\t\t\t\t\tmxUtils.setOpacity(compareBtn, 60);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tpageSelect.style.display = 'none';\n\t\t\t\t\t\t\tpageSelect.innerHTML = '';\n\t\t\t\t\t\t\tfileInfo.innerHTML = '';\n\t\t\t\t\t\t\tmxUtils.write(fileInfo, mxResources.get('errorLoadingFile'));\n\t\t\t\t\t\t\tmxUtils.write(errorNode, mxResources.get('errorLoadingFile'));\n\t\t\t\t\t\t}\n\t\t\t\t\t};", "label": 0, "label_name": "vulnerable"} -{"code": " public function testAddTags () {\n $contact = $this->contacts ('testAnyone');\n $tags = array ('test', 'test2', 'test3');\n $contact->addTags ($tags);\n $contactTags = $contact->getTags (true);\n $this->assertEquals (\n Tags::normalizeTags ($tags), ArrayUtil::sort ($contactTags));\n // disallow duplicates\n $contact->addTags ($tags);\n $contactTags = $contact->getTags (true);\n $this->assertEquals (\n Tags::normalizeTags ($tags), ArrayUtil::sort ($contactTags));\n // disallow duplicates after normalization\n $tags = array ('te,st', 'test2,', '#test3');\n $contact->addTags ($tags);\n $contactTags = $contact->getTags (true);\n $this->assertEquals (\n Tags::normalizeTags ($tags), ArrayUtil::sort ($contactTags));\n }", "label": 1, "label_name": "safe"} -{"code": " it \"returns a stepped number range given a negative step\" do\n result = scope.function_range([\"1\",\"4\",\"-2\"])\n expect(result).to eq [1,3]\n end", "label": 0, "label_name": "vulnerable"} -{"code": "printone(FILE *out, const char* msg, size_t value)\n{\n int i, k;\n char buf[100];\n size_t origvalue = value;\n\n fputs(msg, out);\n for (i = (int)strlen(msg); i < 35; ++i)\n fputc(' ', out);\n fputc('=', out);\n\n /* Write the value with commas. */\n i = 22;\n buf[i--] = '\\0';\n buf[i--] = '\\n';\n k = 3;\n do {\n size_t nextvalue = value / 10;\n unsigned int digit = (unsigned int)(value - nextvalue * 10);\n value = nextvalue;\n buf[i--] = (char)(digit + '0');\n --k;\n if (k == 0 && value && i >= 0) {\n k = 3;\n buf[i--] = ',';\n }\n } while (value && i >= 0);\n\n while (i >= 0)\n buf[i--] = ' ';\n fputs(buf, out);\n\n return origvalue;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " def test_request_body_too_large_chunked_encoding(self):\n control_line = \"20;\\r\\n\" # 20 hex = 32 dec\n s = \"This string has 32 characters.\\r\\n\"\n to_send = \"GET / HTTP/1.1\\nTransfer-Encoding: chunked\\n\\n\"\n repeat = control_line + s\n to_send += repeat * ((self.toobig // len(repeat)) + 1)\n to_send = tobytes(to_send)\n self.connect()\n self.sock.send(to_send)\n fp = self.sock.makefile(\"rb\", 0)\n line, headers, response_body = read_http(fp)\n # body bytes counter caught a max_request_body_size overrun\n self.assertline(line, \"413\", \"Request Entity Too Large\", \"HTTP/1.1\")\n cl = int(headers[\"content-length\"])\n self.assertEqual(cl, len(response_body))\n self.assertEqual(headers[\"content-type\"], \"text/plain\")\n # connection has been closed\n self.send_check_error(to_send)\n self.assertRaises(ConnectionClosed, read_http, fp)", "label": 0, "label_name": "vulnerable"} -{"code": "l2tp_bearer_type_print(netdissect_options *ndo, const u_char *dat)\n{\n\tconst uint32_t *ptr = (const uint32_t *)dat;\n\n\tif (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_ANALOG_MASK) {\n\t\tND_PRINT((ndo, \"A\"));\n\t}\n\tif (EXTRACT_32BITS(ptr) & L2TP_BEARER_TYPE_DIGITAL_MASK) {\n\t\tND_PRINT((ndo, \"D\"));\n\t}\n}", "label": 0, "label_name": "vulnerable"} -{"code": "static int parse_multipart(\n ogs_sbi_message_t *message, ogs_sbi_http_message_t *http)\n{\n char *boundary = NULL;\n int i;\n\n multipart_parser_settings settings;\n multipart_parser_data_t data;\n\n multipart_parser *parser = NULL;\n\n ogs_assert(message);\n ogs_assert(http);\n\n memset(&settings, 0, sizeof(settings));\n settings.on_header_field = &on_header_field;\n settings.on_header_value = &on_header_value;\n settings.on_part_data = &on_part_data;\n settings.on_part_data_end = &on_part_data_end;\n\n for (i = 0; i < http->content_length; i++) {\n if (http->content[i] == '\\r' && http->content[i+1] == '\\n')\n break;\n }\n\n if (i >= http->content_length) {\n ogs_error(\"Invalid HTTP content [%d]\", i);\n ogs_log_hexdump(OGS_LOG_ERROR,\n (unsigned char *)http->content, http->content_length);\n return OGS_ERROR;\n }\n\n boundary = ogs_strndup(http->content, i);\n ogs_assert(boundary);\n\n parser = multipart_parser_init(boundary, &settings);\n ogs_assert(parser);\n\n memset(&data, 0, sizeof(data));\n multipart_parser_set_data(parser, &data);\n multipart_parser_execute(parser, http->content, http->content_length);\n\n multipart_parser_free(parser);\n ogs_free(boundary);\n\n for (i = 0; i < data.num_of_part; i++) {\n SWITCH(data.part[i].content_type)\n CASE(OGS_SBI_CONTENT_JSON_TYPE)\n parse_json(message,\n data.part[i].content_type, data.part[i].content);\n\n if (data.part[i].content_id)\n ogs_free(data.part[i].content_id);\n if (data.part[i].content_type)\n ogs_free(data.part[i].content_type);\n if (data.part[i].content)\n ogs_free(data.part[i].content);\n\n break;\n\n CASE(OGS_SBI_CONTENT_5GNAS_TYPE)\n CASE(OGS_SBI_CONTENT_NGAP_TYPE)\n http->part[http->num_of_part].content_id =\n data.part[i].content_id;\n http->part[http->num_of_part].content_type =\n data.part[i].content_type;\n http->part[http->num_of_part].pkbuf =\n ogs_pkbuf_alloc(NULL, data.part[i].content_length);\n ogs_expect_or_return_val(\n http->part[http->num_of_part].pkbuf, OGS_ERROR);\n ogs_pkbuf_put_data(http->part[http->num_of_part].pkbuf,\n data.part[i].content, data.part[i].content_length);\n\n message->part[message->num_of_part].content_id =\n http->part[http->num_of_part].content_id;\n message->part[message->num_of_part].content_type =\n http->part[http->num_of_part].content_type;\n message->part[message->num_of_part].pkbuf =\n ogs_pkbuf_copy(http->part[http->num_of_part].pkbuf);\n ogs_expect_or_return_val(\n message->part[message->num_of_part].pkbuf, OGS_ERROR);\n\n http->num_of_part++;\n message->num_of_part++;\n\n if (data.part[i].content)\n ogs_free(data.part[i].content);\n break;\n\n DEFAULT\n ogs_error(\"Unknown content-type[%s]\", data.part[i].content_type);\n END\n }\n\n if (data.part[i].content_id)\n ogs_free(data.part[i].content_id);\n if (data.part[i].content_type)\n ogs_free(data.part[i].content_type);\n\n if (data.header_field)\n ogs_free(data.header_field);\n\n return OGS_OK;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "didset_options2(void)\n{\n // Initialize the highlight_attr[] table.\n (void)highlight_changed();\n\n // Parse default for 'wildmode'\n check_opt_wim();\n\n // Parse default for 'listchars'.\n (void)set_chars_option(curwin, &curwin->w_p_lcs);\n\n // Parse default for 'fillchars'.\n (void)set_chars_option(curwin, &p_fcs);\n\n#ifdef FEAT_CLIPBOARD\n // Parse default for 'clipboard'\n (void)check_clipboard_option();\n#endif\n#ifdef FEAT_VARTABS\n vim_free(curbuf->b_p_vsts_array);\n (void)tabstop_set(curbuf->b_p_vsts, &curbuf->b_p_vsts_array);\n vim_free(curbuf->b_p_vts_array);\n (void)tabstop_set(curbuf->b_p_vts, &curbuf->b_p_vts_array);\n#endif\n}", "label": 1, "label_name": "safe"} -{"code": " def testInputPreprocessExampleWithCodeInjection(self):\n input_examples_str = 'inputs=os.system(\"echo hacked\")'\n with self.assertRaisesRegex(RuntimeError, 'not a valid python literal.'):\n saved_model_cli.preprocess_input_examples_arg_string(input_examples_str)", "label": 1, "label_name": "safe"} -{"code": "func (s *Server) getHandler(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\n\taction := vars[\"action\"]\n\ttoken := vars[\"token\"]\n\tfilename := vars[\"filename\"]\n\n\tmetadata, err := s.CheckMetadata(token, filename, true)\n\n\tif err != nil {\n\t\tlog.Printf(\"Error metadata: %s\", err.Error())\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t\treturn\n\t}\n\n\tcontentType := metadata.ContentType\n\treader, contentLength, err := s.storage.Get(token, filename)\n\tif s.storage.IsNotExist(err) {\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t\treturn\n\t} else if err != nil {\n\t\tlog.Printf(\"%s\", err.Error())\n\t\thttp.Error(w, \"Could not retrieve file.\", 500)\n\t\treturn\n\t}\n\n\tdefer reader.Close()\n\n\tvar disposition string\n\n\tif action == \"inline\" {\n\t\tdisposition = \"inline\"\n\t} else {\n\t\tdisposition = \"attachment\"\n\t}\n\n\tremainingDownloads, remainingDays := metadata.remainingLimitHeaderValues()\n\n\tw.Header().Set(\"Content-Type\", contentType)\n\tw.Header().Set(\"Content-Length\", strconv.FormatUint(contentLength, 10))\n\tw.Header().Set(\"Content-Disposition\", fmt.Sprintf(\"%s; filename=\\\"%s\\\"\", disposition, filename))\n\tw.Header().Set(\"Connection\", \"keep-alive\")\n\tw.Header().Set(\"X-Remaining-Downloads\", remainingDownloads)\n\tw.Header().Set(\"X-Remaining-Days\", remainingDays)\n\n\tif disposition == \"inline\" && strings.Contains(contentType, \"html\") {\n\t\treader = ioutil.NopCloser(bluemonday.UGCPolicy().SanitizeReader(reader))\n\t}\n\n\tif w.Header().Get(\"Range\") == \"\" {\n\t\tif _, err = io.Copy(w, reader); err != nil {\n\t\t\tlog.Printf(\"%s\", err.Error())\n\t\t\thttp.Error(w, \"Error occurred copying to output stream\", 500)\n\t\t\treturn\n\t\t}\n\n\t\treturn\n\t}\n\n\tfile, err := ioutil.TempFile(s.tempPath, \"range-\")\n\tif err != nil {\n\t\tlog.Printf(\"%s\", err.Error())\n\t\thttp.Error(w, \"Error occurred copying to output stream\", 500)\n\t\treturn\n\t}\n\n\tdefer cleanTmpFile(file)\n\n\ttee := io.TeeReader(reader, file)\n\tfor {\n\t\tb := make([]byte, _5M)\n\t\t_, err = tee.Read(b)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"%s\", err.Error())\n\t\t\thttp.Error(w, \"Error occurred copying to output stream\", 500)\n\t\t\treturn\n\t\t}\n\t}\n\n\thttp.ServeContent(w, r, filename, time.Now(), file)\n}", "label": 0, "label_name": "vulnerable"} -{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n expect { scope.function_str2bool([]) }.to( raise_error(Puppet::ParseError))\n end", "label": 0, "label_name": "vulnerable"} -{"code": "SFTPWrapper.prototype.ext_openssh_statvfs = function(path, cb) {\n return this._stream.ext_openssh_statvfs(path, cb);\n};", "label": 0, "label_name": "vulnerable"} -{"code": " def check_both_ways(source):\n ast.parse(source, type_comments=False)\n with self.assertRaises(SyntaxError):\n ast.parse(source, type_comments=True)", "label": 1, "label_name": "safe"} -{"code": " it \"should return true if a float\" do\n result = scope.function_is_float([\"0.12\"])\n expect(result).to(eq(true))\n end", "label": 0, "label_name": "vulnerable"} -{"code": " public function testRemoveTags () {\n $contact = $this->contacts ('testAnyone');\n Yii::app()->db->createCommand (\"\n delete from x2_tags where type='Contacts' and itemId=:id\n \")->execute (array (':id' => $contact->id));\n $tags = array ('test', 'test2', 'test3');\n $contact->addTags ($tags);\n $contact->removeTags ($tags);\n $this->assertEquals (array (), $contact->getTags (true));\n\n $tags = array ('test', 'test2', 'test3');\n $contact->addTags ($tags);\n $tags = array ('t,est', 'test2,');\n $contact->removeTags ($tags);\n $this->assertEquals (array ('#test3'), $contact->getTags (true));\n }", "label": 1, "label_name": "safe"} -{"code": "static unsigned HuffmanTree_makeFromFrequencies(HuffmanTree* tree, const unsigned* frequencies,\n size_t mincodes, size_t numcodes, unsigned maxbitlen)\n{\n unsigned error = 0;\n while(!frequencies[numcodes - 1] && numcodes > mincodes) numcodes--; /*trim zeroes*/\n tree->maxbitlen = maxbitlen;\n tree->numcodes = (unsigned)numcodes; /*number of symbols*/\n tree->lengths = (unsigned*)realloc(tree->lengths, numcodes * sizeof(unsigned));\n if(!tree->lengths) return 83; /*alloc fail*/\n /*initialize all lengths to 0*/\n memset(tree->lengths, 0, numcodes * sizeof(unsigned));\n\n error = lodepng_huffman_code_lengths(tree->lengths, frequencies, numcodes, maxbitlen);\n if(!error) error = HuffmanTree_makeFromLengths2(tree);\n return error;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function __destruct()\n {\n fclose($this->socket);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "horizontalDifference16(unsigned short *ip, int n, int stride, \n\tunsigned short *wp, uint16 *From14)\n{\n register int r1, g1, b1, a1, r2, g2, b2, a2, mask;\n\n/* assumption is unsigned pixel values */\n#undef CLAMP\n#define CLAMP(v) From14[(v) >> 2]\n\n mask = CODE_MASK;\n if (n >= stride) {\n\tif (stride == 3) {\n\t r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);\n\t b2 = wp[2] = CLAMP(ip[2]);\n\t n -= 3;\n\t while (n > 0) {\n\t\tn -= 3;\n\t\twp += 3;\n\t\tip += 3;\n\t\tr1 = CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;\n\t\tg1 = CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;\n\t\tb1 = CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;\n\t }\n\t} else if (stride == 4) {\n\t r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);\n\t b2 = wp[2] = CLAMP(ip[2]); a2 = wp[3] = CLAMP(ip[3]);\n\t n -= 4;\n\t while (n > 0) {\n\t\tn -= 4;\n\t\twp += 4;\n\t\tip += 4;\n\t\tr1 = CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;\n\t\tg1 = CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;\n\t\tb1 = CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;\n\t\ta1 = CLAMP(ip[3]); wp[3] = (uint16)((a1-a2) & mask); a2 = a1;\n\t }\n\t} else {\n REPEAT(stride, wp[0] = CLAMP(ip[0]); wp++; ip++)\n\t n -= stride;\n\t while (n > 0) {\n REPEAT(stride,\n wp[0] = (uint16)((CLAMP(ip[0])-CLAMP(ip[-stride])) & mask);\n wp++; ip++)\n n -= stride;\n }\n\t}\n }\n}", "label": 1, "label_name": "safe"} -{"code": " self::removeLevel($kid->id);\r\n }\r\n }\r", "label": 0, "label_name": "vulnerable"} -{"code": " protected function _extract($path, $arc)\n {\n return false;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public boolean isOriginAllowed(String pOrigin, boolean pIsStrictCheck) {\n return checkRestrictorService(CORS_CHECK,pOrigin,pIsStrictCheck);\n }", "label": 1, "label_name": "safe"} -{"code": "Suite.prototype.addSuite = function(suite){\n suite.parent = this;\n suite.timeout(this.timeout());\n suite.slow(this.slow());\n suite.bail(this.bail());\n this.suites.push(suite);\n this.emit('suite', suite);\n return this;\n};", "label": 0, "label_name": "vulnerable"} -{"code": " def test_jail_instances_should_have_limited_methods\n expected = [\"class\", \"inspect\", \"method_missing\", \"methods\", \"respond_to?\", \"respond_to_missing?\", \"to_jail\", \"to_s\", \"instance_variable_get\"]\n expected.delete('respond_to_missing?') if RUBY_VERSION > '1.9.3' # respond_to_missing? is private in rubies above 1.9.3\n objects.each do |object|\n assert_equal expected.sort, reject_pretty_methods(object.to_jail.methods.map(&:to_s).sort)\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": " function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $v0, $a, $b, $c, $d, $e, $f); }", "label": 1, "label_name": "safe"} -{"code": "CodingReturnValue VP8ComponentDecoder::decode_chunk(UncompressedComponents * const colldata)\n{\n mux_splicer.init(spin_workers_);\n /* cmpc is a global variable with the component count */\n\n\n /* construct 4x4 VP8 blocks to hold 8x8 JPEG blocks */\n if ( thread_state_[0] == nullptr || thread_state_[0]->context_[0].isNil() ) {\n /* first call */\n BlockBasedImagePerChannel framebuffer;\n framebuffer.memset(0);\n for (size_t i = 0; i < framebuffer.size() && int( i ) < colldata->get_num_components(); ++i) {\n framebuffer[i] = &colldata->full_component_write((BlockType)i);\n }\n Sirikata::Array1d, MAX_NUM_THREADS> all_framebuffers;\n for (size_t i = 0; i < all_framebuffers.size(); ++i) {\n all_framebuffers[i] = framebuffer;\n }\n size_t num_threads_needed = initialize_decoder_state(colldata,\n all_framebuffers).size();\n\n\n for (size_t i = 0;i < num_threads_needed; ++i) {\n map_logical_thread_to_physical_thread(i, i);\n }\n for (size_t i = 0;i < num_threads_needed; ++i) {\n initialize_thread_id(i, i, framebuffer);\n if (!do_threading_) {\n break;\n }\n }\n if (num_threads_needed > NUM_THREADS || num_threads_needed == 0) {\n return CODING_ERROR;\n }\n }\n if (do_threading_) {\n for (unsigned int thread_id = 0; thread_id < NUM_THREADS; ++thread_id) {\n unsigned int cur_spin_worker = thread_id;\n spin_workers_[cur_spin_worker].work\n = std::bind(worker_thread,\n thread_state_[thread_id],\n thread_id,\n colldata,\n mux_splicer.thread_target,\n getWorker(cur_spin_worker),\n &send_to_actual_thread_state);\n spin_workers_[cur_spin_worker].activate_work();\n }\n flush();\n for (unsigned int thread_id = 0; thread_id < NUM_THREADS; ++thread_id) {\n unsigned int cur_spin_worker = thread_id;\n TimingHarness::timing[thread_id][TimingHarness::TS_THREAD_WAIT_STARTED] = TimingHarness::get_time_us();\n spin_workers_[cur_spin_worker].main_wait_for_done();\n TimingHarness::timing[thread_id][TimingHarness::TS_THREAD_WAIT_FINISHED] = TimingHarness::get_time_us();\n }\n // join on all threads\n } else {\n if (virtual_thread_id_ != -1) {\n TimingHarness::timing[0][TimingHarness::TS_ARITH_STARTED] = TimingHarness::get_time_us();\n CodingReturnValue ret = thread_state_[0]->vp8_decode_thread(0, colldata);\n if (ret == CODING_PARTIAL) {\n return ret;\n }\n TimingHarness::timing[0][TimingHarness::TS_ARITH_FINISHED] = TimingHarness::get_time_us();\n }\n // wait for \"threads\"\n virtual_thread_id_ += 1; // first time's a charm\n for (unsigned int thread_id = virtual_thread_id_; thread_id < NUM_THREADS; ++thread_id, ++virtual_thread_id_) {\n BlockBasedImagePerChannel framebuffer;\n framebuffer.memset(0);\n for (size_t i = 0; i < framebuffer.size() && int( i ) < colldata->get_num_components(); ++i) {\n framebuffer[i] = &colldata->full_component_write((BlockType)i);\n }\n\n initialize_thread_id(thread_id, 0, framebuffer);\n thread_state_[0]->bool_decoder_.init(new VirtualThreadPacketReader(thread_id, &mux_reader_, &mux_splicer));\n TimingHarness::timing[thread_id][TimingHarness::TS_ARITH_STARTED] = TimingHarness::get_time_us();\n CodingReturnValue ret;\n if ((ret = thread_state_[0]->vp8_decode_thread(0, colldata)) == CODING_PARTIAL) {\n return ret;\n }\n TimingHarness::timing[thread_id][TimingHarness::TS_ARITH_FINISHED] = TimingHarness::get_time_us();\n }\n }\n TimingHarness::timing[0][TimingHarness::TS_JPEG_RECODE_STARTED] = TimingHarness::get_time_us();\n for (int component = 0; component < colldata->get_num_components(); ++component) {\n colldata->worker_mark_cmp_finished((BlockType)component);\n }\n colldata->worker_update_coefficient_position_progress( 64 );\n colldata->worker_update_bit_progress( 16 );\n write_byte_bill(Billing::DELIMITERS, true, mux_reader_.getOverhead());\n return CODING_DONE;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "def server_socket(fun, request_count=1, timeout=5, scheme=\"\", tls=None):\n \"\"\"Base socket server for tests.\n Likely you want to use server_request or other higher level helpers.\n All arguments except fun can be passed to other server_* helpers.\n\n :param fun: fun(client_sock, tick) called after successful accept().\n :param request_count: test succeeds after exactly this number of requests, triggered by tick(request)\n :param timeout: seconds.\n :param scheme: affects yielded value\n \"\" - build normal http/https URI.\n string - build normal URI using supplied scheme.\n None - yield (addr, port) tuple.\n :param tls:\n None (default) - plain HTTP.\n True - HTTPS with reasonable defaults. Likely you want httplib2.Http(ca_certs=tests.CA_CERTS)\n string - path to custom server cert+key PEM file.\n callable - function(context, listener, skip_errors) -> ssl_wrapped_listener\n \"\"\"\n gresult = [None]\n gcounter = [0]\n tls_skip_errors = [\n \"TLSV1_ALERT_UNKNOWN_CA\",\n ]\n\n def tick(request):\n gcounter[0] += 1\n keep = True\n keep &= gcounter[0] < request_count\n if request is not None:\n keep &= request.headers.get(\"connection\", \"\").lower() != \"close\"\n return keep\n\n def server_socket_thread(srv):\n try:\n while gcounter[0] < request_count:\n try:\n client, _ = srv.accept()\n except ssl.SSLError as e:\n if e.reason in tls_skip_errors:\n return\n raise\n\n try:\n client.settimeout(timeout)\n fun(client, tick)\n finally:\n try:\n client.shutdown(socket.SHUT_RDWR)\n except (IOError, socket.error):\n pass\n # FIXME: client.close() introduces connection reset by peer\n # at least in other/connection_close test\n # should not be a problem since socket would close upon garbage collection\n if gcounter[0] > request_count:\n gresult[0] = Exception(\n \"Request count expected={0} actual={1}\".format(\n request_count, gcounter[0]\n )\n )\n except Exception as e:\n # traceback.print_exc caused IOError: concurrent operation on sys.stderr.close() under setup.py test\n print(traceback.format_exc(), file=sys.stderr)\n gresult[0] = e\n\n bind_hostname = \"localhost\"\n server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n server.bind((bind_hostname, 0))\n try:\n server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n except socket.error as ex:\n print(\"non critical error on SO_REUSEADDR\", ex)\n server.listen(10)\n server.settimeout(timeout)\n server_port = server.getsockname()[1]\n if tls is True:\n tls = SERVER_CHAIN\n if tls:\n context = ssl_context()\n if callable(tls):\n context.load_cert_chain(SERVER_CHAIN)\n server = tls(context, server, tls_skip_errors)\n else:\n context.load_cert_chain(tls)\n server = context.wrap_socket(server, server_side=True)\n if scheme == \"\":\n scheme = \"https\" if tls else \"http\"\n\n t = threading.Thread(target=server_socket_thread, args=(server,))\n t.daemon = True\n t.start()\n if scheme is None:\n yield (bind_hostname, server_port)\n else:\n yield u\"{scheme}://{host}:{port}/\".format(scheme=scheme, host=bind_hostname, port=server_port)\n server.close()\n t.join()\n if gresult[0] is not None:\n raise gresult[0]", "label": 0, "label_name": "vulnerable"} -{"code": " private XMSSPrivateKeyParameters(Builder builder)\n {\n super(true);\n params = builder.params;\n if (params == null)\n {\n throw new NullPointerException(\"params == null\");\n }\n int n = params.getDigestSize();\n byte[] privateKey = builder.privateKey;\n if (privateKey != null)\n {\n if (builder.xmss == null)\n {\n throw new NullPointerException(\"xmss == null\");\n }\n /* import */\n int height = params.getHeight();\n int indexSize = 4;\n int secretKeySize = n;\n int secretKeyPRFSize = n;\n int publicSeedSize = n;\n int rootSize = n;\n\t\t\t/*\n\t\t\tint totalSize = indexSize + secretKeySize + secretKeyPRFSize + publicSeedSize + rootSize;\n\t\t\tif (privateKey.length != totalSize) {\n\t\t\t\tthrow new ParseException(\"private key has wrong size\", 0);\n\t\t\t}\n\t\t\t*/\n int position = 0;\n int index = Pack.bigEndianToInt(privateKey, position);\n if (!XMSSUtil.isIndexValid(height, index))\n {\n throw new IllegalArgumentException(\"index out of bounds\");\n }\n position += indexSize;\n secretKeySeed = XMSSUtil.extractBytesAtOffset(privateKey, position, secretKeySize);\n position += secretKeySize;\n secretKeyPRF = XMSSUtil.extractBytesAtOffset(privateKey, position, secretKeyPRFSize);\n position += secretKeyPRFSize;\n publicSeed = XMSSUtil.extractBytesAtOffset(privateKey, position, publicSeedSize);\n position += publicSeedSize;\n root = XMSSUtil.extractBytesAtOffset(privateKey, position, rootSize);\n position += rootSize;\n\t\t\t/* import BDS state */\n byte[] bdsStateBinary = XMSSUtil.extractBytesAtOffset(privateKey, position, privateKey.length - position);\n BDS bdsImport = null;\n try\n {\n bdsImport = (BDS)XMSSUtil.deserialize(bdsStateBinary);\n }\n catch (IOException e)\n {\n e.printStackTrace();\n }\n catch (ClassNotFoundException e)\n {\n e.printStackTrace();\n }\n bdsImport.setXMSS(builder.xmss);\n bdsImport.validate();\n if (bdsImport.getIndex() != index)\n {\n throw new IllegalStateException(\"serialized BDS has wrong index\");\n }\n bdsState = bdsImport;\n }\n else\n {\n\t\t\t/* set */\n byte[] tmpSecretKeySeed = builder.secretKeySeed;\n if (tmpSecretKeySeed != null)\n {\n if (tmpSecretKeySeed.length != n)\n {\n throw new IllegalArgumentException(\"size of secretKeySeed needs to be equal size of digest\");\n }\n secretKeySeed = tmpSecretKeySeed;\n }\n else\n {\n secretKeySeed = new byte[n];\n }\n byte[] tmpSecretKeyPRF = builder.secretKeyPRF;\n if (tmpSecretKeyPRF != null)\n {\n if (tmpSecretKeyPRF.length != n)\n {\n throw new IllegalArgumentException(\"size of secretKeyPRF needs to be equal size of digest\");\n }\n secretKeyPRF = tmpSecretKeyPRF;\n }\n else\n {\n secretKeyPRF = new byte[n];\n }\n byte[] tmpPublicSeed = builder.publicSeed;\n if (tmpPublicSeed != null)\n {\n if (tmpPublicSeed.length != n)\n {\n throw new IllegalArgumentException(\"size of publicSeed needs to be equal size of digest\");\n }\n publicSeed = tmpPublicSeed;\n }\n else\n {\n publicSeed = new byte[n];\n }\n byte[] tmpRoot = builder.root;\n if (tmpRoot != null)\n {\n if (tmpRoot.length != n)\n {\n throw new IllegalArgumentException(\"size of root needs to be equal size of digest\");\n }\n root = tmpRoot;\n }\n else\n {\n root = new byte[n];\n }\n BDS tmpBDSState = builder.bdsState;\n if (tmpBDSState != null)\n {\n bdsState = tmpBDSState;\n }\n else\n {\n if (builder.index < ((1 << params.getHeight()) - 2) && tmpPublicSeed != null && tmpSecretKeySeed != null)\n {\n bdsState = new BDS(params, tmpPublicSeed, tmpSecretKeySeed, (OTSHashAddress)new OTSHashAddress.Builder().build(), builder.index);\n }\n else\n {\n bdsState = new BDS(params, builder.index);\n }\n }\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function testSerialize()\n {\n $config = HTMLPurifier_Config::createDefault();\n $config->set('HTML.Allowed', 'a');\n $config2 = unserialize($config->serialize());\n $this->assertIdentical($config->get('HTML.Allowed'), $config2->get('HTML.Allowed'));\n }", "label": 1, "label_name": "safe"} -{"code": "getSecretShares(const string &_polyName, const char *_encryptedPolyHex, const vector &_publicKeys,\n int _t,\n int _n) {\n\n CHECK_STATE(_encryptedPolyHex);\n\n vector hexEncrKey(BUF_LEN, 0);\n vector errMsg1(BUF_LEN, 0);\n vector encrDKGPoly(BUF_LEN, 0);\n int errStatus = 0;\n uint64_t encLen = 0;\n\n\n\n if (!hex2carray(_encryptedPolyHex, &encLen, encrDKGPoly.data(), BUF_LEN)) {\n throw SGXException(INVALID_HEX, \"Invalid encryptedPolyHex\");\n }\n\n sgx_status_t status = trustedSetEncryptedDkgPolyAES(eid, &errStatus, errMsg1.data(), encrDKGPoly.data(), encLen);\n HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus, errMsg1.data());\n\n string result;\n\n for (int i = 0; i < _n; i++) {\n vector encryptedSkey(BUF_LEN, 0);\n uint32_t decLen;\n vector currentShare(193, 0);\n vector sShareG2(320, 0);\n\n string pub_keyB = _publicKeys.at(i);\n vector pubKeyB(129, 0);\n\n strncpy(pubKeyB.data(), pub_keyB.c_str(), 128);\n pubKeyB.at(128) = 0;\n\n spdlog::debug(\"pubKeyB is {}\", pub_keyB);\n\n sgx_status_t status = trustedGetEncryptedSecretShareAES(eid, &errStatus, errMsg1.data(), encryptedSkey.data(), &decLen,\n currentShare.data(), sShareG2.data(), pubKeyB.data(), _t, _n, i + 1);\n HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus, errMsg1.data());\n\n spdlog::debug(\"cur_share is {}\", currentShare.data());\n\n result += string(currentShare.data());\n\n spdlog::debug(\"dec len is {}\", decLen);\n carray2Hex(encryptedSkey.data(), decLen, hexEncrKey.data(), BUF_LEN);\n string dhKeyName = \"DKG_DH_KEY_\" + _polyName + \"_\" + to_string(i) + \":\";\n\n spdlog::debug(\"hexEncr DH Key: { }\", hexEncrKey.data());\n spdlog::debug(\"name to write to db is {}\", dhKeyName);\n SGXWalletServer::writeDataToDB(dhKeyName, hexEncrKey.data());\n\n string shareG2_name = \"shareG2_\" + _polyName + \"_\" + to_string(i) + \":\";\n spdlog::debug(\"name to write to db is {}\", shareG2_name);\n spdlog::debug(\"s_shareG2: {}\", sShareG2.data());\n\n SGXWalletServer::writeDataToDB(shareG2_name, sShareG2.data());\n\n\n }\n\n return result;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " foreach ($usr as $u) {\r\n # code...\r\n $msgs = str_replace('{{userid}}', $u->userid, $msg);\r\n $vars = array(\r\n 'to' => $u->email,\r\n 'to_name' => $u->userid,\r\n 'message' => $msgs,\r\n 'subject' => $subject,\r\n 'msgtype' => $_POST['type']\r\n );\r\n $mailsend = Mail::send($vars);\r\n if ($mailsend !== null) {\r\n $alermailsend[] = $mailsend;\r\n }\r\n sleep(3);\r\n }\r", "label": 1, "label_name": "safe"} -{"code": " $this->set($namespace .'.'. $directive, $value2);\n }\n }\n }\n }", "label": 1, "label_name": "safe"} -{"code": " protected string EscapeName(string name)\n {\n return SqlFormatProvider().Escape(name);\n }", "label": 0, "label_name": "vulnerable"} -{"code": " it \"should exist\" do\n expect(Puppet::Parser::Functions.function(\"base64\")).to eq(\"function_base64\")\n end", "label": 0, "label_name": "vulnerable"} -{"code": " private function set_environment($environment)\n {\n $environment = !empty($environment) ? (array) $environment : array();\n $path = (isset($environment['path']) && !is_empty_string($environment['path'])) ? $environment['path'] : $this->home_directory;\n\n if (!is_empty_string($path)) {\n if (is_dir($path)) {\n if (!@chdir($path)) { return array('output' => \"Unable to change directory to current working directory, updating current directory\",\n 'environment' => $this->get_environment());\n }\n }\n else { return array('output' => \"Current working directory not found, updating current directory\",\n 'environment' => $this->get_environment());\n }\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": " data: {config_calibre_dir: $(\"#config_calibre_dir\").val(), csrf_token: $(\"input[name='csrf_token']\").val()},\n success: function success(data) {\n if ( data.change ) {\n if ( data.valid ) {\n confirmDialog(\n \"db_submit\",\n \"GeneralChangeModal\",\n 0,\n changeDbSettings\n );\n }\n else {\n $(\"#InvalidDialog\").modal('show');\n }\n } else { \t\n changeDbSettings();\n }\n }\n });\n });", "label": 0, "label_name": "vulnerable"} -{"code": "void traverse_commit_list(struct rev_info *revs,\n\t\t\t show_commit_fn show_commit,\n\t\t\t show_object_fn show_object,\n\t\t\t void *data)\n{\n\tint i;\n\tstruct commit *commit;\n\tstruct strbuf base;\n\n\tstrbuf_init(&base, PATH_MAX);\n\twhile ((commit = get_revision(revs)) != NULL) {\n\t\t/*\n\t\t * an uninteresting boundary commit may not have its tree\n\t\t * parsed yet, but we are not going to show them anyway\n\t\t */\n\t\tif (commit->tree)\n\t\t\tadd_pending_tree(revs, commit->tree);\n\t\tshow_commit(commit, data);\n\t}\n\tfor (i = 0; i < revs->pending.nr; i++) {\n\t\tstruct object_array_entry *pending = revs->pending.objects + i;\n\t\tstruct object *obj = pending->item;\n\t\tconst char *name = pending->name;\n\t\tconst char *path = pending->path;\n\t\tif (obj->flags & (UNINTERESTING | SEEN))\n\t\t\tcontinue;\n\t\tif (obj->type == OBJ_TAG) {\n\t\t\tobj->flags |= SEEN;\n\t\t\tshow_object(obj, name, data);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!path)\n\t\t\tpath = \"\";\n\t\tif (obj->type == OBJ_TREE) {\n\t\t\tprocess_tree(revs, (struct tree *)obj, show_object,\n\t\t\t\t &base, path, data);\n\t\t\tcontinue;\n\t\t}\n\t\tif (obj->type == OBJ_BLOB) {\n\t\t\tprocess_blob(revs, (struct blob *)obj, show_object,\n\t\t\t\t &base, path, data);\n\t\t\tcontinue;\n\t\t}\n\t\tdie(\"unknown pending object %s (%s)\",\n\t\t oid_to_hex(&obj->oid), name);\n\t}\n\tobject_array_clear(&revs->pending);\n\tstrbuf_release(&base);\n}", "label": 1, "label_name": "safe"} -{"code": " public function setUp()\n {\n $this->request = new UpdateCardRequest($this->getHttpClient(), $this->getHttpRequest());\n $this->request->setCustomerReference('cus_1MZSEtqSghKx99');\n $this->request->setCardReference('card_15Wg7vIobxWFFmzdvC5fVY67');\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic function setLoggerChannel($channel = 'Organizr', $username = null)\n\t{\n\t\tif ($this->hasDB()) {\n\t\t\t$setLogger = false;\n\t\t\tif ($username) {\n\t\t\t\t$username = htmlspecialchars($username);\n\t\t\t}\n\t\t\tif ($this->logger) {\n\t\t\t\tif ($channel) {\n\t\t\t\t\tif (strtolower($this->logger->getChannel()) !== strtolower($channel)) {\n\t\t\t\t\t\t$setLogger = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ($username) {\n\t\t\t\t\tif (strtolower($this->logger->getTraceId()) !== strtolower($channel)) {\n\t\t\t\t\t\t$setLogger = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$setLogger = true;\n\t\t\t}\n\t\t\tif ($setLogger) {\n\t\t\t\t$channel = $channel ?: 'Organizr';\n\t\t\t\treturn $this->setupLogger($channel, $username);\n\t\t\t} else {\n\t\t\t\treturn $this->logger;\n\t\t\t}\n\t\t}\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": " private function getInlineStrategy($called = false)\n {\n $inline = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Fragment\\InlineFragmentRenderer')->disableOriginalConstructor()->getMock();\n\n if ($called) {\n $inline->expects($this->once())->method('render');\n }\n\n return $inline;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function isBooted()\n {\n return $this->booted;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "void ipc_rcu_putref(void *ptr)\n{\n\tif (!atomic_dec_and_test(&container_of(ptr, struct ipc_rcu_hdr, data)->refcount))\n\t\treturn;\n\n\tif (container_of(ptr, struct ipc_rcu_hdr, data)->is_vmalloc) {\n\t\tcall_rcu(&container_of(ptr, struct ipc_rcu_grace, data)->rcu,\n\t\t\t\tipc_schedule_free);\n\t} else {\n\t\tkfree_rcu(container_of(ptr, struct ipc_rcu_grace, data), rcu);\n\t}\n}", "label": 1, "label_name": "safe"} -{"code": "b,c,d,e){var f;if(a){a=a.toLowerCase();b&&(f=this.icons[a+\"-rtl\"]);f||(f=this.icons[a])}a=c||f&&f.path||\"\";d=d||f&&f.offset;e=e||f&&f.bgsize||\"16px\";return a&&\"background-image:url(\"+CKEDITOR.getUrl(a)+\");background-position:0 \"+d+\"px;background-size:\"+e+\";\"}};CKEDITOR.tools.extend(CKEDITOR.editor.prototype,{getUiColor:function(){return this.uiColor},setUiColor:function(a){var b=c(CKEDITOR.document);return(this.setUiColor=function(a){var c=CKEDITOR.skin.chameleon,e=[[j,a]];this.uiColor=a;d([b],c(this,\n\"editor\"),e);d(m,c(this,\"panel\"),e)}).call(this,a)}});var h=\"cke_ui_color\",m=[],j=/\\$color/g;CKEDITOR.on(\"instanceLoaded\",function(a){if(!CKEDITOR.env.ie||!CKEDITOR.env.quirks){var b=a.editor,a=function(a){a=(a.data[0]||a.data).element.getElementsByTag(\"iframe\").getItem(0).getFrameDocument();if(!a.getById(\"cke_ui_color\")){a=c(a);m.push(a);var e=b.getUiColor();e&&d([a],CKEDITOR.skin.chameleon(b,\"panel\"),[[j,e]])}};b.on(\"panelShow\",a);b.on(\"menuShow\",a);b.config.uiColor&&b.setUiColor(b.config.uiColor)}})})();", "label": 1, "label_name": "safe"} -{"code": " public function manage_sitemap() {\n global $db, $user, $sectionObj, $sections;\n\n expHistory::set('viewable', $this->params);\n $id = $sectionObj->id;\n $current = null;\n // all we need to do is determine the current section\n $navsections = $sections;\n if ($sectionObj->parent == -1) {\n $current = $sectionObj;\n } else {\n foreach ($navsections as $section) {\n if ($section->id == $id) {\n $current = $section;\n break;\n }\n }\n }\n assign_to_template(array(\n 'sasections' => $db->selectObjects('section', 'parent=-1'),\n 'sections' => $navsections,\n 'current' => $current,\n 'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0),\n ));\n }", "label": 1, "label_name": "safe"} -{"code": "static int ras_getdatastd(jas_stream_t *in, ras_hdr_t *hdr, ras_cmap_t *cmap,\n jas_image_t *image)\n{\n\tint pad;\n\tint nz;\n\tint z;\n\tint c;\n\tint y;\n\tint x;\n\tint v;\n\tint i;\n\tjas_matrix_t *data[3];\n\n/* Note: This function does not properly handle images with a colormap. */\n\t/* Avoid compiler warnings about unused parameters. */\n\tcmap = 0;\n\n\tfor (i = 0; i < jas_image_numcmpts(image); ++i) {\n\t\tdata[i] = jas_matrix_create(1, jas_image_width(image));\n\t\tassert(data[i]);\n\t}\n\n\tpad = RAS_ROWSIZE(hdr) - (hdr->width * hdr->depth + 7) / 8;\n\n\tfor (y = 0; y < hdr->height; y++) {\n\t\tnz = 0;\n\t\tz = 0;\n\t\tfor (x = 0; x < hdr->width; x++) {\n\t\t\twhile (nz < hdr->depth) {\n\t\t\t\tif ((c = jas_stream_getc(in)) == EOF) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tz = (z << 8) | c;\n\t\t\t\tnz += 8;\n\t\t\t}\n\n\t\t\tv = (z >> (nz - hdr->depth)) & RAS_ONES(hdr->depth);\n\t\t\tz &= RAS_ONES(nz - hdr->depth);\n\t\t\tnz -= hdr->depth;\n\n\t\t\tif (jas_image_numcmpts(image) == 3) {\n\t\t\t\tjas_matrix_setv(data[0], x, (RAS_GETRED(v)));\n\t\t\t\tjas_matrix_setv(data[1], x, (RAS_GETGREEN(v)));\n\t\t\t\tjas_matrix_setv(data[2], x, (RAS_GETBLUE(v)));\n\t\t\t} else {\n\t\t\t\tjas_matrix_setv(data[0], x, (v));\n\t\t\t}\n\t\t}\n\t\tif (pad) {\n\t\t\tif ((c = jas_stream_getc(in)) == EOF) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t\tfor (i = 0; i < jas_image_numcmpts(image); ++i) {\n\t\t\tif (jas_image_writecmpt(image, i, 0, y, hdr->width, 1,\n\t\t\t data[i])) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (i = 0; i < jas_image_numcmpts(image); ++i) {\n\t\tjas_matrix_destroy(data[i]);\n\t}\n\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "0;N>>8;return u};Editor.crc32=function(u){for(var D=-1,K=0;K>>8^Editor.crcTable[(D^u.charCodeAt(K))&255];return(D^-1)>>>0};Editor.writeGraphModelToPng=function(u,D,K,T,N){function Q(Z,fa){var aa=ba;ba+=fa;return Z.substring(aa,ba)}function R(Z){Z=Q(Z,4);return Z.charCodeAt(3)+(Z.charCodeAt(2)<<8)+(Z.charCodeAt(1)<<16)+(Z.charCodeAt(0)<<24)}function Y(Z){return String.fromCharCode(Z>>24&255,Z>>16&255,Z>>8&255,Z&255)}u=u.substring(u.indexOf(\",\")+", "label": 1, "label_name": "safe"} -{"code": " it 'should return the right response' do\n email_token.update!(created_at: 999.years.ago)\n\n post \"/session/email-login/#{email_token.token}.json\"\n\n expect(response.status).to eq(200)\n\n expect(JSON.parse(response.body)[\"error\"]).to eq(\n I18n.t('email_login.invalid_token')\n )\n end", "label": 1, "label_name": "safe"} -{"code": "function add (args, where, cb) {\n // this is hot code. almost everything passes through here.\n // the args can be any of:\n // ['url']\n // ['pkg', 'version']\n // ['pkg@version']\n // ['pkg', 'url']\n // This is tricky, because urls can contain @\n // Also, in some cases we get [name, null] rather\n // that just a single argument.\n\n var usage = 'Usage:\\n' +\n ' npm cache add \\n' +\n ' npm cache add @\\n' +\n ' npm cache add \\n' +\n ' npm cache add \\n'\n var spec\n\n log.silly('cache add', 'args', args)\n\n if (args[1] === undefined) args[1] = null\n\n // at this point the args length must ==2\n if (args[1] !== null) {\n spec = args[0] + '@' + args[1]\n } else if (args.length === 2) {\n spec = args[0]\n }\n\n log.verbose('cache add', 'spec', spec)\n\n if (!spec) return cb(usage)\n\n adding++\n cb = afterAdd(cb)\n\n realizePackageSpecifier(spec, where, function (err, p) {\n if (err) return cb(err)\n\n log.silly('cache add', 'parsed spec', p)\n\n switch (p.type) {\n case 'local':\n case 'directory':\n addLocal(p, null, cb)\n break\n case 'remote':\n // get auth, if possible\n mapToRegistry(spec, npm.config, function (err, uri, auth) {\n if (err) return cb(err)\n\n addRemoteTarball(p.spec, { name: p.name }, null, auth, cb)\n })\n break\n case 'git':\n case 'hosted':\n addRemoteGit(p.rawSpec, cb)\n break\n default:\n if (p.name) return addNamed(p.name, p.spec, null, cb)\n\n cb(new Error(\"couldn't figure out how to install \" + spec))\n }\n })\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function rewind()\n {\n $this->doSleep = true;\n parent::rewind();\n }", "label": 0, "label_name": "vulnerable"} -{"code": "read_SubStreamsInfo(struct archive_read *a, struct _7z_substream_info *ss,\n struct _7z_folder *f, size_t numFolders)\n{\n\tconst unsigned char *p;\n\tuint64_t *usizes;\n\tsize_t unpack_streams;\n\tint type;\n\tunsigned i;\n\tuint32_t numDigests;\n\n\tmemset(ss, 0, sizeof(*ss));\n\n\tfor (i = 0; i < numFolders; i++)\n\t\tf[i].numUnpackStreams = 1;\n\n\tif ((p = header_bytes(a, 1)) == NULL)\n\t\treturn (-1);\n\ttype = *p;\n\n\tif (type == kNumUnPackStream) {\n\t\tunpack_streams = 0;\n\t\tfor (i = 0; i < numFolders; i++) {\n\t\t\tif (parse_7zip_uint64(a, &(f[i].numUnpackStreams)) < 0)\n\t\t\t\treturn (-1);\n\t\t\tif (UMAX_ENTRY < f[i].numUnpackStreams)\n\t\t\t\treturn (-1);\n\t\t\tif (unpack_streams > SIZE_MAX - UMAX_ENTRY) {\n\t\t\t\treturn (-1);\n\t\t\t}\n\t\t\tunpack_streams += (size_t)f[i].numUnpackStreams;\n\t\t}\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t} else\n\t\tunpack_streams = numFolders;\n\n\tss->unpack_streams = unpack_streams;\n\tif (unpack_streams) {\n\t\tss->unpackSizes = calloc(unpack_streams,\n\t\t sizeof(*ss->unpackSizes));\n\t\tss->digestsDefined = calloc(unpack_streams,\n\t\t sizeof(*ss->digestsDefined));\n\t\tss->digests = calloc(unpack_streams,\n\t\t sizeof(*ss->digests));\n\t\tif (ss->unpackSizes == NULL || ss->digestsDefined == NULL ||\n\t\t ss->digests == NULL)\n\t\t\treturn (-1);\n\t}\n\n\tusizes = ss->unpackSizes;\n\tfor (i = 0; i < numFolders; i++) {\n\t\tunsigned pack;\n\t\tuint64_t sum;\n\n\t\tif (f[i].numUnpackStreams == 0)\n\t\t\tcontinue;\n\n\t\tsum = 0;\n\t\tif (type == kSize) {\n\t\t\tfor (pack = 1; pack < f[i].numUnpackStreams; pack++) {\n\t\t\t\tif (parse_7zip_uint64(a, usizes) < 0)\n\t\t\t\t\treturn (-1);\n\t\t\t\tsum += *usizes++;\n\t\t\t}\n\t\t}\n\t\t*usizes++ = folder_uncompressed_size(&f[i]) - sum;\n\t}\n\n\tif (type == kSize) {\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t}\n\n\tfor (i = 0; i < unpack_streams; i++) {\n\t\tss->digestsDefined[i] = 0;\n\t\tss->digests[i] = 0;\n\t}\n\n\tnumDigests = 0;\n\tfor (i = 0; i < numFolders; i++) {\n\t\tif (f[i].numUnpackStreams != 1 || !f[i].digest_defined)\n\t\t\tnumDigests += (uint32_t)f[i].numUnpackStreams;\n\t}\n\n\tif (type == kCRC) {\n\t\tstruct _7z_digests tmpDigests;\n\t\tunsigned char *digestsDefined = ss->digestsDefined;\n\t\tuint32_t * digests = ss->digests;\n\t\tint di = 0;\n\n\t\tmemset(&tmpDigests, 0, sizeof(tmpDigests));\n\t\tif (read_Digests(a, &(tmpDigests), numDigests) < 0) {\n\t\t\tfree_Digest(&tmpDigests);\n\t\t\treturn (-1);\n\t\t}\n\t\tfor (i = 0; i < numFolders; i++) {\n\t\t\tif (f[i].numUnpackStreams == 1 && f[i].digest_defined) {\n\t\t\t\t*digestsDefined++ = 1;\n\t\t\t\t*digests++ = f[i].digest;\n\t\t\t} else {\n\t\t\t\tunsigned j;\n\n\t\t\t\tfor (j = 0; j < f[i].numUnpackStreams;\n\t\t\t\t j++, di++) {\n\t\t\t\t\t*digestsDefined++ =\n\t\t\t\t\t tmpDigests.defineds[di];\n\t\t\t\t\t*digests++ =\n\t\t\t\t\t tmpDigests.digests[di];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfree_Digest(&tmpDigests);\n\t\tif ((p = header_bytes(a, 1)) == NULL)\n\t\t\treturn (-1);\n\t\ttype = *p;\n\t}\n\n\t/*\n\t * Must be kEnd.\n\t */\n\tif (type != kEnd)\n\t\treturn (-1);\n\treturn (0);\n}", "label": 1, "label_name": "safe"} -{"code": " function render_menu_page() \r\n {\r\n echo '
';\r\n echo '

'.__('Blacklist Manager','all-in-one-wp-security-and-firewall').'

';//Interface title\r\n $this->set_menu_tabs();\r\n $tab = $this->get_current_tab();\r\n $this->render_menu_tabs();\r\n ?> \r\n
\r\n menu_tabs);\r\n call_user_func(array(&$this, $this->menu_tabs_handler[$tab]));\r\n ?>\r\n
\r\n
\r\n self,\n :user => user,\n :role => role )\n end", "label": 1, "label_name": "safe"} -{"code": "error_t tcpCheckSeqNum(Socket *socket, TcpHeader *segment, size_t length)\n{\n //Acceptability test for an incoming segment\n bool_t acceptable = FALSE;\n\n //Case where both segment length and receive window are zero\n if(!length && !socket->rcvWnd)\n {\n //Make sure that SEG.SEQ = RCV.NXT\n if(segment->seqNum == socket->rcvNxt)\n {\n acceptable = TRUE;\n }\n }\n //Case where segment length is zero and receive window is non zero\n else if(!length && socket->rcvWnd)\n {\n //Make sure that RCV.NXT <= SEG.SEQ < RCV.NXT+RCV.WND\n if(TCP_CMP_SEQ(segment->seqNum, socket->rcvNxt) >= 0 &&\n TCP_CMP_SEQ(segment->seqNum, socket->rcvNxt + socket->rcvWnd) < 0)\n {\n acceptable = TRUE;\n }\n }\n //Case where both segment length and receive window are non zero\n else if(length && socket->rcvWnd)\n {\n //Check whether RCV.NXT <= SEG.SEQ < RCV.NXT+RCV.WND\n if(TCP_CMP_SEQ(segment->seqNum, socket->rcvNxt) >= 0 &&\n TCP_CMP_SEQ(segment->seqNum, socket->rcvNxt + socket->rcvWnd) < 0)\n {\n acceptable = TRUE;\n }\n //or RCV.NXT <= SEG.SEQ+SEG.LEN-1 < RCV.NXT+RCV.WND\n else if(TCP_CMP_SEQ(segment->seqNum + length - 1, socket->rcvNxt) >= 0 &&\n TCP_CMP_SEQ(segment->seqNum + length - 1, socket->rcvNxt + socket->rcvWnd) < 0)\n {\n acceptable = TRUE;\n }\n }\n\n //Non acceptable sequence number?\n if(!acceptable)\n {\n //Debug message\n TRACE_WARNING(\"Sequence number is not acceptable!\\r\\n\");\n\n //If an incoming segment is not acceptable, an acknowledgment\n //should be sent in reply (unless the RST bit is set)\n if(!(segment->flags & TCP_FLAG_RST))\n tcpSendSegment(socket, TCP_FLAG_ACK, socket->sndNxt, socket->rcvNxt, 0, FALSE);\n\n //Return status code\n return ERROR_FAILURE;\n }\n\n //Sequence number is acceptable\n return NO_ERROR;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic function upload($_files , $file_key , $uid , $item_id = 0 , $page_id = 0 ){\n\t\t$uploadFile = $_files[$file_key] ;\n\n\t\tif( !$this->isAllowedFilename($_files[$file_key]['name']) ){\n\t\t\treturn false;\n\t\t}\n\n\t\t$oss_open = D(\"Options\")->get(\"oss_open\" ) ;\n\t\tif ($oss_open) {\n\t\t\t\t$url = $this->uploadOss($uploadFile);\n\t\t\t\tif ($url) {\n\t\t\t\t\t\t$sign = md5($url.time().rand()) ;\n\t\t\t\t\t\t$insert = array(\n\t\t\t\t\t\t\"sign\" => $sign,\n\t\t\t\t\t\t\"uid\" => $uid,\n\t\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\t\"display_name\" => $uploadFile['name'],\n\t\t\t\t\t\t\"file_type\" => $uploadFile['type'],\n\t\t\t\t\t\t\"file_size\" => $uploadFile['size'],\n\t\t\t\t\t\t\"real_url\" => $url,\n\t\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\t$file_id = D(\"UploadFile\")->add($insert);\n\t\t\t\t\t\t$insert = array(\n\t\t\t\t\t\t\t\"file_id\" => $file_id,\n\t\t\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t$ret = D(\"FilePage\")->add($insert);\n\t\t\t\t\t\t$url = server_url(\"api/attachment/visitFile\",array(\"sign\" => $sign)); \n\t\t\t\t\t return $url ;\n\t\t\t\t}\n\t\t}else{\n\t\t\t$upload = new \\Think\\Upload();// \u5b9e\u4f8b\u5316\u4e0a\u4f20\u7c7b\n\t\t\t$upload->maxSize = 1003145728 ;// \u8bbe\u7f6e\u9644\u4ef6\u4e0a\u4f20\u5927\u5c0f\n\t\t\t$upload->rootPath = './../Public/Uploads/';// \u8bbe\u7f6e\u9644\u4ef6\u4e0a\u4f20\u76ee\u5f55\n\t\t\t$upload->savePath = '';// \u8bbe\u7f6e\u9644\u4ef6\u4e0a\u4f20\u5b50\u76ee\u5f55\n\t\t\t$info = $upload->uploadOne($uploadFile) ;\n\t\t\tif(!$info) {// \u4e0a\u4f20\u9519\u8bef\u63d0\u793a\u9519\u8bef\u4fe1\u606f\n\t\t\t\tvar_dump($upload->getError());\n\t\t\t\treturn;\n\t\t\t}else{// \u4e0a\u4f20\u6210\u529f \u83b7\u53d6\u4e0a\u4f20\u6587\u4ef6\u4fe1\u606f\n\t\t\t\t$url = site_url().'/Public/Uploads/'.$info['savepath'].$info['savename'] ;\n\t\t\t\t$sign = md5($url.time().rand()) ;\n\t\t\t\t$insert = array(\n\t\t\t\t\t\"sign\" => $sign,\n\t\t\t\t\t\"uid\" => $uid,\n\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\"display_name\" => $uploadFile['name'],\n\t\t\t\t\t\"file_type\" => $uploadFile['type'],\n\t\t\t\t\t\"file_size\" => $uploadFile['size'],\n\t\t\t\t\t\"real_url\" => $url,\n\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t);\n\t\t\t\t\t$file_id = D(\"UploadFile\")->add($insert);\n\t\t\t\t\t$insert = array(\n\t\t\t\t\t\t\"file_id\" => $file_id,\n\t\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t\t);\n\t\t\t\t\t$ret = D(\"FilePage\")->add($insert);\n\t\t\t\t$url = server_url(\"api/attachment/visitFile\",array(\"sign\" => $sign));\n\t\t\t\treturn $url ;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": "DNSInfo DNSRequest::ResultIsReady(DNSHeader &header, unsigned length)\n{\n\tunsigned i = 0, o;\n\tint q = 0;\n\tint curanswer;\n\tResourceRecord rr;\n \tunsigned short ptr;\n\n\t/* This is just to keep _FORTIFY_SOURCE happy */\n\trr.type = DNS_QUERY_NONE;\n\trr.rdlength = 0;\n\trr.ttl = 1;\t/* GCC is a whiney bastard -- see the XXX below. */\n\trr.rr_class = 0; /* Same for VC++ */\n\n\tif (!(header.flags1 & FLAGS_MASK_QR))\n\t\treturn std::make_pair((unsigned char*)NULL,\"Not a query result\");\n\n\tif (header.flags1 & FLAGS_MASK_OPCODE)\n\t\treturn std::make_pair((unsigned char*)NULL,\"Unexpected value in DNS reply packet\");\n\n\tif (header.flags2 & FLAGS_MASK_RCODE)\n\t\treturn std::make_pair((unsigned char*)NULL,\"Domain name not found\");\n\n\tif (header.ancount < 1)\n\t\treturn std::make_pair((unsigned char*)NULL,\"No resource records returned\");\n\n\t/* Subtract the length of the header from the length of the packet */\n\tlength -= 12;\n\n\twhile ((unsigned int)q < header.qdcount && i < length)\n\t{\n\t\tif (header.payload[i] > 63)\n\t\t{\n\t\t\ti += 6;\n\t\t\tq++;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (header.payload[i] == 0)\n\t\t\t{\n\t\t\t\tq++;\n\t\t\t\ti += 5;\n\t\t\t}\n\t\t\telse i += header.payload[i] + 1;\n\t\t}\n\t}\n\tcuranswer = 0;\n\twhile ((unsigned)curanswer < header.ancount)\n\t{\n\t\tq = 0;\n\t\twhile (q == 0 && i < length)\n\t\t{\n\t\t\tif (header.payload[i] > 63)\n\t\t\t{\n\t\t\t\ti += 2;\n\t\t\t\tq = 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (header.payload[i] == 0)\n\t\t\t\t{\n\t\t\t\t\ti++;\n\t\t\t\t\tq = 1;\n\t\t\t\t}\n\t\t\t\telse i += header.payload[i] + 1; /* skip length and label */\n\t\t\t}\n\t\t}\n\t\tif (static_cast(length - i) < 10)\n\t\t\treturn std::make_pair((unsigned char*)NULL,\"Incorrectly sized DNS reply\");\n\n\t\t/* XXX: We actually initialise 'rr' here including its ttl field */\n\t\tDNS::FillResourceRecord(&rr,&header.payload[i]);\n\n\t\ti += 10;\n\t\tServerInstance->Logs->Log(\"RESOLVER\",DEBUG,\"Resolver: rr.type is %d and this.type is %d rr.class %d this.class %d\", rr.type, this->type, rr.rr_class, this->rr_class);\n\t\tif (rr.type != this->type)\n\t\t{\n\t\t\tcuranswer++;\n\t\t\ti += rr.rdlength;\n\t\t\tcontinue;\n\t\t}\n\t\tif (rr.rr_class != this->rr_class)\n\t\t{\n\t\t\tcuranswer++;\n\t\t\ti += rr.rdlength;\n\t\t\tcontinue;\n\t\t}\n\t\tbreak;\n\t}\n\tif ((unsigned int)curanswer == header.ancount)\n\t\treturn std::make_pair((unsigned char*)NULL,\"No A, AAAA or PTR type answers (\" + ConvToStr(header.ancount) + \" answers)\");\n\n\tif (i + rr.rdlength > (unsigned int)length)\n\t\treturn std::make_pair((unsigned char*)NULL,\"Resource record larger than stated\");\n\n\tif (rr.rdlength > 1023)\n\t\treturn std::make_pair((unsigned char*)NULL,\"Resource record too large\");\n\n\tthis->ttl = rr.ttl;\n\n\tswitch (rr.type)\n\t{\n\t\t/*\n\t\t * CNAME and PTR are compressed. We need to decompress them.\n\t\t */\n\t\tcase DNS_QUERY_CNAME:\n\t\tcase DNS_QUERY_PTR:\n\t\t\to = 0;\n\t\t\tq = 0;\n\t\t\twhile (q == 0 && i < length && o + 256 < 1023)\n\t\t\t{\n\t\t\t\t/* DN label found (byte over 63) */\n\t\t\t\tif (header.payload[i] > 63)\n\t\t\t\t{\n\t\t\t\t\tmemcpy(&ptr,&header.payload[i],2);\n\n\t\t\t\t\ti = ntohs(ptr);\n\n\t\t\t\t\t/* check that highest two bits are set. if not, we've been had */\n\t\t\t\t\tif (!(i & DN_COMP_BITMASK))\n\t\t\t\t\t\treturn std::make_pair((unsigned char *) NULL, \"DN label decompression header is bogus\");\n\n\t\t\t\t\t/* mask away the two highest bits. */\n\t\t\t\t\ti &= ~DN_COMP_BITMASK;\n\n\t\t\t\t\t/* and decrease length by 12 bytes. */\n\t\t\t\t\ti =- 12;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (header.payload[i] == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tq = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tres[o] = 0;\n\t\t\t\t\t\tif (o != 0)\n\t\t\t\t\t\t\tres[o++] = '.';\n\n\t\t\t\t\t\tif (o + header.payload[i] > sizeof(DNSHeader))\n\t\t\t\t\t\t\treturn std::make_pair((unsigned char *) NULL, \"DN label decompression is impossible -- malformed/hostile packet?\");\n\n\t\t\t\t\t\tmemcpy(&res[o], &header.payload[i + 1], header.payload[i]);\n\t\t\t\t\t\to += header.payload[i];\n\t\t\t\t\t\ti += header.payload[i] + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tres[o] = 0;\n\t\tbreak;\n\t\tcase DNS_QUERY_AAAA:\n\t\t\tif (rr.rdlength != sizeof(struct in6_addr))\n\t\t\t\treturn std::make_pair((unsigned char *) NULL, \"rr.rdlength is larger than 16 bytes for an ipv6 entry -- malformed/hostile packet?\");\n\n\t\t\tmemcpy(res,&header.payload[i],rr.rdlength);\n\t\t\tres[rr.rdlength] = 0;\n\t\tbreak;\n\t\tcase DNS_QUERY_A:\n\t\t\tif (rr.rdlength != sizeof(struct in_addr))\n\t\t\t\treturn std::make_pair((unsigned char *) NULL, \"rr.rdlength is larger than 4 bytes for an ipv4 entry -- malformed/hostile packet?\");\n\n\t\t\tmemcpy(res,&header.payload[i],rr.rdlength);\n\t\t\tres[rr.rdlength] = 0;\n\t\tbreak;\n\t\tdefault:\n\t\t\treturn std::make_pair((unsigned char *) NULL, \"don't know how to handle undefined type (\" + ConvToStr(rr.type) + \") -- rejecting\");\n\t\tbreak;\n\t}\n\treturn std::make_pair(res,\"No error\");\n}", "label": 1, "label_name": "safe"} -{"code": " var update_selected_labels = function() {\n var count = 0;\n $(\".ui-selected\", div_all_tags).not(\".filtered\").each(function() {\n var $this = $(this);\n if ($this.hasClass('alltags-tagset')) {\n count += $this.nextUntil(\":not(.alltags-childtag)\").not(\n \".filtered, .ui-selected\").length;\n } else {\n count++;\n }\n });\n $(\"#id_tags_selected\").text(count ? count + \" selected\" : \"\");\n var tagset = get_selected_tagset();\n if (tagset) {\n $(\"#id_selected_tag_set\").html(\n \"Add a new tag in \" +\n tagset.text() + \" tag set and select it immediately:\");\n } else {\n $(\"#id_selected_tag_set\").text(\n \"Add a new tag and select it immediately:\");\n }\n };", "label": 0, "label_name": "vulnerable"} -{"code": "this.menus.addPopupMenuEditItems=function(E,G,P){d.editor.graph.isSelectionEmpty()?B.apply(this,arguments):d.menus.addMenuItems(E,\"delete - cut copy copyAsImage - duplicate\".split(\" \"),null,P)}}d.actions.get(\"print\").funct=function(){d.showDialog((new PrintDialog(d)).container,360,null!=d.pages&&1 'test_sql', 'enforce_sql' => false})\n should contain_exec('test_db-import').with_refreshonly(true)\n end", "label": 0, "label_name": "vulnerable"} -{"code": "p[C]}catch(I){null!=window.console&&console.log(\"Error in vars URL parameter: \"+I)}};Graph.prototype.getExportVariables=function(){return null!=this.globalVars?mxUtils.clone(this.globalVars):{}};var x=Graph.prototype.getGlobalVariable;Graph.prototype.getGlobalVariable=function(p){var C=x.apply(this,arguments);null==C&&null!=this.globalVars&&(C=this.globalVars[p]);return C};Graph.prototype.getDefaultStylesheet=function(){if(null==this.defaultStylesheet){var p=this.themes[\"default-style2\"];this.defaultStylesheet=", "label": 1, "label_name": "safe"} -{"code": " private ServletFileUpload getServletFileUpload() {\n FileItemFactory factory = new DiskFileItemFactory();\n ServletFileUpload upload = new ServletFileUpload( factory );\n upload.setHeaderEncoding( \"UTF-8\" );\n return upload;\n }", "label": 1, "label_name": "safe"} -{"code": "function setupWebSocketProxy (fastify, options) {\n const server = new WebSocket.Server({\n path: options.prefix,\n server: fastify.server,\n ...options.wsServerOptions\n })\n\n fastify.addHook('onClose', (instance, done) => server.close(done))\n\n // To be able to close the HTTP server,\n // all WebSocket clients need to be disconnected.\n // Fastify is missing a pre-close event, or the ability to\n // add a hook before the server.close call. We need to resort\n // to monkeypatching for now.\n const oldClose = fastify.server.close\n fastify.server.close = function (done) {\n for (const client of server.clients) {\n client.close()\n }\n oldClose.call(this, done)\n }\n\n server.on('error', (err) => {\n fastify.log.error(err)\n })\n\n server.on('connection', (source, request) => {\n const url = createWebSocketUrl(options, request)\n\n const target = new WebSocket(url, options.wsClientOptions)\n\n fastify.log.debug({ url: url.href }, 'proxy websocket')\n proxyWebSockets(source, target)\n })\n}", "label": 0, "label_name": "vulnerable"} -{"code": " def __init__(self):\r\n keys = [key for key in list(request.form.keys()) + list(request.files.keys())]\r\n field_infos = [FieldInfo.factory(key) for key in keys if key != \"csrf_token\"]\r\n # important to sort them so they will be in expected order on command line\r\n self.field_infos = list(sorted(field_infos))\r", "label": 1, "label_name": "safe"} -{"code": "function teampass_whitelist() {\n $bdd = teampass_connect();\n\t$apiip_pool = teampass_get_ips();\n\tif (count($apiip_pool) > 0 && array_search($_SERVER['REMOTE_ADDR'], $apiip_pool) === false) {\n\t\trest_error('IPWHITELIST');\n\t}\n}", "label": 1, "label_name": "safe"} -{"code": "function is_proper_view_name( $string )\n{\n if(preg_match(\"/[^a-zA-z0-9_\\-\\ ]/\", $string)){\n return false;\n } else {\n return true;\n }\n}", "label": 1, "label_name": "safe"} -{"code": "\tpublic function load_by_hash($hash)\r\n\t{\r\n\t\tglobal $DB;\r\n\t\tglobal $session;\r\n global $events;\r\n\r\n $ok = $DB->query(\r\n 'SELECT * FROM nv_webusers WHERE cookie_hash = :hash',\r\n 'object',\r\n array(\r\n ':hash' => $hash\r\n )\r\n );\r\n\r\n if($ok)\r\n {\r\n $data = $DB->result();\r\n }\r\n\r\n if(!empty($data))\r\n\t\t{\r\n\t\t\t$this->load_from_resultset($data);\r\n\r\n\t\t\t// check if the user is still allowed to sign in\r\n\t\t\t$blocked = 1;\r\n\t\t\tif( $this->access == 0 ||\r\n ( $this->access == 2 &&\r\n ($this->access_begin==0 || $this->access_begin < time()) &&\r\n ($this->access_end==0 || $this->access_end > time())\r\n )\r\n )\r\n\t\t\t{\r\n\t\t\t\t$blocked = 0;\r\n\t\t\t}\r\n\r\n\t\t\tif($blocked==1)\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t$session['webuser'] = $this->id;\r\n\r\n // maybe this function is called without initializing $events\r\n if(method_exists($events, 'trigger'))\r\n {\r\n $events->trigger(\r\n 'webuser',\r\n 'sign_in',\r\n array(\r\n 'webuser' => $this,\r\n 'by' => 'cookie'\r\n )\r\n );\r\n }\r\n\t\t}\r\n\r\n\t}\r", "label": 1, "label_name": "safe"} -{"code": "perf_event_read_event(struct perf_event *event,\n\t\t\tstruct task_struct *task)\n{\n\tstruct perf_output_handle handle;\n\tstruct perf_sample_data sample;\n\tstruct perf_read_event read_event = {\n\t\t.header = {\n\t\t\t.type = PERF_RECORD_READ,\n\t\t\t.misc = 0,\n\t\t\t.size = sizeof(read_event) + event->read_size,\n\t\t},\n\t\t.pid = perf_event_pid(event, task),\n\t\t.tid = perf_event_tid(event, task),\n\t};\n\tint ret;\n\n\tperf_event_header__init_id(&read_event.header, &sample, event);\n\tret = perf_output_begin(&handle, event, read_event.header.size, 0, 0);\n\tif (ret)\n\t\treturn;\n\n\tperf_output_put(&handle, read_event);\n\tperf_output_read(&handle, event);\n\tperf_event__output_id_sample(event, &handle, &sample);\n\n\tperf_output_end(&handle);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "(window.webpackJsonpLHCReactAPP=window.webpackJsonpLHCReactAPP||[]).push([[7],{481:function(t,e,a){\"use strict\";a.r(e),a.d(e,\"nodeJSChat\",(function(){return d}));var n=a(6),i=a.n(n),s=a(7),c=a.n(s),h=a(2),o=a(5),d=new(function(){function t(){var e=this;i()(this,t),this.socket=null,h.a.eventEmitter.addListener(\"endedChat\",(function(){null!==e.socket&&e.socket.destroy()}))}return c()(t,[{key:\"bootstrap\",value:function(t,e,n){var i=n(),s=i.chatwidget.getIn([\"chatData\",\"id\"]),c=(i.chatwidget.getIn([\"chatData\",\"hash\"]),i.chatwidget.getIn([\"chat_ui\",\"sync_interval\"])),d={hostname:t.hostname,path:t.path,autoReconnectOptions:{initialDelay:5e3,randomness:5e3}};\"\"!=t.port&&(d.port=parseInt(t.port)),1==t.secure&&(d.secure=!0),t.instance_id>0&&t.instance_id;var r=a(490),g=this.socket=r.connect(d),_=null;function l(e){1==e.status?t.instance_id>0?g.publish(\"chat_\"+t.instance_id+\"_\"+s,{op:\"vt\",msg:e.msg}):g.publish(\"chat_\"+s,{op:\"vt\",msg:e.msg}):t.instance_id>0?g.publish(\"chat_\"+t.instance_id+\"_\"+s,{op:\"vts\"}):g.publish(\"chat_\"+s,{op:\"vts\"})}function u(e){t.instance_id>0?g.publish(\"chat_\"+t.instance_id+\"_\"+s,{op:\"vt\",msg:\"\u2709\ufe0f \"+e.msg}):g.publish(\"chat_\"+s,{op:\"vt\",msg:\"\u2709\ufe0f \"+e.msg})}function p(e){t.instance_id>0?g.publish(\"chat_\"+t.instance_id+\"_\"+s,{op:\"vt\",msg:\"\ud83d\udcd5\ufe0f error happened while sending visitor message, please inform your administrator!\"}):g.publish(\"chat_\"+s,{op:\"vt\",msg:\"\ud83d\udcd5\ufe0f error happened while sending visitor message, please inform your administrator!\"})}function m(){if(null!==_)try{_.destroy()}catch(t){}h.a.eventEmitter.removeListener(\"visitorTyping\",l),h.a.eventEmitter.removeListener(\"messageSend\",u),h.a.eventEmitter.removeListener(\"messageSendError\",p),e({type:\"CHAT_UI_UPDATE\",data:{sync_interval:c}}),e({type:\"CHAT_REMOVE_OVERRIDE\",data:\"typing\"})}function w(){(_=t.instance_id>0?g.subscribe(\"chat_\"+t.instance_id+\"_\"+s):g.subscribe(\"chat_\"+s)).on(\"subscribeFail\",(function(t){console.error(\"Failed to subscribe to the sample channel due to error: \"+t)})),_.on(\"subscribe\",(function(){g.publish(t.instance_id>0?\"chat_\"+t.instance_id+\"_\"+s:\"chat_\"+s,{op:\"vi_online\",status:!0})})),_.watch((function(a){if(\"ot\"==a.op)1==a.data.status?e({type:\"chat_status_changed\",data:{text:a.data.ttx}}):e({type:\"chat_status_changed\",data:{text:\"\"}});else if(\"cmsg\"==a.op||\"schange\"==a.op){var i=n();i.chatwidget.hasIn([\"chatData\",\"id\"])&&e(Object(o.d)({chat_id:i.chatwidget.getIn([\"chatData\",\"id\"]),hash:i.chatwidget.getIn([\"chatData\",\"hash\"]),lmgsid:i.chatwidget.getIn([\"chatLiveData\",\"lmsgid\"]),theme:i.chatwidget.get(\"theme\")}))}else if(\"umsg\"==a.op){var s=n();s.chatwidget.hasIn([\"chatData\",\"id\"])&&Object(o.s)({msg_id:a.msid,id:s.chatwidget.getIn([\"chatData\",\"id\"]),hash:s.chatwidget.getIn([\"chatData\",\"hash\"])})(e,n)}else if(\"schange\"==a.op||\"cclose\"==a.op){var c=n();c.chatwidget.hasIn([\"chatData\",\"id\"])&&e(Object(o.b)({chat_id:c.chatwidget.getIn([\"chatData\",\"id\"]),hash:c.chatwidget.getIn([\"chatData\",\"hash\"]),mode:c.chatwidget.get(\"mode\"),theme:c.chatwidget.get(\"theme\")}))}else if(\"vo\"==a.op){var h=n();h.chatwidget.hasIn([\"chatData\",\"id\"])&&g.publish(t.instance_id>0?\"chat_\"+t.instance_id+\"_\"+h.chatwidget.getIn([\"chatData\",\"id\"]):\"chat_\"+h.chatwidget.getIn([\"chatData\",\"id\"]),{op:\"vi_online\",status:!0})}})),h.a.eventEmitter.addListener(\"visitorTyping\",l),h.a.eventEmitter.addListener(\"messageSend\",u),h.a.eventEmitter.addListener(\"messageSendError\",p),e({type:\"CHAT_UI_UPDATE\",data:{sync_interval:1e4}}),e({type:\"CHAT_ADD_OVERRIDE\",data:\"typing\"})}g.on(\"error\",(function(t){console.error(t)})),g.on(\"close\",(function(){m()})),g.on(\"deauthenticate\",(function(){var e=n(),a=e.chatwidget.getIn([\"chatData\",\"id\"]);window.lhcAxios.post(window.lhcChat.base_url+\"nodejshelper/tokenvisitor/\"+a+\"/\"+e.chatwidget.getIn([\"chatData\",\"hash\"]),null,{headers:{\"Content-Type\":\"application/x-www-form-urlencoded\"}}).then((function(e){g.emit(\"login\",{hash:e.data,chanelName:t.instance_id>0?\"chat_\"+t.instance_id+\"_\"+a:\"chat_\"+a},(function(t){t&&(console.log(t),m())}))}))})),g.on(\"connect\",(function(e){if(e.isAuthenticated&&s>0)w();else{var a=n(),i=a.chatwidget.getIn([\"chatData\",\"id\"]);window.lhcAxios.post(window.lhcChat.base_url+\"nodejshelper/tokenvisitor/\"+i+\"/\"+a.chatwidget.getIn([\"chatData\",\"hash\"]),null,{headers:{\"Content-Type\":\"application/x-www-form-urlencoded\"}}).then((function(e){g.emit(\"login\",{hash:e.data,chanelName:t.instance_id>0?\"chat_\"+t.instance_id+\"_\"+i:\"chat_\"+i},(function(t){t?(console.log(t),g.destroy()):w()}))}))}}))}}]),t}())}}]);", "label": 0, "label_name": "vulnerable"} -{"code": "static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg)\n{\n\tstruct crypto_report_cipher rcipher;\n\n\tstrncpy(rcipher.type, \"cipher\", sizeof(rcipher.type));\n\n\trcipher.blocksize = alg->cra_blocksize;\n\trcipher.min_keysize = alg->cra_cipher.cia_min_keysize;\n\trcipher.max_keysize = alg->cra_cipher.cia_max_keysize;\n\n\tif (nla_put(skb, CRYPTOCFGA_REPORT_CIPHER,\n\t\t sizeof(struct crypto_report_cipher), &rcipher))\n\t\tgoto nla_put_failure;\n\treturn 0;\n\nnla_put_failure:\n\treturn -EMSGSIZE;\n}", "label": 1, "label_name": "safe"} -{"code": "void libxsmm_sparse_csr_reader( libxsmm_generated_code* io_generated_code,\n const char* i_csr_file_in,\n unsigned int** o_row_idx,\n unsigned int** o_column_idx,\n double** o_values,\n unsigned int* o_row_count,\n unsigned int* o_column_count,\n unsigned int* o_element_count ) {\n FILE *l_csr_file_handle;\n const unsigned int l_line_length = 512;\n char l_line[512/*l_line_length*/+1];\n unsigned int l_header_read = 0;\n unsigned int* l_row_idx_id = NULL;\n unsigned int l_i = 0;\n\n l_csr_file_handle = fopen( i_csr_file_in, \"r\" );\n if ( l_csr_file_handle == NULL ) {\n LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSR_INPUT );\n return;\n }\n\n while (fgets(l_line, l_line_length, l_csr_file_handle) != NULL) {\n if ( strlen(l_line) == l_line_length ) {\n free(*o_row_idx); free(*o_column_idx); free(*o_values); free(l_row_idx_id);\n *o_row_idx = 0; *o_column_idx = 0; *o_values = 0;\n fclose(l_csr_file_handle); /* close mtx file */\n LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSR_READ_LEN );\n return;\n }\n /* check if we are still reading comments header */\n if ( l_line[0] == '%' ) {\n continue;\n } else {\n /* if we are the first line after comment header, we allocate our data structures */\n if ( l_header_read == 0 ) {\n if (3 == sscanf(l_line, \"%u %u %u\", o_row_count, o_column_count, o_element_count) &&\n 0 != *o_row_count && 0 != *o_column_count && 0 != *o_element_count)\n {\n /* allocate CSC data-structure matching mtx file */\n *o_column_idx = (unsigned int*) malloc(sizeof(unsigned int) * (*o_element_count));\n *o_row_idx = (unsigned int*) malloc(sizeof(unsigned int) * ((size_t)(*o_row_count) + 1));\n *o_values = (double*) malloc(sizeof(double) * (*o_element_count));\n l_row_idx_id = (unsigned int*) malloc(sizeof(unsigned int) * (*o_row_count));\n\n /* check if mallocs were successful */\n if ( ( *o_row_idx == NULL ) ||\n ( *o_column_idx == NULL ) ||\n ( *o_values == NULL ) ||\n ( l_row_idx_id == NULL ) ) {\n free(*o_row_idx); free(*o_column_idx); free(*o_values); free(l_row_idx_id);\n *o_row_idx = 0; *o_column_idx = 0; *o_values = 0;\n fclose(l_csr_file_handle); /* close mtx file */\n LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSC_ALLOC_DATA );\n return;\n }\n\n /* set everything to zero for init */\n memset(*o_row_idx, 0, sizeof(unsigned int) * ((size_t)(*o_row_count) + 1));\n memset(*o_column_idx, 0, sizeof(unsigned int) * (*o_element_count));\n memset(*o_values, 0, sizeof(double) * (*o_element_count));\n memset(l_row_idx_id, 0, sizeof(unsigned int) * (*o_row_count));\n\n /* init column idx */\n for ( l_i = 0; l_i <= *o_row_count; ++l_i )\n (*o_row_idx)[l_i] = (*o_element_count);\n\n /* init */\n (*o_row_idx)[0] = 0;\n l_i = 0;\n l_header_read = 1;\n } else {\n LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSR_READ_DESC );\n fclose( l_csr_file_handle ); /* close mtx file */\n return;\n }\n /* now we read the actual content */\n } else {\n unsigned int l_row = 0, l_column = 0;\n double l_value = 0;\n /* read a line of content */\n if ( sscanf(l_line, \"%u %u %lf\", &l_row, &l_column, &l_value) != 3 ) {\n free(*o_row_idx); free(*o_column_idx); free(*o_values); free(l_row_idx_id);\n *o_row_idx = 0; *o_column_idx = 0; *o_values = 0;\n fclose(l_csr_file_handle); /* close mtx file */\n LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSR_READ_ELEMS );\n return;\n }\n /* adjust numbers to zero termination */\n LIBXSMM_ASSERT(0 != l_row && 0 != l_column);\n l_row--; l_column--;\n /* add these values to row and value structure */\n (*o_column_idx)[l_i] = l_column;\n (*o_values)[l_i] = l_value;\n l_i++;\n /* handle columns, set id to own for this column, yeah we need to handle empty columns */\n l_row_idx_id[l_row] = 1;\n (*o_row_idx)[l_row+1] = l_i;\n }\n }\n }\n\n /* close mtx file */\n fclose( l_csr_file_handle );\n\n /* check if we read a file which was consistent */\n if ( l_i != (*o_element_count) ) {\n free(*o_row_idx); free(*o_column_idx); free(*o_values); free(l_row_idx_id);\n *o_row_idx = 0; *o_column_idx = 0; *o_values = 0;\n LIBXSMM_HANDLE_ERROR( io_generated_code, LIBXSMM_ERR_CSR_LEN );\n return;\n }\n\n if ( l_row_idx_id != NULL ) {\n /* let's handle empty rows */\n for ( l_i = 0; l_i < (*o_row_count); l_i++) {\n if ( l_row_idx_id[l_i] == 0 ) {\n (*o_row_idx)[l_i+1] = (*o_row_idx)[l_i];\n }\n }\n\n /* free helper data structure */\n free( l_row_idx_id );\n }\n}", "label": 1, "label_name": "safe"} -{"code": "CKEDITOR.plugins.link={getSelectedLink:function(b){var a=b.getSelection(),d=a.getSelectedElement();return d&&d.is(\"a\")?d:(a=a.getRanges()[0])?(a.shrink(CKEDITOR.SHRINK_TEXT),b.elementPath(a.getCommonAncestor()).contains(\"a\",1)):null},fakeAnchor:CKEDITOR.env.opera||CKEDITOR.env.webkit,synAnchorSelector:CKEDITOR.env.ie,emptyAnchorFix:CKEDITOR.env.ie&&8>CKEDITOR.env.version,tryRestoreFakeAnchor:function(b,a){if(a&&a.data(\"cke-real-element-type\")&&\"anchor\"==a.data(\"cke-real-element-type\")){var d=b.restoreRealElement(a);", "label": 1, "label_name": "safe"} -{"code": "static void vgacon_flush_scrollback(struct vc_data *c)\n{\n\tsize_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;\n\n\tvgacon_scrollback_reset(c->vc_num, size);\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function getToken()\n {\n if (isset($this->data['object']) && 'token' === $this->data['object']) {\n return $this->data['id'];\n }\n\n return;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\tmime2class : function(mime) {\n\t\tvar prefix = 'elfinder-cwd-icon-';\n\t\t\n\t\tmime = mime.split('/');\n\t\t\n\t\treturn prefix+mime[0]+(mime[0] != 'image' && mime[1] ? ' '+prefix+mime[1].replace(/(\\.|\\+)/g, '-') : '');\n\t},", "label": 0, "label_name": "vulnerable"} -{"code": " protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\n try {\n if (request.getParameter(\"path\") != null) {\n writeFile(ioService.get(new URI(request.getParameter(\"path\"))), getFileItem(request));\n\n writeResponse(response, \"OK\");\n } else if (request.getParameter(\"folder\") != null) {\n writeFile(\n ioService.get(new URI(request.getParameter(\"folder\") + \"/\" + request.getParameter(\"fileName\"))),\n getFileItem(request));\n\n writeResponse(response, \"OK\");\n }\n\n } catch (FileUploadException e) {\n logError(e);\n writeResponse(response, \"FAIL\");\n } catch (URISyntaxException e) {\n logError(e);\n writeResponse(response, \"FAIL\");\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": "func (m *MockRequester) SetRequestedScopes(arg0 fosite.Arguments) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SetRequestedScopes\", arg0)\n}", "label": 1, "label_name": "safe"} -{"code": "static int swevent_hlist_get_cpu(struct perf_event *event, int cpu)\n{\n\tstruct swevent_htable *swhash = &per_cpu(swevent_htable, cpu);\n\tint err = 0;\n\n\tmutex_lock(&swhash->hlist_mutex);\n\n\tif (!swevent_hlist_deref(swhash) && cpu_online(cpu)) {\n\t\tstruct swevent_hlist *hlist;\n\n\t\thlist = kzalloc(sizeof(*hlist), GFP_KERNEL);\n\t\tif (!hlist) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto exit;\n\t\t}\n\t\trcu_assign_pointer(swhash->swevent_hlist, hlist);\n\t}\n\tswhash->hlist_refcount++;\nexit:\n\tmutex_unlock(&swhash->hlist_mutex);\n\n\treturn err;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " protected int addFileNames(String[] file) { // This appears to only be used by unit tests\n for (int i = 0; file != null && i < file.length; i++) {\n workUnitList.add(new WorkUnit(file[i]));\n }\n return size();\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function testEmpty()\n {\n $this->assertParsing(\n '',\n null, null, null, null, '', null, null\n );\n }", "label": 1, "label_name": "safe"} -{"code": " def query\n gemlist(:justme => resource[:name], :local => true)\n end", "label": 0, "label_name": "vulnerable"} -{"code": " public function setFragmentPath($path)\n {\n $this->fragmentPath = $path;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " def verify_files gem\n gem.each do |entry|\n verify_entry entry\n end\n\n unless @spec then\n raise Gem::Package::FormatError.new 'package metadata is missing', @gem\n end\n\n unless @files.include? 'data.tar.gz' then\n raise Gem::Package::FormatError.new \\\n 'package content (data.tar.gz) is missing', @gem\n end\n\n if duplicates = @files.group_by {|f| f }.select {|k,v| v.size > 1 }.map(&:first) and duplicates.any?\n raise Gem::Security::Exception, \"duplicate files in the package: (#{duplicates.map(&:inspect).join(', ')})\"\n end\n end", "label": 1, "label_name": "safe"} -{"code": " it 'applies the manifest with resource failures' do\n apply_manifest(pp, :expect_failures => true)\n end", "label": 0, "label_name": "vulnerable"} -{"code": " it 'should be able to mysql_deepmerge two hashes' do\n new_hash = scope.function_mysql_deepmerge([{'one' => '1', 'two' => '1'}, {'two' => '2', 'three' => '2'}])\n new_hash['one'].should == '1'\n new_hash['two'].should == '2'\n new_hash['three'].should == '2'\n end", "label": 0, "label_name": "vulnerable"} -{"code": "\t public void doFilter(ServletRequest srequest, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {\n\n\t \t\tHttpServletRequest request = (HttpServletRequest) srequest;\n\t \t\tfilterChain.doFilter(new XssHttpServletRequestWrapper(request) {}, response);\n\n\t }", "label": 1, "label_name": "safe"} -{"code": "CKEDITOR.command.prototype={enable:function(){this.state==CKEDITOR.TRISTATE_DISABLED&&this.checkAllowed()&&this.setState(!this.preserveState||typeof this.previousState==\"undefined\"?CKEDITOR.TRISTATE_OFF:this.previousState)},disable:function(){this.setState(CKEDITOR.TRISTATE_DISABLED)},setState:function(a){if(this.state==a||a!=CKEDITOR.TRISTATE_DISABLED&&!this.checkAllowed())return false;this.previousState=this.state;this.state=a;this.fire(\"state\");return true},toggleState:function(){this.state==CKEDITOR.TRISTATE_OFF?", "label": 1, "label_name": "safe"} -{"code": " Status ValidateInputTensor(const Tensor& tensor,\n const std::string& tensor_name,\n const Tensor& rhs) {\n const int ndims = rhs.dims();\n if (tensor.dims() != ndims) {\n return errors::InvalidArgument(tensor_name,\n \" must have same rank as rhs, but got \",\n tensor.dims(), \" and \", ndims);\n }\n for (int i = 0; i < ndims - 2; i++) {\n if (tensor.dim_size(i) != rhs.dim_size(i)) {\n return errors::InvalidArgument(\n tensor_name,\n \" must have same outer dimensions as rhs, but for index \", i,\n \", got \", tensor.dim_size(i), \" and \", rhs.dim_size(i));\n }\n }\n if (tensor.dim_size(ndims - 2) != 1) {\n return errors::InvalidArgument(\n tensor_name, \"'s second-to-last dimension must be 1, but got \",\n tensor.dim_size(ndims - 2));\n }\n if (tensor.dim_size(ndims - 1) != rhs.dim_size(ndims - 2)) {\n return errors::InvalidArgument(tensor_name,\n \"'s last dimension size must be rhs's \"\n \"second-to-last dimension size, but got \",\n tensor.dim_size(ndims - 1), \" and \",\n rhs.dim_size(ndims - 2));\n }\n return Status::OK();\n }", "label": 1, "label_name": "safe"} -{"code": " protected void deactivateConversationContext(HttpServletRequest request) {\n try {\n ConversationContext conversationContext = httpConversationContext();\n if (conversationContext.isActive()) {\n // Only deactivate the context if one is already active, otherwise we get Exceptions\n if (conversationContext instanceof LazyHttpConversationContextImpl) {\n LazyHttpConversationContextImpl lazyConversationContext = (LazyHttpConversationContextImpl) conversationContext;\n if (!lazyConversationContext.isInitialized()) {\n // if this lazy conversation has not been touched yet, just deactivate it\n lazyConversationContext.deactivate();\n return;\n }\n }\n boolean isTransient = conversationContext.getCurrentConversation().isTransient();\n if (ConversationLogger.LOG.isTraceEnabled()) {\n if (isTransient) {\n ConversationLogger.LOG.cleaningUpTransientConversation();\n } else {\n ConversationLogger.LOG.cleaningUpConversation(conversationContext.getCurrentConversation().getId());\n }\n }\n conversationContext.invalidate();\n conversationContext.deactivate();\n if (isTransient) {\n conversationDestroyedEvent.fire(request);\n }\n }\n } catch (Exception e) {\n ServletLogger.LOG.unableToDeactivateContext(httpConversationContext(), request);\n ServletLogger.LOG.catchingDebug(e);\n }\n }", "label": 1, "label_name": "safe"} -{"code": " public Task ParseArchiveFileKeyAsync(string archiveFileKey)\n {\n var tempDirPath = Path.GetTempPath();\n\n return Task.FromResult(Path.Combine(tempDirPath, archiveFileKey));\n }", "label": 0, "label_name": "vulnerable"} -{"code": " filters.push({'condition': 'AND', 'filters': this.filterPanels[id].getValue(), 'id': id, label: Ext.util.Format.htmlDecode(this.filterPanels[id].title)});\n }\n }\n \n // NOTE: always trigger a OR condition, otherwise we sould loose inactive FilterPanles\n //return filters.length == 1 ? filters[0].filters : [{'condition': 'OR', 'filters': filters}];\n return [{'condition': 'OR', 'filters': filters}];\n },", "label": 1, "label_name": "safe"} -{"code": "return function(g,e){var a=g.uiColor,a={id:\".\"+g.id,defaultBorder:b(a,-0.1),defaultGradient:c(b(a,0.9),a),lightGradient:c(b(a,1),b(a,0.7)),mediumGradient:c(b(a,0.8),b(a,0.5)),ckeButtonOn:c(b(a,0.6),b(a,0.7)),ckeResizer:b(a,-0.4),ckeToolbarSeparator:b(a,0.5),ckeColorauto:b(a,0.8),dialogBody:b(a,0.7),dialogTabSelected:c(\"#FFFFFF\",\"#FFFFFF\"),dialogTabSelectedBorder:\"#FFF\",elementsPathColor:b(a,-0.6),elementsPathBg:a,menubuttonIcon:b(a,0.5),menubuttonIconHover:b(a,0.3)};return f[e].output(a).replace(/\\[/g,", "label": 1, "label_name": "safe"} -{"code": " private function getCategory()\n {\n $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id'));\n\n if (empty($category)) {\n throw new PageNotFoundException();\n }\n\n return $category;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "m.style.top=e+\"px\";m.style.left=g+\"px\";m.style.width=Math.max(0,q-3)+\"px\";m.style.height=Math.max(0,k-3)+\"px\";null!=c&&c.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(m):document.body.appendChild(m);return m};EditorUi.prototype.stringToCells=function(c){c=mxUtils.parseXml(c);var e=this.editor.extractGraphModel(c.documentElement);c=[];if(null!=e){var g=new mxCodec(e.ownerDocument),k=new mxGraphModel;g.decode(e,k);e=k.getChildAt(k.getRoot(),0);for(g=0;gblacklist as $blacklisted_host_fragment) {\n if (strpos($uri->host, $blacklisted_host_fragment) !== false) {\n return false;\n }\n }\n return true;\n }", "label": 1, "label_name": "safe"} -{"code": "main(void)\n{\n\t/* exec sql begin declare section */\n\t\t \n\t\t \n\t\t \n\t\t \n\t\t \n\t\n#line 52 \"dt_test2.pgc\"\n date date1 ;\n \n#line 53 \"dt_test2.pgc\"\n timestamp ts1 , ts2 ;\n \n#line 54 \"dt_test2.pgc\"\n char * text ;\n \n#line 55 \"dt_test2.pgc\"\n interval * i1 ;\n \n#line 56 \"dt_test2.pgc\"\n date * dc ;\n/* exec sql end declare section */\n#line 57 \"dt_test2.pgc\"\n\n\n\tint i, j;\n\tchar *endptr;\n\n\tECPGdebug(1, stderr);\n\n\tts1 = PGTYPEStimestamp_from_asc(\"2003-12-04 17:34:29\", NULL);\n\ttext = PGTYPEStimestamp_to_asc(ts1);\n\n\tprintf(\"timestamp: %s\\n\", text);\n\tfree(text);\n\n\tdate1 = PGTYPESdate_from_timestamp(ts1);\n\tdc = PGTYPESdate_new();\n\t*dc = date1;\n\ttext = PGTYPESdate_to_asc(*dc);\n\tprintf(\"Date of timestamp: %s\\n\", text);\n\tfree(text);\n\tPGTYPESdate_free(dc);\n\n\tfor (i = 0; dates[i]; i++)\n\t{\n\t\tbool err = false;\n\t\tdate1 = PGTYPESdate_from_asc(dates[i], &endptr);\n\t\tif (date1 == INT_MIN) {\n\t\t\terr = true;\n\t\t}\n\t\ttext = PGTYPESdate_to_asc(date1);\n\t\tprintf(\"Date[%d]: %s (%c - %c)\\n\",\n\t\t\t\t\ti, err ? \"-\" : text,\n\t\t\t\t\tendptr ? 'N' : 'Y',\n\t\t\t\t\terr ? 'T' : 'F');\n\t\tfree(text);\n\t\tif (!err)\n\t\t{\n\t\t\tfor (j = 0; times[j]; j++)\n\t\t\t{\n\t\t\t\tint length = strlen(dates[i])\n\t\t\t\t\t\t+ 1\n\t\t\t\t\t\t+ strlen(times[j])\n\t\t\t\t\t\t+ 1;\n\t\t\t\tchar* t = malloc(length);\n\t\t\t\tsprintf(t, \"%s %s\", dates[i], times[j]);\n\t\t\t\tts1 = PGTYPEStimestamp_from_asc(t, NULL);\n\t\t\t\ttext = PGTYPEStimestamp_to_asc(ts1);\n\t\t\t\tif (i != 19 || j != 3) /* timestamp as integer or double differ for this case */\n\t\t\t\t\tprintf(\"TS[%d,%d]: %s\\n\",\n\t\t\t\t\t\ti, j, errno ? \"-\" : text);\n\t\t\t\tfree(text);\n\t\t\t\tfree(t);\n\t\t\t}\n\t\t}\n\t}\n\n\tts1 = PGTYPEStimestamp_from_asc(\"2004-04-04 23:23:23\", NULL);\n\n\tfor (i = 0; intervals[i]; i++)\n\t{\n\t\tinterval *ic;\n\t\ti1 = PGTYPESinterval_from_asc(intervals[i], &endptr);\n\t\tif (*endptr)\n\t\t\tprintf(\"endptr set to %s\\n\", endptr);\n\t\tif (!i1)\n\t\t{\n\t\t\tprintf(\"Error parsing interval %d\\n\", i);\n\t\t\tcontinue;\n\t\t}\n\t\tj = PGTYPEStimestamp_add_interval(&ts1, i1, &ts2);\n\t\tif (j < 0)\n\t\t\tcontinue;\n\t\ttext = PGTYPESinterval_to_asc(i1);\n\t\tprintf(\"interval[%d]: %s\\n\", i, text ? text : \"-\");\n\t\tfree(text);\n\n\t\tic = PGTYPESinterval_new();\n\t\tPGTYPESinterval_copy(i1, ic);\n\t\ttext = PGTYPESinterval_to_asc(i1);\n\t\tprintf(\"interval_copy[%d]: %s\\n\", i, text ? text : \"-\");\n\t\tfree(text);\n\t\tPGTYPESinterval_free(ic);\n\t\tPGTYPESinterval_free(i1);\n\t}\n\n\treturn (0);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "E=J}return E};Graph.prototype.getCellsById=function(u){var E=[];if(null!=u)for(var J=0;JassertPresent($path);\n $this->assertAbsent($newpath);\n\n return (bool) $this->getAdapter()->rename($path, $newpath);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "(new mxCodec(p.ownerDocument)).decode(p)}return this.defaultStylesheet};Graph.prototype.isViewer=function(){return urlParams.viewer};var K=Graph.prototype.getSvg;Graph.prototype.getSvg=function(p,C,I,T,P,O,R,Y,da,ha,Z,ea,aa,ua){var la=null,Aa=null,Fa=null;ea||null==this.themes||\"darkTheme\"!=this.defaultThemeName||(la=this.stylesheet,Aa=this.shapeForegroundColor,Fa=this.shapeBackgroundColor,this.shapeForegroundColor=\"darkTheme\"==this.defaultThemeName?\"#000000\":Editor.lightColor,this.shapeBackgroundColor=\n\"darkTheme\"==this.defaultThemeName?\"#ffffff\":Editor.darkColor,this.stylesheet=this.getDefaultStylesheet(),this.refresh());var xa=K.apply(this,arguments),Da=this.getCustomFonts();if(Z&&0findBy('calculator_name', $s);\n $paymentQuery = 'billingcalculator_id = ' . $calc->id;\n }\n\n if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND ( \" . $paymentQuery;\n } else {\n $sqltmp .= \" OR \" . $paymentQuery;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }\n\n //echo $sql . $sqlwhere . \"
\";\n /*\n Need: order, orderitems, order status, ordertype, billingmethods, geo region, shipping methods, products\n [date-startdate] => \n [time-h-startdate] => \n [time-m-startdate] => \n [ampm-startdate] => am\n [date-enddate] => \n [time-h-enddate] => \n [time-m-enddate] => \n [ampm-enddate] => am\n [order_status] => Array\n (\n [0] => 0\n [1] => 1\n [2] => 2\n )\n\n [order_type] => Array\n (\n [0] => 0\n [1] => 2\n )\n\n [order-range-op] => e\n [order-range-num] => \n [order-price-op] => l\n [order-price-num] => \n [pnam] => \n [sku] => \n [discounts] => Array\n (\n [0] => -1\n )\n\n [blshpname] => \n [email] => \n [bl-sp-zip] => s\n [zip] => \n [bl-sp-state] => s\n [state] => Array\n (\n [0] => -1\n )\n\n [status] => Array\n (\n [0] => -1\n )\n\n )\n */\n\n //$sqlwhere .= \" ORDER BY purchased_date DESC\";\n $count_sql .= $sql . $sqlwhere;\n $sql = $start_sql . $sql;\n expSession::set('order_print_query', $sql . $sqlwhere);\n $reportRecords = $db->selectObjectsBySql($sql . $sqlwhere);\n expSession::set('order_export_values', $reportRecords);\n\n //eDebug(expSession::get('order_export_values'));\n //$where = 1;//$this->aggregateWhereClause();\n //$order = 'id';\n //$prod = new product();\n // $order = new order();\n //$items = $prod->find('all', 1, 'id DESC',25); \n //$items = $order->find('all', 1, 'id DESC',25); \n //$res = $mod->find('all',$sql,'id',25);\n //eDebug($items);\n //eDebug($sql . $sqlwhere); \n\n $page = new expPaginator(array(\n //'model'=>'order',\n //'records'=>$items,\n // 'where'=>$where,\n 'count_sql' => $count_sql,\n 'sql' => $sql . $sqlwhere,\n 'limit' => empty($this->config['limit']) ? 350 : $this->config['limit'],\n 'order' => 'invoice_id',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n gt('Order #') => 'invoice_id|controller=order,action=show,showby=id',\n gt('Purchased Date') => 'purchased_date',\n gt('First') => 'bfirst',\n gt('Last') => 'blast',\n gt('Total') => 'grand_total',\n gt('Status Changed Date') => 'status_changed_date',\n gt('Order Type') => 'order_type',\n gt('Status') => 'status_title'\n ),\n ));\n\n //strftime(\"%a %d-%m-%Y\", get_first_day(3, 1, 2007)); Thursday, 1 April 2010 \n //$d_month_previous = date('n', mktime(0,0,0,(strftime(\"%m\")-1),1,strftime(\"%Y\")));\n\n $action_items = array(\n 'print_orders' => 'Print Orders',\n 'export_odbc' => 'Export Shipping Data to CSV',\n 'export_status_report' => 'Export Order Status Data to CSV',\n 'export_inventory' => 'Export Inventory Data to CSV',\n 'export_user_input_report' => 'Export User Input Data to CSV',\n 'export_order_items' => 'Export Order Items Data to CSV',\n 'show_payment_summary' => 'Show Payment & Tax Summary'\n );\n assign_to_template(array(\n 'page' => $page,\n 'action_items' => $action_items\n ));\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\t\tchangeclipboard : function() { this.update(); }", "label": 0, "label_name": "vulnerable"} -{"code": "d[c]=e,\"o\"===b[1]&&Y(a[e])});a._hungarianMap=d}function J(a,b,c){a._hungarianMap||Y(a);var d;h.each(b,function(e){d=a._hungarianMap[e];if(d!==k&&(c||b[d]===k))\"o\"===d.charAt(0)?(b[d]||(b[d]={}),h.extend(!0,b[d],b[e]),J(a[d],b[d],c)):b[d]=b[e]})}function Fa(a){var b=m.defaults.oLanguage,c=a.sZeroRecords;!a.sEmptyTable&&(c&&\"No data available in table\"===b.sEmptyTable)&&F(a,a,\"sZeroRecords\",\"sEmptyTable\");!a.sLoadingRecords&&(c&&\"Loading...\"===b.sLoadingRecords)&&F(a,a,\"sZeroRecords\",\"sLoadingRecords\");", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset,\n\t\t\tbyte[] ciphertext, int ciphertextOffset, int length)\n\t\t\tthrows ShortBufferException {\n\t\tint space;\n\t\tif (ciphertextOffset > ciphertext.length)\n\t\t\tspace = 0;\n\t\telse\n\t\t\tspace = ciphertext.length - ciphertextOffset;\n\t\tif (!haskey) {\n\t\t\t// The key is not set yet - return the plaintext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (space < 16 || length > (space - 16))\n\t\t\tthrow new ShortBufferException();\n\t\tsetup(ad);\n\t\tencryptCTR(plaintext, plaintextOffset, ciphertext, ciphertextOffset, length);\n\t\tghash.update(ciphertext, ciphertextOffset, length);\n\t\tghash.pad(ad != null ? ad.length : 0, length);\n\t\tghash.finish(ciphertext, ciphertextOffset + length, 16);\n\t\tfor (int index = 0; index < 16; ++index)\n\t\t\tciphertext[ciphertextOffset + length + index] ^= hashKey[index];\n\t\treturn length + 16;\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": "static int vorbis_finish_frame(stb_vorbis *f, int len, int left, int right)\n{\n int prev,i,j;\n // we use right&left (the start of the right- and left-window sin()-regions)\n // to determine how much to return, rather than inferring from the rules\n // (same result, clearer code); 'left' indicates where our sin() window\n // starts, therefore where the previous window's right edge starts, and\n // therefore where to start mixing from the previous buffer. 'right'\n // indicates where our sin() ending-window starts, therefore that's where\n // we start saving, and where our returned-data ends.\n\n // mixin from previous window\n if (f->previous_length) {\n int i,j, n = f->previous_length;\n float *w = get_window(f, n);\n if (w == NULL) return 0;\n for (i=0; i < f->channels; ++i) {\n for (j=0; j < n; ++j)\n f->channel_buffers[i][left+j] =\n f->channel_buffers[i][left+j]*w[ j] +\n f->previous_window[i][ j]*w[n-1-j];\n }\n }\n\n prev = f->previous_length;\n\n // last half of this data becomes previous window\n f->previous_length = len - right;\n\n // @OPTIMIZE: could avoid this copy by double-buffering the\n // output (flipping previous_window with channel_buffers), but\n // then previous_window would have to be 2x as large, and\n // channel_buffers couldn't be temp mem (although they're NOT\n // currently temp mem, they could be (unless we want to level\n // performance by spreading out the computation))\n for (i=0; i < f->channels; ++i)\n for (j=0; right+j < len; ++j)\n f->previous_window[i][j] = f->channel_buffers[i][right+j];\n\n if (!prev)\n // there was no previous packet, so this data isn't valid...\n // this isn't entirely true, only the would-have-overlapped data\n // isn't valid, but this seems to be what the spec requires\n return 0;\n\n // truncate a short frame\n if (len < right) right = len;\n\n f->samples_output += right-left;\n\n return right - left;\n}", "label": 1, "label_name": "safe"} -{"code": " def test_should_sanitize_illegal_style_properties\n raw = %(display:block; position:absolute; left:0; top:0; width:100%; height:100%; z-index:1; background-color:black; background-image:url(http://www.ragingplatypus.com/i/cam-full.jpg); background-x:center; background-y:center; background-repeat:repeat;)\n expected = %(display:block;width:100%;height:100%;background-color:black;background-x:center;background-y:center;)\n assert_equal expected, sanitize_css(raw)\n end", "label": 1, "label_name": "safe"} -{"code": " public static Object instantiate(String classname, Properties info, boolean tryString,\n @Nullable String stringarg)\n throws ClassNotFoundException, SecurityException, NoSuchMethodException,\n IllegalArgumentException, InstantiationException, IllegalAccessException,\n InvocationTargetException {\n @Nullable Object[] args = {info};\n Constructor ctor = null;\n Class cls = Class.forName(classname);\n try {\n ctor = cls.getConstructor(Properties.class);\n } catch (NoSuchMethodException ignored) {\n }\n if (tryString && ctor == null) {\n try {\n ctor = cls.getConstructor(String.class);\n args = new String[]{stringarg};\n } catch (NoSuchMethodException ignored) {\n }\n }\n if (ctor == null) {\n ctor = cls.getConstructor();\n args = new Object[0];\n }\n return ctor.newInstance(args);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\t\t\t\t\t\t\t.attr({href: '#', title: fm.i18n('getLink'), draggable: 'false'})\n\t\t\t\t\t\t\t.text(file.name)\n\t\t\t\t\t\t\t.on('click', function(e){\n\t\t\t\t\t\t\t\tvar parent = node.parent();\n\t\t\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\tparent.removeClass('ui-state-disabled').addClass('elfinder-button-icon-spinner');\n\t\t\t\t\t\t\t\tfm.request({\n\t\t\t\t\t\t\t\t\tdata : {cmd : 'url', target : file.hash},\n\t\t\t\t\t\t\t\t\tpreventDefault : true\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.always(function(data) {\n\t\t\t\t\t\t\t\t\tparent.removeClass('elfinder-button-icon-spinner');\n\t\t\t\t\t\t\t\t\tif (data.url) {\n\t\t\t\t\t\t\t\t\t\tvar rfile = fm.file(file.hash);\n\t\t\t\t\t\t\t\t\t\trfile.url = data.url;\n\t\t\t\t\t\t\t\t\t\tnode.replaceWith(getExtra(file).node);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tparent.addClass('ui-state-disabled');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t})\n\t\t\t\t\t};\n\t\t\t\t\tnode = self.extra.node;\n\t\t\t\t\tnode.ready(function(){\n\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\tnode.parent().addClass('ui-state-disabled').css('pointer-events', 'auto');\n\t\t\t\t\t\t}, 10);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}", "label": 0, "label_name": "vulnerable"} -{"code": " var record_messages = function (msg, opts) {\n console.log(\"HTML Sanitizer\", msg, opts);\n };", "label": 0, "label_name": "vulnerable"} -{"code": "int AES_decrypt(uint8_t *encr_message, uint64_t length, char *message, uint64_t msgLen) {\n\n if (!message) {\n LOG_ERROR(\"Null message in AES_encrypt\");\n return -1;\n }\n\n if (!encr_message) {\n LOG_ERROR(\"Null encr message in AES_encrypt\");\n return -2;\n }\n\n\n if (length < SGX_AESGCM_MAC_SIZE + SGX_AESGCM_IV_SIZE) {\n LOG_ERROR(\"length < SGX_AESGCM_MAC_SIZE - SGX_AESGCM_IV_SIZE\");\n return -1;\n }\n\n\n\n uint64_t len = length - SGX_AESGCM_MAC_SIZE - SGX_AESGCM_IV_SIZE;\n\n if (msgLen < len) {\n LOG_ERROR(\"Output buffer not large enough\");\n return -2;\n }\n\n sgx_status_t status = sgx_rijndael128GCM_decrypt(&AES_key,\n encr_message + SGX_AESGCM_MAC_SIZE + SGX_AESGCM_IV_SIZE, len,\n (unsigned char*) message,\n encr_message + SGX_AESGCM_MAC_SIZE, SGX_AESGCM_IV_SIZE,\n NULL, 0,\n (sgx_aes_gcm_128bit_tag_t *)encr_message);\n\n return status;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "\tgetHasOwnProperty: function(element, property) {\n\t\tvar key = element + \".\" + property;\n\t\tvar own = this.current().own;\n\t\tif (!own.hasOwnProperty(key)) {\n\t\t\town[key] = this.nextId(\n\t\t\t\tfalse,\n\t\t\t\telement + \"&&(\" + this.escape(property) + \" in \" + element + \")\"\n\t\t\t);\n\t\t}\n\t\treturn own[key];\n\t},", "label": 1, "label_name": "safe"} -{"code": " async def act(self, ctx: commands.Context, *, target: Union[discord.Member, str] = None):\r\n \"\"\"\r\n Acts on the specified user.\r\n \"\"\"\r\n if not target or isinstance(target, str):\r\n return # no help text\r\n\r\n try:\r\n if not ctx.guild:\r\n raise KeyError()\r\n message = await self.config.guild(ctx.guild).get_raw(\"custom\", ctx.invoked_with)\r\n except KeyError:\r\n try:\r\n message = await self.config.get_raw(\"custom\", ctx.invoked_with)\r\n except KeyError:\r\n message = NotImplemented\r\n\r\n if message is None: # ignored command\r\n return\r\n elif message is NotImplemented: # default\r\n # humanize action text\r\n action = inflection.humanize(ctx.invoked_with).split()\r\n iverb = -1\r\n\r\n for cycle in range(2):\r\n if iverb > -1:\r\n break\r\n for i, act in enumerate(action):\r\n act = act.lower()\r\n if (\r\n act in NOLY_ADV\r\n or act in CONJ\r\n or (act.endswith(\"ly\") and act not in LY_VERBS)\r\n or (not cycle and act in SOFT_VERBS)\r\n ):\r\n continue\r\n action[i] = inflection.pluralize(action[i])\r\n iverb = max(iverb, i)\r\n\r\n if iverb < 0:\r\n return\r\n action.insert(iverb + 1, target.mention)\r\n message = italics(\" \".join(action))\r\n else:\r\n assert isinstance(message, str)\r\n message = fmt_re.sub(functools.partial(self.repl, target), message)\r\n\r\n # add reaction gif\r\n if self.try_after and ctx.message.created_at < self.try_after:\r\n return await ctx.send(message)\r\n if not await ctx.embed_requested():\r\n return await ctx.send(message)\r\n key = (await ctx.bot.get_shared_api_tokens(\"tenor\")).get(\"api_key\")\r\n if not key:\r\n return await ctx.send(message)\r\n async with aiohttp.request(\r\n \"GET\",\r\n \"https://api.tenor.com/v1/search\",\r\n params={\r\n \"q\": ctx.invoked_with,\r\n \"key\": key,\r\n \"anon_id\": str(ctx.author.id ^ ctx.me.id),\r\n \"media_filter\": \"minimal\",\r\n \"contentfilter\": \"off\" if getattr(ctx.channel, \"nsfw\", False) else \"low\",\r\n \"ar_range\": \"wide\",\r\n \"limit\": \"8\",\r\n \"locale\": get_locale(),\r\n },\r\n ) as response:\r\n json: dict\r\n if response.status == 429:\r\n self.try_after = ctx.message.created_at + 30\r\n json = {}\r\n elif response.status >= 400:\r\n json = {}\r\n else:\r\n json = await response.json()\r\n if not json.get(\"results\"):\r\n return await ctx.send(message)\r\n message = f\"{message}\\n\\n{random.choice(json['results'])['itemurl']}\"\r\n await ctx.send(\r\n message,\r\n allowed_mentions=discord.AllowedMentions(\r\n users=False if target in ctx.message.mentions else [target]\r\n ),\r\n )\r", "label": 1, "label_name": "safe"} -{"code": " it \"should reject a non-critical extension that isn't on the whitelist\" do\n @request.stubs(:request_extensions).returns [{ \"oid\" => \"peach\",\n \"value\" => \"meh\",\n \"critical\" => false }]\n expect { @ca.sign(@name) }.to raise_error(\n Puppet::SSL::CertificateAuthority::CertificateSigningError,\n /request extensions that are not permitted/\n )\n end", "label": 0, "label_name": "vulnerable"} -{"code": " public function testNull() {\n $context = new HTMLPurifier_Context();\n $var = NULL;\n $context->register('var', $var);\n $this->assertNull($context->get('var'));\n $context->destroy('var');\n }", "label": 1, "label_name": "safe"} -{"code": "void handle_lddfmna(struct pt_regs *regs, unsigned long sfar, unsigned long sfsr)\n{\n\tunsigned long pc = regs->tpc;\n\tunsigned long tstate = regs->tstate;\n\tu32 insn;\n\tu64 value;\n\tu8 freg;\n\tint flag;\n\tstruct fpustate *f = FPUSTATE;\n\n\tif (tstate & TSTATE_PRIV)\n\t\tdie_if_kernel(\"lddfmna from kernel\", regs);\n\tperf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, sfar);\n\tif (test_thread_flag(TIF_32BIT))\n\t\tpc = (u32)pc;\n\tif (get_user(insn, (u32 __user *) pc) != -EFAULT) {\n\t\tint asi = decode_asi(insn, regs);\n\t\tu32 first, second;\n\t\tint err;\n\n\t\tif ((asi > ASI_SNFL) ||\n\t\t (asi < ASI_P))\n\t\t\tgoto daex;\n\t\tfirst = second = 0;\n\t\terr = get_user(first, (u32 __user *)sfar);\n\t\tif (!err)\n\t\t\terr = get_user(second, (u32 __user *)(sfar + 4));\n\t\tif (err) {\n\t\t\tif (!(asi & 0x2))\n\t\t\t\tgoto daex;\n\t\t\tfirst = second = 0;\n\t\t}\n\t\tsave_and_clear_fpu();\n\t\tfreg = ((insn >> 25) & 0x1e) | ((insn >> 20) & 0x20);\n\t\tvalue = (((u64)first) << 32) | second;\n\t\tif (asi & 0x8) /* Little */\n\t\t\tvalue = __swab64p(&value);\n\t\tflag = (freg < 32) ? FPRS_DL : FPRS_DU;\n\t\tif (!(current_thread_info()->fpsaved[0] & FPRS_FEF)) {\n\t\t\tcurrent_thread_info()->fpsaved[0] = FPRS_FEF;\n\t\t\tcurrent_thread_info()->gsr[0] = 0;\n\t\t}\n\t\tif (!(current_thread_info()->fpsaved[0] & flag)) {\n\t\t\tif (freg < 32)\n\t\t\t\tmemset(f->regs, 0, 32*sizeof(u32));\n\t\t\telse\n\t\t\t\tmemset(f->regs+32, 0, 32*sizeof(u32));\n\t\t}\n\t\t*(u64 *)(f->regs + freg) = value;\n\t\tcurrent_thread_info()->fpsaved[0] |= flag;\n\t} else {\ndaex:\n\t\tif (tlb_type == hypervisor)\n\t\t\tsun4v_data_access_exception(regs, sfar, sfsr);\n\t\telse\n\t\t\tspitfire_data_access_exception(regs, sfsr, sfar);\n\t\treturn;\n\t}\n\tadvance(regs);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic function testCanLoadRegisteredAjaxView() {\n\t\t$request = $this->prepareHttpRequest('ajax/view/ajax_test/registered', 'GET', [], 1);\n\t\t\n\t\t$response = $this->executeRequest($request);\n\t\t$this->assertInstanceOf(\\Elgg\\Http\\OkResponse::class, $response);\n\t\t$this->assertEquals('registered', $response->getContent());\n\t}", "label": 1, "label_name": "safe"} -{"code": "function(){b.hideDialog(!0)});f.className=\"geBtn\";d=null!=d?mxUtils.button(mxResources.get(\"ignore\"),d):null;null!=d&&(d.className=\"geBtn\");b.editor.cancelFirst?(y.appendChild(f),null!=d&&y.appendChild(d),y.appendChild(v),y.appendChild(n)):(y.appendChild(n),y.appendChild(v),null!=d&&y.appendChild(d),y.appendChild(f));k.appendChild(y);k.appendChild(A);this.container=k},FindWindow=function(b,e,f,c,m,n){function v(U,X,u,D){if(\"object\"===typeof X.value&&null!=X.value.attributes){X=X.value.attributes;\nfor(var K=0;K rsMode = r\n case _ => sys.error(\"Invalid output config packet %s to config %s\".format(m, this))\n }\n\n}", "label": 1, "label_name": "safe"} -{"code": " public function testUnclosedTags()\n {\n $code = '[b]bold';\n $codeOutput = '[b]bold[/b]';\n $this->assertBBCodeOutput($code, $codeOutput);\n }", "label": 1, "label_name": "safe"} -{"code": " function quickfinder() {\n global $db;\n\n $search = $this->params['ordernum'];\n $searchInv = intval($search);\n\n $sql = \"SELECT DISTINCT(o.id), o.invoice_id, FROM_UNIXTIME(o.purchased,'%c/%e/%y %h:%i:%s %p') as purchased_date, b.firstname as bfirst, b.lastname as blast, concat('\".expCore::getCurrencySymbol().\"',format(o.grand_total,2)) as grand_total, os.title as status_title, ot.title as order_type\";\n $sql .= \" from \" . $db->prefix . \"orders as o \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"orderitems as oi ON oi.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_type as ot ON ot.id = o.order_type_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"order_status as os ON os.id = o.order_status_id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"billingmethods as b ON b.orders_id = o.id \";\n $sql .= \"INNER JOIN \" . $db->prefix . \"shippingmethods as s ON s.id = oi.shippingmethods_id \";\n\n $sqlwhere = \"WHERE o.purchased != 0\";\n if ($searchInv != 0) $sqlwhere .= \" AND (o.invoice_id LIKE '%\" . $searchInv . \"%' OR\";\n else $sqlwhere .= \" AND (\";\n $sqlwhere .= \" b.firstname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR s.firstname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR b.lastname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR s.lastname LIKE '%\" . $search . \"%'\";\n $sqlwhere .= \" OR b.email LIKE '%\" . $search . \"%')\";\n\n $limit = empty($this->config['limit']) ? 350 : $this->config['limit'];\n //eDebug($sql . $sqlwhere) ;\n $page = new expPaginator(array(\n 'sql' => $sql . $sqlwhere,\n 'limit' => $limit,\n 'order' => 'o.invoice_id',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=> $this->baseclassname,\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n gt('Order #') => 'invoice_id|controller=order,action=show,showby=id',\n gt('Purchased Date')=> 'purchased_date',\n gt('First') => 'bfirst',\n gt('Last') => 'blast',\n gt('Total') => 'grand_total',\n gt('Order Type') => 'order_type',\n gt('Status') => 'status_title'\n ),\n ));\n assign_to_template(array(\n 'page'=> $page,\n 'term'=> $search\n ));\n\n //eDebug($this->params);\n /*$o = new order();\n $b = new billingmethod();\n $s = new shippingmethod();\n \n $search = intval($this->params['ordernum']);\n if (is_int($oid) && $oid > 0)\n {\n $orders = $o->find('all',\"invoice_id LIKE '%\".$oid.\"%'\");\n if(count($orders == 1))\n {\n redirect_to(array('controller'=>'order','action'=>'show','id'=>$order[0]->id)); \n }\n else\n {\n flashAndFlow('message',\"Orders containing \" . $search . \" in the order number not found.\");\n }\n }\n else\n {\n //lookup just a customer\n $bms = $b->find('all', )\n }*/\n /*$o = new order();\n $oid = intval($this->params['ordernum']);\n if (is_int($oid) && $oid > 0)\n {\n $order = $o->find('first','invoice_id='.$oid);\n if(!empty($order->id))\n {\n redirect_to(array('controller'=>'order','action'=>'show','id'=>$order->id)); \n }\n else\n {\n flashAndFlow('message',\"Order #\" . intval($this->params['ordernum']) . \" not found.\");\n }\n }\n else\n {\n flashAndFlow('message','Invalid order number.'); \n }*/\n }", "label": 0, "label_name": "vulnerable"} -{"code": " def CreateID(self):\n \"\"\"Create a packet ID. All RADIUS requests have a ID which is used to\n identify a request. This is used to detect retries and replay attacks.\n This function returns a suitable random number that can be used as ID.\n\n :return: ID number\n :rtype: integer\n\n \"\"\"\n return random_generator.randrange(0, 256)", "label": 1, "label_name": "safe"} -{"code": "function(K){var F=x.length;if(1===F%2||F>=f){var H=0,S=0,V,M=0;for(V=K;Vupdate($this);\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": " private function _pLookAhead() {\n $this->current($i, $current);\n if ($current instanceof HTMLPurifier_Token_Start) $nesting = 1;\n else $nesting = 0;\n $ok = false;\n while ($this->forwardUntilEndToken($i, $current, $nesting)) {\n $result = $this->_checkNeedsP($current);\n if ($result !== null) {\n $ok = $result;\n break;\n }\n }\n return $ok;\n }", "label": 1, "label_name": "safe"} -{"code": " public function handleRequest() {\n /* Load error handling class */\n $this->loadErrorHandler();\n\n $this->modx->invokeEvent('OnHandleRequest');\n\n /* save page to manager object. allow custom actionVar choice for extending classes. */\n $this->action = isset($_REQUEST[$this->actionVar]) ? $_REQUEST[$this->actionVar] : $this->defaultAction;\n\n /* invoke OnManagerPageInit event */\n $this->modx->invokeEvent('OnManagerPageInit',array('action' => $this->action));\n $this->prepareResponse();\n }", "label": 0, "label_name": "vulnerable"} -{"code": " def primary?\n !!@primary\n end", "label": 0, "label_name": "vulnerable"} -{"code": "\tfunction formatValue( $name, $value ) {\n\t\t$row = $this->mCurrentRow;\n\n\t\tswitch ( $name ) {\n\t\t\tcase 'files_timestamp':\n\t\t\t\t$formatted = htmlspecialchars( $this->getLanguage()->userTimeAndDate( $row->files_timestamp, $this->getUser() ) );\n\t\t\t\tbreak;\n\t\t\tcase 'files_dbname':\n\t\t\t\t$formatted = $row->files_dbname;\n\t\t\t\tbreak;\n\t\t\tcase 'files_url':\n\t\t\t\t$formatted = Html::element(\n\t\t\t\t\t'img',\n\t\t\t\t\t[\n\t\t\t\t\t\t'src' => $row->files_url,\n\t\t\t\t\t\t'style' => 'width: 135px; height: 135px;'\n\t\t\t\t\t]\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase 'files_name':\n\t\t\t\t$formatted = Html::element(\n\t\t\t\t\t'a',\n\t\t\t\t\t[\n\t\t\t\t\t\t'href' => $row->files_page,\n\t\t\t\t\t],\n\t\t\t\t\t$row->files_name\n\t\t\t\t);\n\n\t\t\t\tbreak;\n\t\t\tcase 'files_user':\n\t\t\t\t$formatted = $this->linkRenderer->makeLink(\n\t\t\t\t\tSpecialPage::getTitleFor( 'CentralAuth', $row->files_user ),\n\t\t\t\t\t$row->files_user\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$formatted = \"Unable to format $name\";\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn $formatted;\n\t}", "label": 1, "label_name": "safe"} -{"code": "\t\t([ key, value ]) => ({ [key]: async () => (await spawn(value)).split('\\n') }),", "label": 1, "label_name": "safe"} -{"code": " public function confirm()\n {\n $project = $this->getProject();\n $category = $this->getCategory($project);\n\n $this->response->html($this->helper->layout->project('category/remove', array(\n 'project' => $project,\n 'category' => $category,\n )));\n }", "label": 1, "label_name": "safe"} -{"code": " def latest?\n debug \"Checking for updates because 'ensure => latest'\"\n at_path do\n # We cannot use -P to prune empty dirs, otherwise\n # CVS would report those as \"missing\", regardless\n # if they have contents or updates.\n is_current = (runcvs('-nq', 'update', '-d').strip == \"\")\n if (!is_current) then debug \"There are updates available on the checkout's current branch/tag.\" end\n return is_current\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": "if(null!=X&&0 0xFFFF)\n\t\tgoto out;\n\n\t/*\n\t *\tCheck the flags.\n\t */\n\n\terr = -EOPNOTSUPP;\n\tif (msg->msg_flags & MSG_OOB)\t/* Mirror BSD error message */\n\t\tgoto out; /* compatibility */\n\n\t/*\n\t *\tGet and verify the address.\n\t */\n\n\tif (msg->msg_namelen) {\n\t\tDECLARE_SOCKADDR(struct sockaddr_in *, usin, msg->msg_name);\n\t\terr = -EINVAL;\n\t\tif (msg->msg_namelen < sizeof(*usin))\n\t\t\tgoto out;\n\t\tif (usin->sin_family != AF_INET) {\n\t\t\tpr_info_once(\"%s: %s forgot to set AF_INET. Fix it!\\n\",\n\t\t\t\t __func__, current->comm);\n\t\t\terr = -EAFNOSUPPORT;\n\t\t\tif (usin->sin_family)\n\t\t\t\tgoto out;\n\t\t}\n\t\tdaddr = usin->sin_addr.s_addr;\n\t\t/* ANK: I did not forget to get protocol from port field.\n\t\t * I just do not know, who uses this weirdness.\n\t\t * IP_HDRINCL is much more convenient.\n\t\t */\n\t} else {\n\t\terr = -EDESTADDRREQ;\n\t\tif (sk->sk_state != TCP_ESTABLISHED)\n\t\t\tgoto out;\n\t\tdaddr = inet->inet_daddr;\n\t}\n\n\tipc.sockc.tsflags = sk->sk_tsflags;\n\tipc.addr = inet->inet_saddr;\n\tipc.opt = NULL;\n\tipc.tx_flags = 0;\n\tipc.ttl = 0;\n\tipc.tos = -1;\n\tipc.oif = sk->sk_bound_dev_if;\n\n\tif (msg->msg_controllen) {\n\t\terr = ip_cmsg_send(sk, msg, &ipc, false);\n\t\tif (unlikely(err)) {\n\t\t\tkfree(ipc.opt);\n\t\t\tgoto out;\n\t\t}\n\t\tif (ipc.opt)\n\t\t\tfree = 1;\n\t}\n\n\tsaddr = ipc.addr;\n\tipc.addr = daddr;\n\n\tif (!ipc.opt) {\n\t\tstruct ip_options_rcu *inet_opt;\n\n\t\trcu_read_lock();\n\t\tinet_opt = rcu_dereference(inet->inet_opt);\n\t\tif (inet_opt) {\n\t\t\tmemcpy(&opt_copy, inet_opt,\n\t\t\t sizeof(*inet_opt) + inet_opt->opt.optlen);\n\t\t\tipc.opt = &opt_copy.opt;\n\t\t}\n\t\trcu_read_unlock();\n\t}\n\n\tif (ipc.opt) {\n\t\terr = -EINVAL;\n\t\t/* Linux does not mangle headers on raw sockets,\n\t\t * so that IP options + IP_HDRINCL is non-sense.\n\t\t */\n\t\tif (inet->hdrincl)\n\t\t\tgoto done;\n\t\tif (ipc.opt->opt.srr) {\n\t\t\tif (!daddr)\n\t\t\t\tgoto done;\n\t\t\tdaddr = ipc.opt->opt.faddr;\n\t\t}\n\t}\n\ttos = get_rtconn_flags(&ipc, sk);\n\tif (msg->msg_flags & MSG_DONTROUTE)\n\t\ttos |= RTO_ONLINK;\n\n\tif (ipv4_is_multicast(daddr)) {\n\t\tif (!ipc.oif)\n\t\t\tipc.oif = inet->mc_index;\n\t\tif (!saddr)\n\t\t\tsaddr = inet->mc_addr;\n\t} else if (!ipc.oif)\n\t\tipc.oif = inet->uc_index;\n\n\tflowi4_init_output(&fl4, ipc.oif, sk->sk_mark, tos,\n\t\t\t RT_SCOPE_UNIVERSE,\n\t\t\t inet->hdrincl ? IPPROTO_RAW : sk->sk_protocol,\n\t\t\t inet_sk_flowi_flags(sk) |\n\t\t\t (inet->hdrincl ? FLOWI_FLAG_KNOWN_NH : 0),\n\t\t\t daddr, saddr, 0, 0, sk->sk_uid);\n\n\tif (!inet->hdrincl) {\n\t\trfv.msg = msg;\n\t\trfv.hlen = 0;\n\n\t\terr = raw_probe_proto_opt(&rfv, &fl4);\n\t\tif (err)\n\t\t\tgoto done;\n\t}\n\n\tsecurity_sk_classify_flow(sk, flowi4_to_flowi(&fl4));\n\trt = ip_route_output_flow(net, &fl4, sk);\n\tif (IS_ERR(rt)) {\n\t\terr = PTR_ERR(rt);\n\t\trt = NULL;\n\t\tgoto done;\n\t}\n\n\terr = -EACCES;\n\tif (rt->rt_flags & RTCF_BROADCAST && !sock_flag(sk, SOCK_BROADCAST))\n\t\tgoto done;\n\n\tif (msg->msg_flags & MSG_CONFIRM)\n\t\tgoto do_confirm;\nback_from_confirm:\n\n\tif (inet->hdrincl)\n\t\terr = raw_send_hdrinc(sk, &fl4, msg, len,\n\t\t\t\t &rt, msg->msg_flags, &ipc.sockc);\n\n\t else {\n\t\tsock_tx_timestamp(sk, ipc.sockc.tsflags, &ipc.tx_flags);\n\n\t\tif (!ipc.addr)\n\t\t\tipc.addr = fl4.daddr;\n\t\tlock_sock(sk);\n\t\terr = ip_append_data(sk, &fl4, raw_getfrag,\n\t\t\t\t &rfv, len, 0,\n\t\t\t\t &ipc, &rt, msg->msg_flags);\n\t\tif (err)\n\t\t\tip_flush_pending_frames(sk);\n\t\telse if (!(msg->msg_flags & MSG_MORE)) {\n\t\t\terr = ip_push_pending_frames(sk, &fl4);\n\t\t\tif (err == -ENOBUFS && !inet->recverr)\n\t\t\t\terr = 0;\n\t\t}\n\t\trelease_sock(sk);\n\t}\ndone:\n\tif (free)\n\t\tkfree(ipc.opt);\n\tip_rt_put(rt);\n\nout:\n\tif (err < 0)\n\t\treturn err;\n\treturn len;\n\ndo_confirm:\n\tif (msg->msg_flags & MSG_PROBE)\n\t\tdst_confirm_neigh(&rt->dst, &fl4.daddr);\n\tif (!(msg->msg_flags & MSG_PROBE) || len)\n\t\tgoto back_from_confirm;\n\terr = 0;\n\tgoto done;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "zephyr_print(netdissect_options *ndo, const u_char *cp, int length)\n{\n struct z_packet z;\n const char *parse = (const char *) cp;\n int parselen = length;\n const char *s;\n int lose = 0;\n int truncated = 0;\n\n /* squelch compiler warnings */\n\n z.kind = 0;\n z.class = 0;\n z.inst = 0;\n z.opcode = 0;\n z.sender = 0;\n z.recipient = 0;\n\n#define PARSE_STRING\t\t\t\t\t\t\\\n\ts = parse_field(ndo, &parse, &parselen, &truncated);\t\\\n\tif (truncated) goto trunc;\t\t\t\t\\\n\tif (!s) lose = 1;\n\n#define PARSE_FIELD_INT(field)\t\t\t\\\n\tPARSE_STRING\t\t\t\t\\\n\tif (!lose) field = strtol(s, 0, 16);\n\n#define PARSE_FIELD_STR(field)\t\t\t\\\n\tPARSE_STRING\t\t\t\t\\\n\tif (!lose) field = s;\n\n PARSE_FIELD_STR(z.version);\n if (lose) return;\n if (strncmp(z.version, \"ZEPH\", 4))\n\treturn;\n\n PARSE_FIELD_INT(z.numfields);\n PARSE_FIELD_INT(z.kind);\n PARSE_FIELD_STR(z.uid);\n PARSE_FIELD_INT(z.port);\n PARSE_FIELD_INT(z.auth);\n PARSE_FIELD_INT(z.authlen);\n PARSE_FIELD_STR(z.authdata);\n PARSE_FIELD_STR(z.class);\n PARSE_FIELD_STR(z.inst);\n PARSE_FIELD_STR(z.opcode);\n PARSE_FIELD_STR(z.sender);\n PARSE_FIELD_STR(z.recipient);\n PARSE_FIELD_STR(z.format);\n PARSE_FIELD_INT(z.cksum);\n PARSE_FIELD_INT(z.multi);\n PARSE_FIELD_STR(z.multi_uid);\n\n if (lose)\n goto trunc;\n\n ND_PRINT((ndo, \" zephyr\"));\n if (strncmp(z.version+4, \"0.2\", 3)) {\n\tND_PRINT((ndo, \" v%s\", z.version+4));\n\treturn;\n }\n\n ND_PRINT((ndo, \" %s\", tok2str(z_types, \"type %d\", z.kind)));\n if (z.kind == Z_PACKET_SERVACK) {\n\t/* Initialization to silence warnings */\n\tconst char *ackdata = NULL;\n\tPARSE_FIELD_STR(ackdata);\n\tif (!lose && strcmp(ackdata, \"SENT\"))\n\t ND_PRINT((ndo, \"/%s\", str_to_lower(ackdata)));\n }\n if (*z.sender) ND_PRINT((ndo, \" %s\", z.sender));\n\n if (!strcmp(z.class, \"USER_LOCATE\")) {\n\tif (!strcmp(z.opcode, \"USER_HIDE\"))\n\t ND_PRINT((ndo, \" hide\"));\n\telse if (!strcmp(z.opcode, \"USER_UNHIDE\"))\n\t ND_PRINT((ndo, \" unhide\"));\n\telse\n\t ND_PRINT((ndo, \" locate %s\", z.inst));\n\treturn;\n }\n\n if (!strcmp(z.class, \"ZEPHYR_ADMIN\")) {\n\tND_PRINT((ndo, \" zephyr-admin %s\", str_to_lower(z.opcode)));\n\treturn;\n }\n\n if (!strcmp(z.class, \"ZEPHYR_CTL\")) {\n\tif (!strcmp(z.inst, \"CLIENT\")) {\n\t if (!strcmp(z.opcode, \"SUBSCRIBE\") ||\n\t\t!strcmp(z.opcode, \"SUBSCRIBE_NODEFS\") ||\n\t\t!strcmp(z.opcode, \"UNSUBSCRIBE\")) {\n\n\t\tND_PRINT((ndo, \" %ssub%s\", strcmp(z.opcode, \"SUBSCRIBE\") ? \"un\" : \"\",\n\t\t\t\t strcmp(z.opcode, \"SUBSCRIBE_NODEFS\") ? \"\" :\n\t\t\t\t\t\t\t\t \"-nodefs\"));\n\t\tif (z.kind != Z_PACKET_SERVACK) {\n\t\t /* Initialization to silence warnings */\n\t\t const char *c = NULL, *i = NULL, *r = NULL;\n\t\t PARSE_FIELD_STR(c);\n\t\t PARSE_FIELD_STR(i);\n\t\t PARSE_FIELD_STR(r);\n\t\t if (!lose) ND_PRINT((ndo, \" %s\", z_triple(c, i, r)));\n\t\t}\n\t\treturn;\n\t }\n\n\t if (!strcmp(z.opcode, \"GIMME\")) {\n\t\tND_PRINT((ndo, \" ret\"));\n\t\treturn;\n\t }\n\n\t if (!strcmp(z.opcode, \"GIMMEDEFS\")) {\n\t\tND_PRINT((ndo, \" gimme-defs\"));\n\t\treturn;\n\t }\n\n\t if (!strcmp(z.opcode, \"CLEARSUB\")) {\n\t\tND_PRINT((ndo, \" clear-subs\"));\n\t\treturn;\n\t }\n\n\t ND_PRINT((ndo, \" %s\", str_to_lower(z.opcode)));\n\t return;\n\t}\n\n\tif (!strcmp(z.inst, \"HM\")) {\n\t ND_PRINT((ndo, \" %s\", str_to_lower(z.opcode)));\n\t return;\n\t}\n\n\tif (!strcmp(z.inst, \"REALM\")) {\n\t if (!strcmp(z.opcode, \"ADD_SUBSCRIBE\"))\n\t\tND_PRINT((ndo, \" realm add-subs\"));\n\t if (!strcmp(z.opcode, \"REQ_SUBSCRIBE\"))\n\t\tND_PRINT((ndo, \" realm req-subs\"));\n\t if (!strcmp(z.opcode, \"RLM_SUBSCRIBE\"))\n\t\tND_PRINT((ndo, \" realm rlm-sub\"));\n\t if (!strcmp(z.opcode, \"RLM_UNSUBSCRIBE\"))\n\t\tND_PRINT((ndo, \" realm rlm-unsub\"));\n\t return;\n\t}\n }\n\n if (!strcmp(z.class, \"HM_CTL\")) {\n\tND_PRINT((ndo, \" hm_ctl %s\", str_to_lower(z.inst)));\n\tND_PRINT((ndo, \" %s\", str_to_lower(z.opcode)));\n\treturn;\n }\n\n if (!strcmp(z.class, \"HM_STAT\")) {\n\tif (!strcmp(z.inst, \"HMST_CLIENT\") && !strcmp(z.opcode, \"GIMMESTATS\")) {\n\t ND_PRINT((ndo, \" get-client-stats\"));\n\t return;\n\t}\n }\n\n if (!strcmp(z.class, \"WG_CTL\")) {\n\tND_PRINT((ndo, \" wg_ctl %s\", str_to_lower(z.inst)));\n\tND_PRINT((ndo, \" %s\", str_to_lower(z.opcode)));\n\treturn;\n }\n\n if (!strcmp(z.class, \"LOGIN\")) {\n\tif (!strcmp(z.opcode, \"USER_FLUSH\")) {\n\t ND_PRINT((ndo, \" flush_locs\"));\n\t return;\n\t}\n\n\tif (!strcmp(z.opcode, \"NONE\") ||\n\t !strcmp(z.opcode, \"OPSTAFF\") ||\n\t !strcmp(z.opcode, \"REALM-VISIBLE\") ||\n\t !strcmp(z.opcode, \"REALM-ANNOUNCED\") ||\n\t !strcmp(z.opcode, \"NET-VISIBLE\") ||\n\t !strcmp(z.opcode, \"NET-ANNOUNCED\")) {\n\t ND_PRINT((ndo, \" set-exposure %s\", str_to_lower(z.opcode)));\n\t return;\n\t}\n }\n\n if (!*z.recipient)\n\tz.recipient = \"*\";\n\n ND_PRINT((ndo, \" to %s\", z_triple(z.class, z.inst, z.recipient)));\n if (*z.opcode)\n\tND_PRINT((ndo, \" op %s\", z.opcode));\n return;\n\ntrunc:\n ND_PRINT((ndo, \" [|zephyr] (%d)\", length));\n return;\n}", "label": 1, "label_name": "safe"} -{"code": " public function __construct($definition, $parent = null)\n {\n $parent = $parent ? $parent : $definition->defaultPlist;\n $this->plist = new HTMLPurifier_PropertyList($parent);\n $this->def = $definition; // keep a copy around for checking\n $this->parser = new HTMLPurifier_VarParser_Flexible();\n }", "label": 1, "label_name": "safe"} -{"code": " public void testExposedCiphertext() throws Exception {\n boolean saveEnabled = Item.EXTENDED_READ.getEnabled();\n try {\n jenkins.setSecurityRealm(createDummySecurityRealm());\n // TODO 1.645+ use MockAuthorizationStrategy\n GlobalMatrixAuthorizationStrategy pmas = new GlobalMatrixAuthorizationStrategy();\n pmas.add(Jenkins.ADMINISTER, \"admin\");\n pmas.add(Jenkins.READ, \"dev\");\n pmas.add(Item.READ, \"dev\");\n Item.EXTENDED_READ.setEnabled(true);\n pmas.add(Item.EXTENDED_READ, \"dev\");\n pmas.add(Item.CREATE, \"dev\"); // so we can show CopyJobCommand would barf; more realistic would be to grant it only in a subfolder\n jenkins.setAuthorizationStrategy(pmas);\n Secret s = Secret.fromString(\"s3cr3t\");\n String sEnc = s.getEncryptedValue();\n FreeStyleProject p = createFreeStyleProject(\"p\");\n p.setDisplayName(\"Unicode here \u2190\");\n p.setDescription(\"This+looks+like+Base64+but+is+not+a+secret\");\n p.addProperty(new VulnerableProperty(s));\n WebClient wc = createWebClient();\n // Control case: an administrator can read and write configuration freely.\n wc.login(\"admin\");\n HtmlPage configure = wc.getPage(p, \"configure\");\n assertThat(configure.getWebResponse().getContentAsString(), containsString(sEnc));\n submit(configure.getFormByName(\"config\"));\n VulnerableProperty vp = p.getProperty(VulnerableProperty.class);\n assertNotNull(vp);\n assertEquals(s, vp.secret);\n Page configXml = wc.goTo(p.getUrl() + \"config.xml\", \"application/xml\");\n String xmlAdmin = configXml.getWebResponse().getContentAsString();\n assertThat(xmlAdmin, containsString(\"\" + sEnc + \"\"));\n assertThat(xmlAdmin, containsString(\"\" + p.getDisplayName() + \"\"));\n assertThat(xmlAdmin, containsString(\"\" + p.getDescription() + \"\"));\n // CLICommandInvoker does not work here, as it sets up its own SecurityRealm + AuthorizationStrategy.\n GetJobCommand getJobCommand = new GetJobCommand();\n Authentication adminAuth = User.get(\"admin\").impersonate();\n getJobCommand.setTransportAuth(adminAuth);\n ByteArrayOutputStream baos = new ByteArrayOutputStream();\n String pName = p.getFullName();\n getJobCommand.main(Collections.singletonList(pName), Locale.ENGLISH, System.in, new PrintStream(baos), System.err);\n assertEquals(xmlAdmin, baos.toString(configXml.getWebResponse().getContentCharset()));\n CopyJobCommand copyJobCommand = new CopyJobCommand();\n copyJobCommand.setTransportAuth(adminAuth);\n String pAdminName = pName + \"-admin\";\n assertEquals(0, copyJobCommand.main(Arrays.asList(pName, pAdminName), Locale.ENGLISH, System.in, System.out, System.err));\n FreeStyleProject pAdmin = jenkins.getItemByFullName(pAdminName, FreeStyleProject.class);\n assertNotNull(pAdmin);\n pAdmin.setDisplayName(p.getDisplayName()); // counteract DisplayNameListener\n assertEquals(p.getConfigFile().asString(), pAdmin.getConfigFile().asString());\n // Test case: another user with EXTENDED_READ but not CONFIGURE should not get access even to encrypted secrets.\n wc.login(\"dev\");\n configure = wc.getPage(p, \"configure\");\n assertThat(configure.getWebResponse().getContentAsString(), not(containsString(sEnc)));\n configXml = wc.goTo(p.getUrl() + \"config.xml\", \"application/xml\");\n String xmlDev = configXml.getWebResponse().getContentAsString();\n assertThat(xmlDev, not(containsString(sEnc)));\n assertEquals(xmlAdmin.replace(sEnc, \"********\"), xmlDev);\n getJobCommand = new GetJobCommand();\n Authentication devAuth = User.get(\"dev\").impersonate();\n getJobCommand.setTransportAuth(devAuth);\n baos = new ByteArrayOutputStream();\n getJobCommand.main(Collections.singletonList(pName), Locale.ENGLISH, System.in, new PrintStream(baos), System.err);\n assertEquals(xmlDev, baos.toString(configXml.getWebResponse().getContentCharset()));\n copyJobCommand = new CopyJobCommand();\n copyJobCommand.setTransportAuth(devAuth);\n String pDevName = pName + \"-dev\";\n assertThat(copyJobCommand.main(Arrays.asList(pName, pDevName), Locale.ENGLISH, System.in, System.out, System.err), not(0));\n assertNull(jenkins.getItemByFullName(pDevName, FreeStyleProject.class));\n\n } finally {\n Item.EXTENDED_READ.setEnabled(saveEnabled);\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": "static bool read_phdr(ELFOBJ *bin, bool linux_kernel_hack) {\n\tbool phdr_found = false;\n\tint i;\n#if R_BIN_ELF64\n\tconst bool is_elf64 = true;\n#else\n\tconst bool is_elf64 = false;\n#endif\n\tut64 phnum = Elf_(r_bin_elf_get_phnum) (bin);\n\tfor (i = 0; i < phnum; i++) {\n\t\tut8 phdr[sizeof (Elf_(Phdr))] = {0};\n\t\tint j = 0;\n\t\tconst size_t rsize = bin->ehdr.e_phoff + i * sizeof (Elf_(Phdr));\n\t\tint len = r_buf_read_at (bin->b, rsize, phdr, sizeof (Elf_(Phdr)));\n\t\tif (len < 1) {\n\t\t\tR_LOG_ERROR (\"read (phdr)\");\n\t\t\tR_FREE (bin->phdr);\n\t\t\treturn false;\n\t\t}\n\t\tbin->phdr[i].p_type = READ32 (phdr, j);\n\t\tif (bin->phdr[i].p_type == PT_PHDR) {\n\t\t\tphdr_found = true;\n\t\t}\n\n\t\tif (is_elf64) {\n\t\t\tbin->phdr[i].p_flags = READ32 (phdr, j);\n\t\t}\n\t\tbin->phdr[i].p_offset = R_BIN_ELF_READWORD (phdr, j);\n\t\tbin->phdr[i].p_vaddr = R_BIN_ELF_READWORD (phdr, j);\n\t\tbin->phdr[i].p_paddr = R_BIN_ELF_READWORD (phdr, j);\n\t\tbin->phdr[i].p_filesz = R_BIN_ELF_READWORD (phdr, j);\n\t\tbin->phdr[i].p_memsz = R_BIN_ELF_READWORD (phdr, j);\n\t\tif (!is_elf64) {\n\t\t\tbin->phdr[i].p_flags = READ32 (phdr, j);\n\t\t//\tbin->phdr[i].p_flags |= 1; tiny.elf needs this somehow :? LOAD0 is always +x for linux?\n\t\t}\n\t\tbin->phdr[i].p_align = R_BIN_ELF_READWORD (phdr, j);\n\t}\n\t/* Here is the where all the fun starts.\n\t * Linux kernel since 2005 calculates phdr offset wrongly\n\t * adding it to the load address (va of the LOAD0).\n\t * See `fs/binfmt_elf.c` file this line:\n\t * NEW_AUX_ENT(AT_PHDR, load_addr + exec->e_phoff);\n\t * So after the first read, we fix the address and read it again\n\t */\n\tif (linux_kernel_hack && phdr_found) {\n\t\tut64 load_addr = Elf_(r_bin_elf_get_baddr) (bin);\n\t\tbin->ehdr.e_phoff = Elf_(r_bin_elf_v2p) (bin, load_addr + bin->ehdr.e_phoff);\n\t\treturn read_phdr (bin, false);\n\t}\n\n\treturn true;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " it 'loadyamls array of values' do\n shell(\"echo '---\n aaa: 1\n bbb: 2\n ccc: 3\n ddd: 4' > #{tmpdir}/testyaml.yaml\")\n pp = <<-EOS\n $o = loadyaml('#{tmpdir}/testyaml.yaml')\n notice(inline_template('loadyaml[aaa] is <%= @o[\"aaa\"].inspect %>'))\n notice(inline_template('loadyaml[bbb] is <%= @o[\"bbb\"].inspect %>'))\n notice(inline_template('loadyaml[ccc] is <%= @o[\"ccc\"].inspect %>'))\n notice(inline_template('loadyaml[ddd] is <%= @o[\"ddd\"].inspect %>'))\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/loadyaml\\[aaa\\] is 1/)\n expect(r.stdout).to match(/loadyaml\\[bbb\\] is 2/)\n expect(r.stdout).to match(/loadyaml\\[ccc\\] is 3/)\n expect(r.stdout).to match(/loadyaml\\[ddd\\] is 4/)\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": "typeof k?k:j).call(this);this.fire(\"focus\")};c.isFocusable&&(this.isFocusable=this.isFocusable);this.keyboardFocusable=!0}CKEDITOR.ui.dialog.uiElement.call(this,e,c,h,\"span\",null,null,\"\");h=h.join(\"\").match(b);g=g.match(a)||[\"\",\"\",\"\"];d.test(g[1])&&(g[1]=g[1].slice(0,-1),g[2]=\"/\"+g[2]);f.push([g[1],\" \",h[1]||\"\",g[2]].join(\"\"))}}}(),fieldset:function(b,a,d,e,c){var f=c.label;this._={children:a};CKEDITOR.ui.dialog.uiElement.call(this,b,c,e,\"fieldset\",null,null,function(){var a=[];f&&a.push(\"\"+f+\"\");for(var b=0;ba.getChildCount()?(new CKEDITOR.dom.text(b,CKEDITOR.document)).appendTo(a):a.getChild(0).$.nodeValue=b;return this},getLabel:function(){var b=", "label": 1, "label_name": "safe"} -{"code": "\teach: function( callback, args ) {\n\t\treturn jQuery.each( this, callback, args );\n\t},", "label": 0, "label_name": "vulnerable"} -{"code": " function displayRecoveryResetForm($id, $errormessage = '')\n {\n if (!empty($errormessage)) {\n echo \"
\";\n echo \"{$errormessage}
\";\n }\n\n echo \"
\\n\";\n echo \"\";\n echo \"\\n\";\n\n echo \"
\".$GLOBALS['strPwdRecEnterPassword'].\"
\";\n echo \"\";\n echo \"\";\n echo \"\";\n echo \"\";\n echo \"\";\n echo \"\";\n echo \"
\".$GLOBALS['strPassword'].\": 
\".$GLOBALS['strRepeatPassword'].\": 
 
\";\n\n echo \"
\\n\";\n }", "label": 1, "label_name": "safe"} -{"code": "cssp_read_tsrequest(STREAM token, STREAM pubkey)\n{\n\tSTREAM s;\n\tint length;\n\tint tagval;\n\n\ts = tcp_recv(NULL, 4);\n\n\tif (s == NULL)\n\t\treturn False;\n\n\t// verify ASN.1 header\n\tif (s->p[0] != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t{\n\t\tlogger(Protocol, Error,\n\t\t \"cssp_read_tsrequest(), expected BER_TAG_SEQUENCE|BER_TAG_CONSTRUCTED, got %x\",\n\t\t s->p[0]);\n\t\treturn False;\n\t}\n\n\t// peek at first 4 bytes to get full message length\n\tif (s->p[1] < 0x80)\n\t\tlength = s->p[1] - 2;\n\telse if (s->p[1] == 0x81)\n\t\tlength = s->p[2] - 1;\n\telse if (s->p[1] == 0x82)\n\t\tlength = (s->p[2] << 8) | s->p[3];\n\telse\n\t\treturn False;\n\n\t// receive the remainings of message\n\ts = tcp_recv(s, length);\n\n\t// parse the response and into nego token\n\tif (!ber_in_header(s, &tagval, &length) ||\n\t tagval != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t\treturn False;\n\n\t// version [0]\n\tif (!ber_in_header(s, &tagval, &length) ||\n\t tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 0))\n\t\treturn False;\n\tin_uint8s(s, length);\n\n\t// negoToken [1]\n\tif (token)\n\t{\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 1))\n\t\t\treturn False;\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t\t\treturn False;\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t\t\treturn False;\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 0))\n\t\t\treturn False;\n\n\t\tif (!ber_in_header(s, &tagval, &length) || tagval != BER_TAG_OCTET_STRING)\n\t\t\treturn False;\n\n\t\ttoken->end = token->p = token->data;\n\t\tout_uint8p(token, s->p, length);\n\t\ts_mark_end(token);\n\t}\n\n\t// pubKey [3]\n\tif (pubkey)\n\t{\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 3))\n\t\t\treturn False;\n\n\t\tif (!ber_in_header(s, &tagval, &length) || tagval != BER_TAG_OCTET_STRING)\n\t\t\treturn False;\n\n\t\tpubkey->data = pubkey->p = s->p;\n\t\tpubkey->end = pubkey->data + length;\n\t\tpubkey->size = length;\n\t}\n\n\n\treturn True;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "function dialog_ajax(a,b,c,d,e,f,g,h){b=\"undefined\"==typeof b||!1===b?alert(\"You send an invalid url\"):b;d=\"undefined\"==typeof d||!1===d?\"POST\":d;e=\"undefined\"==typeof e||!1===e?\"JSON\":e;h=\"undefined\"==typeof h||!1===h?$(\"document.body\"):h;a=\"undefined\"==typeof a||!1===a?set_popup_title():a;c._cat_ajax=1;$.ajax({type:d,url:b,dataType:e,context:h,data:c,beforeSend:function(b){$(\".fc_popup\").remove();b.process=set_activity(a);\"undefined\"!=typeof f&&!1!==f&&f.call(this)},success:function(a,b,c){return_success(c.process,", "label": 1, "label_name": "safe"} -{"code": " def test_modify_access_allow(self):\n url = reverse('modify_access', kwargs={'course_id': self.course.id.to_deprecated_string()})\n response = self.client.get(url, {\n 'unique_student_identifier': self.other_user.email,\n 'rolename': 'staff',\n 'action': 'allow',\n })\n self.assertEqual(response.status_code, 200)", "label": 0, "label_name": "vulnerable"} -{"code": "(g=j?b(g,a[d],d,a):a[d],j=!0,d+=f);return g}function Ga(a,b) {var c=m.defaults.column,d=a.aoColumns.length,c=h.extend({},m.models.oColumn,c,{nTh:b?b:H.createElement(\"th\"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:\"\",aDataSort:c.aDataSort?c.aDataSort:[d],mData:c.mData?c.mData:d,idx:d});a.aoColumns.push(c);c=a.aoPreSearchCols;c[d]=h.extend({},m.models.oSearch,c[d]);la(a,d,h(b).data())}function la(a,b,c) {var b=a.aoColumns[b],d=a.oClasses,e=h(b.nTh);if (!b.sWidthOrig) {b.sWidthOrig=e.attr(\"width\")||null;var f=\n(e.attr(\"style\")||\"\").match(/width:\\s*(\\d+[pxem%]+)/);f&&(b.sWidthOrig=f[1])}c!==k&&null!==c&&(fb(c),J(m.defaults.column,c),c.mDataProp!==k&&!c.mData&&(c.mData=c.mDataProp),c.sType&&(b._sManualType=c.sType),c.className&&!c.sClass&&(c.sClass=c.className),h.extend(b,c),F(b,c,\"sWidth\",\"sWidthOrig\"),c.iDataSort!==k&&(b.aDataSort=[c.iDataSort]),F(b,c,\"aDataSort\"));var g=b.mData,j=Q(g),i=b.mRender?Q(b.mRender):null,c=function(a) {return\"string\"===typeof a&&-1!==a.indexOf(\"@\")};b._bAttrSrc=h.isPlainObject(g)&&\n(c(g.sort)||c(g.type)||c(g.filter));b.fnGetData=function(a,b,c) {var d=j(a,b,k,c);return i&&b?i(d,b,a,c):d};b.fnSetData=function(a,b,c) {return R(g)(a,b,c)};\"number\"!==typeof g&&(a._rowReadObject=!0);a.oFeatures.bSort||(b.bSortable=!1,e.addClass(d.sSortableNone));a=-1!==h.inArray(\"asc\",b.asSorting);c=-1!==h.inArray(\"desc\",b.asSorting);!b.bSortable||!a&&!c?(b.sSortingClass=d.sSortableNone,b.sSortingClassJUI=\"\"):a&&!c?(b.sSortingClass=d.sSortableAsc,b.sSortingClassJUI=d.sSortJUIAscAllowed):!a&&c?(b.sSortingClass=\nd.sSortableDesc,b.sSortingClassJUI=d.sSortJUIDescAllowed):(b.sSortingClass=d.sSortable,b.sSortingClassJUI=d.sSortJUI)}function U(a) {if (!1!==a.oFeatures.bAutoWidth) {var b=a.aoColumns;Ha(a);for(var c=0,d=b.length;c= 0; i--, j++) {\n if (!fp_is_bit_set(e, i) || j == CT_INV_MOD_PRE_CNT)\n break;\n }\n fp_copy(&pre[j-1], t);\n for (j = 0; i >= 0; i--) {\n int set = fp_is_bit_set(e, i);\n\n if ((j == CT_INV_MOD_PRE_CNT) || (!set && j > 0)) {\n fp_mul(t, &pre[j-1], t);\n fp_montgomery_reduce(t, b, mp);\n j = 0;\n }\n fp_sqr(t, t);\n fp_montgomery_reduce(t, b, mp);\n j += set;\n }\n if (j > 0) {\n fp_mul(t, &pre[j-1], c);\n fp_montgomery_reduce(c, b, mp);\n }\n else \n fp_copy(t, c);\n\n#ifdef WOLFSSL_SMALL_STACK\n XFREE(t, NULL, DYNAMIC_TYPE_BIGINT);\n#endif\n return FP_OKAY;\n}", "label": 1, "label_name": "safe"} -{"code": " public static function BBCode2Html($text) {\n $text = trim($text);\n\n $text = self::parseEmoji($text);\n\n // Smileys to find...\n $in = array(\n );\n\n // And replace them by...\n $out = array(\n );\n\n $in[] = '[/*]';\n $in[] = '[*]';\n $out[] = '';\n $out[] = '
  • ';\n\n $text = str_replace($in, $out, $text);\n\n // BBCode to find...\n $in = array( \t '/\\[b\\](.*?)\\[\\/b\\]/ms',\n '/\\[i\\](.*?)\\[\\/i\\]/ms',\n '/\\[u\\](.*?)\\[\\/u\\]/ms',\n '/\\[mark\\](.*?)\\[\\/mark\\]/ms',\n '/\\[s\\](.*?)\\[\\/s\\]/ms',\n '/\\[list\\=(.*?)\\](.*?)\\[\\/list\\]/ms',\n '/\\[list\\](.*?)\\[\\/list\\]/ms',\n '/\\[\\*\\]\\s?(.*?)\\n/ms',\n '/\\[fs(.*?)\\](.*?)\\[\\/fs(.*?)\\]/ms',\n '/\\[color\\=(.*?)\\](.*?)\\[\\/color\\]/ms'\n );\n\n // And replace them by...\n $out = array(\t '\\1',\n '\\1',\n '\\1',\n '\\1',\n '\\1',\n '\\2',\n '\\1',\n '\\1',\n '\\2',\n '\\2'\n );\n\n $text = preg_replace($in, $out, $text);\n\n // Prepare quote's\n $text = str_replace(\"\\r\\n\",\"\\n\",$text);\n\n // paragraphs\n $text = str_replace(\"\\r\", \"\", $text);\n\n return $text;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " def destroy_workflow\n Log.add_info(request, params.inspect)\n\n return unless request.post?\n\n Item.find(params[:id]).destroy\n\n @tmpl_folder, @tmpl_workflows_folder = TemplatesHelper.get_tmpl_subfolder(TemplatesHelper::TMPL_WORKFLOWS)\n\n @group_id = params[:group_id]\n SqlHelper.validate_token([@group_id])\n\n if @group_id.blank?\n @group_id = '0' # '0' for ROOT\n end\n\n render(:partial => 'groups/ajax_group_workflows', :layout => false)\n end", "label": 1, "label_name": "safe"} -{"code": "mxUtils.convertPoint(m.container,mxEvent.getClientX(E),mxEvent.getClientY(E));mxEvent.consume(E);E=m.view.scale;var S=m.view.translate;m.setSelectionCell(t((H.x-3*E)/E-S.x,(H.y-3*E)/E-S.y))}};u=new mxKeyHandler(m);u.bindKey(46,D);u.bindKey(8,D);m.getRubberband().isForceRubberbandEvent=function(E){return 0==E.evt.button&&(null==E.getCell()||E.getCell()==q)};m.panningHandler.isForcePanningEvent=function(E){return 2==E.evt.button};var v=m.isCellSelectable;m.isCellSelectable=function(E){return E==q?!1:\nv.apply(this,arguments)};m.getLinkForCell=function(){return null};var y=m.view.getState(q);k=m.getAllConnectionConstraints(y);for(var A=0;null!=k&&AIsDefault()) {\n\t\tthrow RuntimeGenericError(\"NativeModule may only be instantiated from default nodejs isolate\");\n\t}\n\tif (uv_dlopen(filename.c_str(), &lib) != 0) {\n\t\tthrow RuntimeGenericError(\"Failed to load module\");\n\t}\n\tif (uv_dlsym(&lib, \"InitForContext\", reinterpret_cast(&init)) != 0 || init == nullptr) {\n\t\tuv_dlclose(&lib);\n\t\tthrow RuntimeGenericError(\"Module is not isolated-vm compatible\");\n\t}\n}", "label": 1, "label_name": "safe"} -{"code": "\tint lazy_bdecode(char const* start, char const* end, lazy_entry& ret\n\t\t, error_code& ec, int* error_pos, int depth_limit, int item_limit)\n\t{\n\t\tchar const* const orig_start = start;\n\t\tret.clear();\n\t\tif (start == end) return 0;\n\n\t\tstd::vector stack;\n\n\t\tstack.push_back(&ret);\n\t\twhile (start < end)\n\t\t{\n\t\t\tif (stack.empty()) break; // done!\n\n\t\t\tlazy_entry* top = stack.back();\n\n\t\t\tif (int(stack.size()) > depth_limit) TORRENT_FAIL_BDECODE(bdecode_errors::depth_exceeded);\n\t\t\tif (start >= end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);\n\t\t\tchar t = *start;\n\t\t\t++start;\n\t\t\tif (start >= end && t != 'e') TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);\n\n\t\t\tswitch (top->type())\n\t\t\t{\n\t\t\t\tcase lazy_entry::dict_t:\n\t\t\t\t{\n\t\t\t\t\tif (t == 'e')\n\t\t\t\t\t{\n\t\t\t\t\t\ttop->set_end(start);\n\t\t\t\t\t\tstack.pop_back();\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (!is_digit(t)) TORRENT_FAIL_BDECODE(bdecode_errors::expected_string);\n\t\t\t\t\tboost::int64_t len = t - '0';\n\t\t\t\t\tstart = parse_int(start, end, ':', len);\n\t\t\t\t\tif (start == 0 || start + len + 3 > end || *start != ':')\n\t\t\t\t\t\tTORRENT_FAIL_BDECODE(bdecode_errors::expected_colon);\n\t\t\t\t\t++start;\n\t\t\t\t\tif (start == end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);\n\t\t\t\t\tlazy_entry* ent = top->dict_append(start);\n\t\t\t\t\tif (ent == 0) TORRENT_FAIL_BDECODE(boost::system::errc::not_enough_memory);\n\t\t\t\t\tstart += len;\n\t\t\t\t\tif (start >= end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);\n\t\t\t\t\tstack.push_back(ent);\n\t\t\t\t\tt = *start;\n\t\t\t\t\t++start;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase lazy_entry::list_t:\n\t\t\t\t{\n\t\t\t\t\tif (t == 'e')\n\t\t\t\t\t{\n\t\t\t\t\t\ttop->set_end(start);\n\t\t\t\t\t\tstack.pop_back();\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tlazy_entry* ent = top->list_append();\n\t\t\t\t\tif (ent == 0) TORRENT_FAIL_BDECODE(boost::system::errc::not_enough_memory);\n\t\t\t\t\tstack.push_back(ent);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: break;\n\t\t\t}\n\n\t\t\t--item_limit;\n\t\t\tif (item_limit <= 0) TORRENT_FAIL_BDECODE(bdecode_errors::limit_exceeded);\n\n\t\t\ttop = stack.back();\n\t\t\tswitch (t)\n\t\t\t{\n\t\t\t\tcase 'd':\n\t\t\t\t\ttop->construct_dict(start - 1);\n\t\t\t\t\tcontinue;\n\t\t\t\tcase 'l':\n\t\t\t\t\ttop->construct_list(start - 1);\n\t\t\t\t\tcontinue;\n\t\t\t\tcase 'i':\n\t\t\t\t{\n\t\t\t\t\tchar const* int_start = start;\n\t\t\t\t\tstart = find_char(start, end, 'e');\n\t\t\t\t\ttop->construct_int(int_start, start - int_start);\n\t\t\t\t\tif (start == end) TORRENT_FAIL_BDECODE(bdecode_errors::unexpected_eof);\n\t\t\t\t\tTORRENT_ASSERT(*start == 'e');\n\t\t\t\t\t++start;\n\t\t\t\t\tstack.pop_back();\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t{\n\t\t\t\t\tif (!is_digit(t))\n\t\t\t\t\t\tTORRENT_FAIL_BDECODE(bdecode_errors::expected_value);\n\n\t\t\t\t\tboost::int64_t len = t - '0';\n\t\t\t\t\tstart = parse_int(start, end, ':', len);\n\t\t\t\t\tif (start == 0 || start + len + 1 > end || *start != ':')\n\t\t\t\t\t\tTORRENT_FAIL_BDECODE(bdecode_errors::expected_colon);\n\t\t\t\t\t++start;\n\t\t\t\t\ttop->construct_string(start, int(len));\n\t\t\t\t\tstack.pop_back();\n\t\t\t\t\tstart += len;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn 0;\n\t\t}\n\t\treturn 0;\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": "static int async_polkit_defer(sd_event_source *s, void *userdata) {\n AsyncPolkitQuery *q = userdata;\n\n assert(s);\n\n /* This is called as idle event source after we processed the async polkit reply, hopefully after the\n * method call we re-enqueued has been properly processed. */\n\n async_polkit_query_free(q);\n return 0;\n}", "label": 1, "label_name": "safe"} -{"code": " private function _mergeAssocArray(&$a1, $a2) {\n foreach ($a2 as $k => $v) {\n if ($v === false) {\n if (isset($a1[$k])) unset($a1[$k]);\n continue;\n }\n $a1[$k] = $v;\n }\n }", "label": 1, "label_name": "safe"} -{"code": "void AnnotateCondVarSignal(const char *file, int line,\n const volatile void *cv){}", "label": 0, "label_name": "vulnerable"} -{"code": "for(ja=ma=0;ja
  • '+", "label": 0, "label_name": "vulnerable"} -{"code": "qemuProcessHandleMonitorEOF(qemuMonitorPtr mon,\n virDomainObjPtr vm,\n void *opaque)\n{\n virQEMUDriverPtr driver = opaque;\n qemuDomainObjPrivatePtr priv;\n struct qemuProcessEvent *processEvent;\n\n virObjectLock(vm);\n\n VIR_DEBUG(\"Received EOF on %p '%s'\", vm, vm->def->name);\n\n priv = vm->privateData;\n if (priv->beingDestroyed) {\n VIR_DEBUG(\"Domain is being destroyed, EOF is expected\");\n goto cleanup;\n }\n\n processEvent = g_new0(struct qemuProcessEvent, 1);\n\n processEvent->eventType = QEMU_PROCESS_EVENT_MONITOR_EOF;\n processEvent->vm = virObjectRef(vm);\n\n if (virThreadPoolSendJob(driver->workerPool, 0, processEvent) < 0) {\n virObjectUnref(vm);\n qemuProcessEventFree(processEvent);\n goto cleanup;\n }\n\n /* We don't want this EOF handler to be called over and over while the\n * thread is waiting for a job.\n */\n virObjectLock(mon);\n qemuMonitorUnregister(mon);\n virObjectUnlock(mon);\n\n /* We don't want any cleanup from EOF handler (or any other\n * thread) to enter qemu namespace. */\n qemuDomainDestroyNamespace(driver, vm);\n\n cleanup:\n virObjectUnlock(vm);\n}", "label": 1, "label_name": "safe"} -{"code": "(function(a,b){var c=!1;a(document).mouseup(function(a){c=!1}),a.widget(\"ui.mouse\",{options:{cancel:\":input,option\",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind(\"mousedown.\"+this.widgetName,function(a){return b._mouseDown(a)}).bind(\"click.\"+this.widgetName,function(c){if(!0===a.data(c.target,b.widgetName+\".preventClickEvent\"))return a.removeData(c.target,b.widgetName+\".preventClickEvent\"),c.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind(\".\"+this.widgetName),this._mouseMoveDelegate&&a(document).unbind(\"mousemove.\"+this.widgetName,this._mouseMoveDelegate).unbind(\"mouseup.\"+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(b){if(c)return;this._mouseStarted&&this._mouseUp(b),this._mouseDownEvent=b;var d=this,e=b.which==1,f=typeof this.options.cancel==\"string\"&&b.target.nodeName?a(b.target).closest(this.options.cancel).length:!1;if(!e||f||!this._mouseCapture(b))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=this._mouseStart(b)!==!1;if(!this._mouseStarted)return b.preventDefault(),!0}return!0===a.data(b.target,this.widgetName+\".preventClickEvent\")&&a.removeData(b.target,this.widgetName+\".preventClickEvent\"),this._mouseMoveDelegate=function(a){return d._mouseMove(a)},this._mouseUpDelegate=function(a){return d._mouseUp(a)},a(document).bind(\"mousemove.\"+this.widgetName,this._mouseMoveDelegate).bind(\"mouseup.\"+this.widgetName,this._mouseUpDelegate),b.preventDefault(),c=!0,!0},_mouseMove:function(b){return!a.browser.msie||document.documentMode>=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp(b)},_mouseUp:function(b){return a(document).unbind(\"mousemove.\"+this.widgetName,this._mouseMoveDelegate).unbind(\"mouseup.\"+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+\".preventClickEvent\",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})})(jQuery);;/*! jQuery UI - v1.8.23 - 2012-08-15", "label": 0, "label_name": "vulnerable"} -{"code": "void DDGifSlurp(GifInfo *info, bool decode, bool exitAfterFrame) {\n\tGifRecordType RecordType;\n\tGifByteType *ExtData;\n\tint ExtFunction;\n\tGifFileType *gifFilePtr;\n\tgifFilePtr = info->gifFilePtr;\n\tuint_fast32_t lastAllocatedGCBIndex = 0;\n\tdo {\n\t\tif (DGifGetRecordType(gifFilePtr, &RecordType) == GIF_ERROR) {\n\t\t\tbreak;\n\t\t}\n\t\tbool isInitialPass = !decode && !exitAfterFrame;\n\t\tswitch (RecordType) {\n\t\t\tcase IMAGE_DESC_RECORD_TYPE:\n\n\t\t\t\tif (DGifGetImageDesc(gifFilePtr, isInitialPass) == GIF_ERROR) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (isInitialPass) {\n\t\t\t\t\tint_fast32_t widthOverflow = gifFilePtr->Image.Width - gifFilePtr->SWidth;\n\t\t\t\t\tint_fast32_t heightOverflow = gifFilePtr->Image.Height - gifFilePtr->SHeight;\n\t\t\t\t\tif (widthOverflow > 0 || heightOverflow > 0) {\n\t\t\t\t\t\tgifFilePtr->SWidth += widthOverflow;\n\t\t\t\t\t\tgifFilePtr->SHeight += heightOverflow;\n\t\t\t\t\t}\n\t\t\t\t\tSavedImage *sp = &gifFilePtr->SavedImages[gifFilePtr->ImageCount - 1];\n\t\t\t\t\tint_fast32_t topOverflow = gifFilePtr->Image.Top + gifFilePtr->Image.Height - gifFilePtr->SHeight;\n\t\t\t\t\tif (topOverflow > 0) {\n\t\t\t\t\t\tsp->ImageDesc.Top -= topOverflow;\n\t\t\t\t\t}\n\n\t\t\t\t\tint_fast32_t leftOverflow = gifFilePtr->Image.Left + gifFilePtr->Image.Width - gifFilePtr->SWidth;\n\t\t\t\t\tif (leftOverflow > 0) {\n\t\t\t\t\t\tsp->ImageDesc.Left -= leftOverflow;\n\t\t\t\t\t}\n\t\t\t\t\tif (!updateGCB(info, &lastAllocatedGCBIndex)) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (decode) {\n\t\t\t\t\tconst uint_fast32_t newRasterSize = gifFilePtr->Image.Width * gifFilePtr->Image.Height;\n\t\t\t\t\tif (newRasterSize == 0) {\n\t\t\t\t\t\tfree(info->rasterBits);\n\t\t\t\t\t\tinfo->rasterBits = NULL;\n\t\t\t\t\t\tinfo->rasterSize = newRasterSize;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst int_fast32_t widthOverflow = gifFilePtr->Image.Width - info->originalWidth;\n\t\t\t\t\tconst int_fast32_t heightOverflow = gifFilePtr->Image.Height - info->originalHeight;\n\t\t\t\t\tif (newRasterSize > info->rasterSize || widthOverflow > 0 || heightOverflow > 0) {\n\t\t\t\t\t\tvoid *tmpRasterBits = reallocarray(info->rasterBits, newRasterSize, sizeof(GifPixelType));\n\t\t\t\t\t\tif (tmpRasterBits == NULL) {\n\t\t\t\t\t\t\tgifFilePtr->Error = D_GIF_ERR_NOT_ENOUGH_MEM;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinfo->rasterBits = tmpRasterBits;\n\t\t\t\t\t\tinfo->rasterSize = newRasterSize;\n\t\t\t\t\t}\n\t\t\t\t\tif (gifFilePtr->Image.Interlace) {\n\t\t\t\t\t\tuint_fast16_t i, j;\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * The way an interlaced image should be read -\n\t\t\t\t\t\t * offsets and jumps...\n\t\t\t\t\t\t */\n\t\t\t\t\t\tuint_fast8_t InterlacedOffset[] = {0, 4, 2, 1};\n\t\t\t\t\t\tuint_fast8_t InterlacedJumps[] = {8, 8, 4, 2};\n\t\t\t\t\t\t/* Need to perform 4 passes on the image */\n\t\t\t\t\t\tfor (i = 0; i < 4; i++)\n\t\t\t\t\t\t\tfor (j = InterlacedOffset[i]; j < gifFilePtr->Image.Height; j += InterlacedJumps[i]) {\n\t\t\t\t\t\t\t\tif (DGifGetLine(gifFilePtr, info->rasterBits + j * gifFilePtr->Image.Width, gifFilePtr->Image.Width) == GIF_ERROR)\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (DGifGetLine(gifFilePtr, info->rasterBits, gifFilePtr->Image.Width * gifFilePtr->Image.Height) == GIF_ERROR) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (info->sampleSize > 1) {\n\t\t\t\t\t\tunsigned char *dst = info->rasterBits;\n\t\t\t\t\t\tunsigned char *src = info->rasterBits;\n\t\t\t\t\t\tunsigned char *const srcEndImage = info->rasterBits + gifFilePtr->Image.Width * gifFilePtr->Image.Height;\n\t\t\t\t\t\tdo {\n\t\t\t\t\t\t\tunsigned char *srcNextLineStart = src + gifFilePtr->Image.Width * info->sampleSize;\n\t\t\t\t\t\t\tunsigned char *const srcEndLine = src + gifFilePtr->Image.Width;\n\t\t\t\t\t\t\tunsigned char *dstEndLine = dst + gifFilePtr->Image.Width / info->sampleSize;\n\t\t\t\t\t\t\tdo {\n\t\t\t\t\t\t\t\t*dst = *src;\n\t\t\t\t\t\t\t\tdst++;\n\t\t\t\t\t\t\t\tsrc += info->sampleSize;\n\t\t\t\t\t\t\t} while (src < srcEndLine);\n\t\t\t\t\t\t\tdst = dstEndLine;\n\t\t\t\t\t\t\tsrc = srcNextLineStart;\n\t\t\t\t\t\t} while (src < srcEndImage);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t} else {\n\t\t\t\t\tdo {\n\t\t\t\t\t\tif (DGifGetCodeNext(gifFilePtr, &ExtData) == GIF_ERROR) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t} while (ExtData != NULL);\n\t\t\t\t\tif (exitAfterFrame) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase EXTENSION_RECORD_TYPE:\n\t\t\t\tif (DGifGetExtension(gifFilePtr, &ExtFunction, &ExtData) == GIF_ERROR) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (isInitialPass) {\n\t\t\t\t\tupdateGCB(info, &lastAllocatedGCBIndex);\n\t\t\t\t\tif (readExtensions(ExtFunction, ExtData, info) == GIF_ERROR) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\twhile (ExtData != NULL) {\n\t\t\t\t\tif (DGifGetExtensionNext(gifFilePtr, &ExtData) == GIF_ERROR) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif (isInitialPass && readExtensions(ExtFunction, ExtData, info) == GIF_ERROR) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase TERMINATE_RECORD_TYPE:\n\t\t\t\tbreak;\n\n\t\t\tdefault: /* Should be trapped by DGifGetRecordType */\n\t\t\t\tbreak;\n\t\t}\n\t} while (RecordType != TERMINATE_RECORD_TYPE);\n\n\tinfo->rewindFunction(info);\n}", "label": 1, "label_name": "safe"} -{"code": " where: { userId: Not(adminUser.id), organizationId: org.id },\n });\n expect(organizationUserUpdated.status).toEqual('active');\n });", "label": 1, "label_name": "safe"} -{"code": " public void translate(ServerEntityMetadataPacket packet, GeyserSession session) {\n Entity entity;\n if (packet.getEntityId() == session.getPlayerEntity().getEntityId()) {\n entity = session.getPlayerEntity();\n } else {\n entity = session.getEntityCache().getEntityByJavaId(packet.getEntityId());\n }\n if (entity == null) return;\n\n for (EntityMetadata metadata : packet.getMetadata()) {\n try {\n entity.updateBedrockMetadata(metadata, session);\n } catch (ClassCastException e) {\n // Class cast exceptions are really the only ones we're going to get in normal gameplay\n // Because some entity rewriters forget about some values\n // Any other errors are actual bugs\n session.getConnector().getLogger().warning(LanguageUtils.getLocaleStringLog(\"geyser.network.translator.metadata.failed\", metadata, entity.getEntityType()));\n session.getConnector().getLogger().debug(\"Entity Java ID: \" + entity.getEntityId() + \", Geyser ID: \" + entity.getGeyserId());\n if (session.getConnector().getConfig().isDebugMode()) {\n e.printStackTrace();\n }\n }\n }\n\n entity.updateBedrockMetadata(session);\n\n // Update the interactive tag, if necessary\n if (session.getMouseoverEntity() != null && session.getMouseoverEntity().getEntityId() == entity.getEntityId()) {\n InteractiveTagManager.updateTag(session, entity);\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": "0),!1,null,0,v));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,0,.5*v));return c};Ka.prototype.getConstraints=function(c,l,x){c=[];var p=Math.max(0,Math.min(l,parseFloat(mxUtils.getValue(this.style,\"dx\",this.dx)))),v=Math.max(0,Math.min(x,parseFloat(mxUtils.getValue(this.style,\"dy\",this.dy))));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1));c.push(new mxConnectionConstraint(new mxPoint(.5,0),!1));c.push(new mxConnectionConstraint(new mxPoint(1,0),!1));c.push(new mxConnectionConstraint(new mxPoint(0,\n0),!1,null,l,.5*v));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,l,v));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,.5*(l+p),v));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,p,v));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,p,.5*(x+v)));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,p,x));c.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,.5*p,x));c.push(new mxConnectionConstraint(new mxPoint(0,.5),!1));c.push(new mxConnectionConstraint(new mxPoint(0,\n1),!1));return c};bb.prototype.constraints=[new mxConnectionConstraint(new mxPoint(0,0),!1),new mxConnectionConstraint(new mxPoint(0,.5),!1),new mxConnectionConstraint(new mxPoint(0,1),!1),new mxConnectionConstraint(new mxPoint(.25,.5),!1),new mxConnectionConstraint(new mxPoint(.5,.5),!1),new mxConnectionConstraint(new mxPoint(.75,.5),!1),new mxConnectionConstraint(new mxPoint(1,0),!1),new mxConnectionConstraint(new mxPoint(1,.5),!1),new mxConnectionConstraint(new mxPoint(1,1),!1)];$a.prototype.getConstraints=", "label": 1, "label_name": "safe"} -{"code": "static cJSON *cJSON_New_Item(void)\n{\n\tcJSON* node = (cJSON*)cJSON_malloc(sizeof(cJSON));\n\tif (node) memset(node,0,sizeof(cJSON));\n\treturn node;\n}", "label": 1, "label_name": "safe"} -{"code": " public ECIESwithAESCBC()\n {\n super(new CBCBlockCipher(new AESEngine()), 16);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic function isOpenReferenceConflict( $parameter ) {\n\t\tif ( array_key_exists( $parameter, $this->data ) ) {\n\t\t\tif ( array_key_exists( 'open_ref_conflict', $this->data[$parameter] ) ) {\n\t\t\t\treturn (bool)$this->data[$parameter]['open_ref_conflict'];\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\tthrow new MWException( __METHOD__ . \": Attempted to load a parameter that does not exist.\" );\n\t}", "label": 1, "label_name": "safe"} -{"code": "usage (int status)\n{\n if (status != EXIT_SUCCESS)\n fprintf (stderr, _(\"Try `%s --help' for more information.\\n\"),\n\t program_name);\n else\n {\n printf (_(\"\\\nUsage: %s [OPTION]... [STRINGS]...\\n\\\n\"), program_name);\n fputs (_(\"\\\nInternationalized Domain Name (IDNA2008) convert STRINGS, or standard input.\\n\\\n\\n\\\n\"), stdout);\n fputs (_(\"\\\nCommand line interface to the Libidn2 implementation of IDNA2008.\\n\\\n\\n\\\nAll strings are expected to be encoded in the locale charset.\\n\\\n\\n\\\nTo process a string that starts with `-', for example `-foo', use `--'\\n\\\nto signal the end of parameters, as in `idn2 --quiet -- -foo'.\\n\\\n\\n\\\nMandatory arguments to long options are mandatory for short options too.\\n\\\n\"), stdout);\n fputs (_(\"\\\n -h, --help Print help and exit\\n\\\n -V, --version Print version and exit\\n\\\n\"), stdout);\n fputs (_(\"\\\n -d, --decode Decode (punycode) domain name\\n\\\n -l, --lookup Lookup domain name (default)\\n\\\n -r, --register Register label\\n\\\n\"), stdout);\n fputs (_(\"\\\n -T, --tr46t Enable TR46 transitional processing\\n\\\n -N, --tr46nt Enable TR46 non-transitional processing\\n\\\n --no-tr46 Disable TR46 processing\\n\\\n\"), stdout);\n fputs (_(\"\\\n --usestd3asciirules Enable STD3 ASCII rules\\n\\\n --debug Print debugging information\\n\\\n --quiet Silent operation\\n\\\n\"), stdout);\n emit_bug_reporting_address ();\n }\n exit (status);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "for(var J=0;JonRequestMetadata_) {\n return Http::FilterMetadataStatus::Continue;\n }\n if (wasm_->onRequestMetadata_(this, id_).u64_ == 0) {\n return Http::FilterMetadataStatus::Continue;\n }\n return Http::FilterMetadataStatus::Continue; // This is currently the only return code.\n}", "label": 1, "label_name": "safe"} -{"code": "\tpublic function updateTab($id, $array)\n\t{\n\t\tif (!$id || $id == '') {\n\t\t\t$this->setAPIResponse('error', 'id was not set', 422);\n\t\t\treturn null;\n\t\t}\n\t\tif (!$array) {\n\t\t\t$this->setAPIResponse('error', 'no data was sent', 422);\n\t\t\treturn null;\n\t\t}\n\t\t$tabInfo = $this->getTabById($id);\n\t\tif ($tabInfo) {\n\t\t\t$array = $this->checkKeys($tabInfo, $array);\n\t\t} else {\n\t\t\t$this->setAPIResponse('error', 'No tab info found', 404);\n\t\t\treturn false;\n\t\t}\n\t\tif (array_key_exists('name', $array)) {\n\t\t\t$array['name'] = $this->sanitizeUserString($array['name']);\n\t\t\tif ($this->isTabNameTaken($array['name'], $id)) {\n\t\t\t\t$this->setAPIResponse('error', 'Tab name: ' . $array['name'] . ' is already taken', 409);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (!$this->qualifyLength($array['name'], 50, true)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tif (array_key_exists('default', $array)) {\n\t\t\tif ($array['default']) {\n\t\t\t\t$this->clearTabDefault();\n\t\t\t}\n\t\t}\n\t\tif (array_key_exists('group_id', $array)) {\n\t\t\t$groupCheck = (array_key_exists('group_id_min', $array)) ? $array['group_id_min'] : $tabInfo['group_id_min'];\n\t\t\tif ($array['group_id'] < $groupCheck) {\n\t\t\t\t$this->setAPIResponse('error', 'Tab name: ' . $tabInfo['name'] . ' cannot have a lower Group Id Max than Group Id Min', 409);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tif (array_key_exists('group_id_min', $array)) {\n\t\t\t$groupCheck = (array_key_exists('group_id', $array)) ? $array['group_id'] : $tabInfo['group_id'];\n\t\t\tif ($array['group_id_min'] > $groupCheck) {\n\t\t\t\t$this->setAPIResponse('error', 'Tab name: ' . $tabInfo['name'] . ' cannot have a higher Group Id Min than Group Id Max', 409);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t$response = [\n\t\t\tarray(\n\t\t\t\t'function' => 'query',\n\t\t\t\t'query' => array(\n\t\t\t\t\t'UPDATE tabs SET',\n\t\t\t\t\t$array,\n\t\t\t\t\t'WHERE id = ?',\n\t\t\t\t\t$id\n\t\t\t\t)\n\t\t\t),\n\t\t];\n\t\t$this->setAPIResponse(null, 'Tab info updated');\n\t\t$this->setLoggerChannel('Tab Management');\n\t\t$this->logger->debug('Edited Tab Info for [' . $tabInfo['name'] . ']');\n\t\treturn $this->processQueries($response);\n\t}", "label": 1, "label_name": "safe"} -{"code": " def readOptInt(json: JsValue, fieldName: String, altName: String = \"\",\n min: Opt[i32] = None, max: Opt[i32] = None): Option[Int] = {\n readOptLong(json, fieldName).orElse(readOptLong(json, altName)) map { valueAsLong =>\n val maxVal = max getOrElse Int.MaxValue\n val minVal = min getOrElse Int.MinValue\n if (valueAsLong > maxVal)\n throwBadJson(\"TyEJSNGTMX\", s\"$fieldName too large: $valueAsLong, max is: $maxVal\")\n if (valueAsLong < minVal)\n throwBadJson(\"TyEJSNLTMN\", s\"$fieldName too small: $valueAsLong, min is: $minVal\")\n valueAsLong.toInt\n }\n }\n\n\n def readLong(json: JsValue, fieldName: String): Long =", "label": 0, "label_name": "vulnerable"} -{"code": " spl_autoload_register($func);\n }\n }\n }\n }", "label": 1, "label_name": "safe"} -{"code": "function loadGXCodeHighLib($class_name)\n{\n Mod::inc($class_name.'.lib', '', dirname(__FILE__).'/inc/');\n}", "label": 1, "label_name": "safe"} -{"code": " }elseif($k == \"error\"){\r\n\r\n self::error($v);\r\n\r\n }elseif(!in_array($k, $arr) && $k != 'paging'){\r", "label": 0, "label_name": "vulnerable"} +{"code": " public function test_cleanUTF8()\n {\n $this->assertCleanUTF8('Normal string.');\n $this->assertCleanUTF8(\"Test\\tAllowed\\nControl\\rCharacters\");\n $this->assertCleanUTF8(\"null byte: \\0\", 'null byte: ');\n $this->assertCleanUTF8(\"\u3042\uff08\u3044\uff09\u3046\uff08\u3048\uff09\u304a\\0\", \"\u3042\uff08\u3044\uff09\u3046\uff08\u3048\uff09\u304a\"); // test for issue #122\n $this->assertCleanUTF8(\"\\1\\2\\3\\4\\5\\6\\7\", '');\n $this->assertCleanUTF8(\"\\x7F\", ''); // one byte invalid SGML char\n $this->assertCleanUTF8(\"\\xC2\\x80\", ''); // two byte invalid SGML\n $this->assertCleanUTF8(\"\\xF3\\xBF\\xBF\\xBF\"); // valid four byte\n $this->assertCleanUTF8(\"\\xDF\\xFF\", ''); // malformed UTF8\n // invalid codepoints\n $this->assertCleanUTF8(\"\\xED\\xB0\\x80\", '');\n }", "label": 1, "label_name": "safe"} +{"code": " public function __construct($data, $line = null, $col = null)\n {\n $this->data = $data;\n $this->is_whitespace = ctype_space($data);\n $this->line = $line;\n $this->col = $col;\n }", "label": 1, "label_name": "safe"} +{"code": "func (cs chunkState) String() string {\n\tstateString := \"\"\n\tswitch cs {\n\tcase readChunkHeader:\n\t\tstateString = \"readChunkHeader\"\n\tcase readChunkTrailer:\n\t\tstateString = \"readChunkTrailer\"\n\tcase readChunk:\n\t\tstateString = \"readChunk\"\n\tcase verifyChunk:\n\t\tstateString = \"verifyChunk\"\n\tcase eofChunk:\n\t\tstateString = \"eofChunk\"\n\n\t}\n\treturn stateString\n}", "label": 0, "label_name": "vulnerable"} +{"code": "int install_process_keyring_to_cred(struct cred *new)\n{\n\tstruct key *keyring;\n\n\tif (new->process_keyring)\n\t\treturn -EEXIST;\n\n\tkeyring = keyring_alloc(\"_pid\", new->uid, new->gid, new,\n\t\t\t\tKEY_POS_ALL | KEY_USR_VIEW,\n\t\t\t\tKEY_ALLOC_QUOTA_OVERRUN,\n\t\t\t\tNULL, NULL);\n\tif (IS_ERR(keyring))\n\t\treturn PTR_ERR(keyring);\n\n\tnew->process_keyring = keyring;\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testTrailingHyphenInCommentRemoved()\n {\n $this->config->set('HTML.Trusted', true);\n $this->expectErrorCollection(E_NOTICE, 'Strategy_RemoveForeignElements: Trailing hyphen in comment removed');\n $this->expectContext('CurrentToken', new HTMLPurifier_Token_Comment(' test ', 1));\n $this->invoke('');\n }", "label": 1, "label_name": "safe"} +{"code": " let cb = function () {\n let sent = 0;\n\n if (++returned === total) {\n expect(pool._connections.length).to.be.above(1);\n pool._connections.forEach(function (conn) {\n expect(conn.messages).to.be.above(1);\n sent += conn.messages;\n });\n\n expect(sent).to.be.equal(total);\n\n pool.close();\n return done();\n }\n };", "label": 1, "label_name": "safe"} +{"code": "function db_start()\n{\n global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType;\n\n switch ($DatabaseType) {\n case 'mysqli':\n $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort);\n break;\n }\n\n // Error code for both.\n if ($connection === false) {\n switch ($DatabaseType) {\n case 'mysqli':\n $errormessage = mysqli_error($connection);\n break;\n }\n db_show_error(\"\", \"\" . _couldNotConnectToDatabase . \": $DatabaseServer\", $errormessage);\n }\n return $connection;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "TEST_P(DownstreamProtocolIntegrationTest, ManyRequestHeadersTimeout) {\n // Set timeout for 5 seconds, and ensure that a request with 20k+ headers can be sent.\n testManyRequestHeaders(std::chrono::milliseconds(5000));\n}", "label": 1, "label_name": "safe"} +{"code": "\tparseArguments: function() {\n\t\tvar args = [];\n\t\tif (this.peekToken().text !== \")\") {\n\t\t\tdo {\n\t\t\t\targs.push(this.filterChain());\n\t\t\t} while (this.expect(\",\"));\n\t\t}\n\t\treturn args;\n\t},", "label": 1, "label_name": "safe"} +{"code": " getItemHtml: function (value) {\n var translatedValue = this.translatedOptions[value] || value;\n\n var html = '' +\n '';\n\n return html;\n },", "label": 0, "label_name": "vulnerable"} +{"code": " it 'has_interface_with absent ipaddress' do\n pp = <<-EOS\n $a = '128.0.0.1'\n $o = has_interface_with('ipaddress', $a)\n notice(inline_template('has_interface_with is <%= @o.inspect %>'))\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/has_interface_with is false/)\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": "static int __init mb2cache_init(void)\n{\n\tmb2_entry_cache = kmem_cache_create(\"mbcache\",\n\t\t\t\tsizeof(struct mb2_cache_entry), 0,\n\t\t\t\tSLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL);\n\tBUG_ON(!mb2_entry_cache);\n\treturn 0;\n}", "label": 1, "label_name": "safe"} +{"code": " void testSetNullHeaderValue() {\n assertThatThrownBy(() -> newEmptyHeaders().set(\"test\", (String) null))\n .isInstanceOf(NullPointerException.class);\n }", "label": 1, "label_name": "safe"} +{"code": " public function preFilter($html, $config, $context)\n {\n return $html;\n }", "label": 1, "label_name": "safe"} +{"code": " public function test_convertToUTF8_spuriousEncoding()\n {\n if (!HTMLPurifier_Encoder::iconvAvailable()) return;\n $this->config->set('Core.Encoding', 'utf99');\n $this->expectError('Invalid encoding utf99');\n $this->assertIdentical(\n HTMLPurifier_Encoder::convertToUTF8(\"\\xF6\", $this->config, $this->context),\n ''\n );\n }", "label": 1, "label_name": "safe"} +{"code": "def shutdown():\n task = int(request.args.get(\"parameter\").strip())\n showtext = {}\n if task in (0, 1): # valid commandos received\n # close all database connections\n calibre_db.dispose()\n ub.dispose()\n\n if task == 0:\n showtext['text'] = _(u'Server restarted, please reload page')\n else:\n showtext['text'] = _(u'Performing shutdown of server, please close window')\n # stop gevent/tornado server\n web_server.stop(task == 0)\n return json.dumps(showtext)\n\n if task == 2:\n log.warning(\"reconnecting to calibre database\")\n calibre_db.reconnect_db(config, ub.app_DB_path)\n showtext['text'] = _(u'Reconnect successful')\n return json.dumps(showtext)\n\n showtext['text'] = _(u'Unknown command')\n return json.dumps(showtext), 400", "label": 0, "label_name": "vulnerable"} +{"code": " public function render()\n {\n $result = new Dto_FormResult('notsubmitted');\n\n // Check permissions\n $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_perform_login, '');\n\n /*\n * Create a default SpotUser so the form is always able to render\n * the values of the form\n */\n $credentials = ['username' => '',\n 'password' => '', ];\n\n // Instantiate the Spot user system\n $svcUserAuth = new ServiceS_User_Authentication($this->_daoFactory, $this->_settings);\n\n // set the page title\n $this->_pageTitle = 'spot: login';\n\n // bring the form action into the local scope\n $formAction = $this->_loginForm['action'];\n\n // Are we already submitting the form login?\n if (!empty($formAction)) {\n // make sure we can simply assume all fields are there\n $credentials = array_merge($credentials, $this->_loginForm);\n\n $tryLogin = $svcUserAuth->authenticate($credentials['username'], $credentials['password']);\n if (!$tryLogin) {\n /* Create an audit event */\n if ($this->_settings->get('auditlevel') != SpotSecurity::spot_secaudit_none) {\n $spotAudit = new SpotAudit($this->_daoFactory, $this->_settings, $this->_currentSession['user'], $this->_currentSession['session']['ipaddr']);\n $spotAudit->audit(SpotSecurity::spotsec_perform_login, 'incorrect user or pass', false);\n } // if\n\n $result->addError(_('Login Failed'));\n } else {\n $result->setResult('success');\n $this->_currentSession = $tryLogin;\n } // else\n } else {\n // When the user is already logged in, show this as a warning\n if ($this->_currentSession['user']['userid'] != $this->_settings->get('nonauthenticated_userid')) {\n $result->addError(_('You are already logged in'));\n } // if\n } // else\n\n //- display stuff -#\n $this->template('login', ['loginform' => $credentials,\n 'result' => $result,\n 'http_referer' => $this->_loginForm['http_referer'],\n 'data' => $this->_params['data'], ]);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "function db_start()\n{\n global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType;\n\n switch ($DatabaseType) {\n case 'mysqli':\n $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort);\n break;\n }\n\n // Error code for both.\n if ($connection === false) {\n switch ($DatabaseType) {\n case 'mysqli':\n $errormessage = mysqli_error($connection);\n break;\n }\n db_show_error(\"\", \"\" . _couldNotConnectToDatabase . \": $DatabaseServer\", $errormessage);\n }\n return $connection;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "k.scrollHeight-k.offsetHeight&&D()},mxEvent.addListener(k,\"scroll\",B))}}),y)});p.okButton.setAttribute(\"disabled\",\"disabled\");this.ui.spinner.spin(k,mxResources.get(\"loading\"));var t=mxUtils.bind(this,function(z){var L=this.ui.spinner,C=0;this.ui.spinner.stop();var D=function(){L.spin(k,mxResources.get(\"loading\"));C+=1},G=function(){--C;0===C&&L.stop()};null==z&&(k.innerHTML=\"\",z=1);null!=B&&(mxEvent.removeListener(k,\"scroll\",B),B=null);null!=A&&null!=A.parentNode&&A.parentNode.removeChild(A);A=document.createElement(\"a\");", "label": 0, "label_name": "vulnerable"} +{"code": " public void shouldNotAllowToListWithBaseOutsideRoot() throws Exception {\n // given\n expectedException.expect(IllegalArgumentException.class);\n expectedException.expectMessage(containsString(\"may not be located outside base path\"));\n\n // when\n logViewEndpoint.view(\"somefile\", \"../otherdir\", null, null);\n }", "label": 1, "label_name": "safe"} +{"code": "k&&k(x)}}),k)};EditorUi.prototype.removeDatabaseItem=function(c,e,g,k){this.openDatabase(mxUtils.bind(this,function(m){k=k||\"objects\";Array.isArray(k)||(k=[k],c=[c]);m=m.transaction(k,\"readwrite\");m.oncomplete=e;m.onerror=g;for(var q=0;qparams);\n// $parent = isset($this->params['cat']) ? $this->params['cat'] : expSession::get('catid');\n $catid = expSession::get('catid');\n $parent = !empty($catid) ? $catid : (!empty($this->params['cat']) ? $this->params['cat'] : 0);\n $category = new storeCategory($parent);\n $categories = $category->getEcomSubcategories();\n $ancestors = $category->pathToNode();\n assign_to_template(array(\n 'categories' => $categories,\n 'ancestors' => $ancestors,\n 'category' => $category\n ));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " private ModelAndView renameGroup(HttpServletRequest request, HttpServletResponse response) throws Exception {\n \n String oldName = request.getParameter(\"groupName\");\n String newName = request.getParameter(\"newName\");\n \n if (StringUtils.hasText(oldName) && StringUtils.hasText(newName)) {\n m_groupRepository.renameGroup(oldName, newName);\n }\n \n return listGroups(request, response);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " main.resubscribeStates = function () {\n for (const pattern in main.subscribesStates) {\n if (main.subscribesStates.hasOwnProperty(pattern) && main.subscribesStates[pattern]) {\n console.debug('Re-Subscribe: ' + pattern);\n main.socket.emit('subscribe', pattern);\n }\n }\n };", "label": 1, "label_name": "safe"} +{"code": " foreach ($mergedPermissions as $mergedPermission => $value) {\n // Strip the '*' off the beginning of the permission.\n $checkPermission = substr($permission, 1);\n\n // We will make sure that the merged permission does not\n // exactly match our permission, but ends with it.\n if ($checkPermission != $mergedPermission && ends_with($mergedPermission, $checkPermission) && $value === 1) {\n $matched = true;\n break;\n }\n }", "label": 1, "label_name": "safe"} +{"code": " public function __clone()\n {\n if ($this->debug) {\n $this->startTime = microtime(true);\n }\n\n $this->booted = false;\n $this->container = null;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "g?\"&mime=\"+g:\"\")+(null!=m?\"&format=\"+m:\"\")+(null!=q?\"&base64=\"+q:\"\")+(null!=e?\"&filename=\"+encodeURIComponent(e):\"\")+(k?\"&binary=1\":\"\"))};EditorUi.prototype.base64ToBlob=function(c,e){e=e||\"\";c=atob(c);for(var g=c.length,k=Math.ceil(g/1024),m=Array(k),q=0;qID;\n\n\t\t// show on single sell media pages\n\t\tif ( is_singular( 'sell_media_item' ) || sell_media_attachment( $post_id ) || sell_media_is_search() ) {\n\n\t\t\t// bail if it's password protected item\n\t\t\tif ( post_password_required( $post ) || ( isset( $post->post_parent ) && post_password_required( $post->post_parent ) ) ) {\n\t\t\t\treturn $content;\n\t\t\t}\n\n\t\t\t$has_multiple_attachments = sell_media_has_multiple_attachments( $post_id );\n\t\t\t$wrap = ( ! $has_multiple_attachments || 'attachment' === get_post_type( $post_id ) ) ? true : false;\n\t\t\t$new_content = '';\n\n\t\t\t// only wrap content if a single image/media is being viewed\n\t\t\tif ( $wrap ) {\n\t\t\t\t$new_content .= '
    ';\n\t\t\t}\n\n\t\t\t$new_content .= sell_media_breadcrumbs();\n\t\t\t$new_content .= sell_media_get_media();\n\t\t\t$new_content .= $content;\n\n\t\t\t// only wrap content if a single image/media is being viewed\n\t\t\tif ( $wrap ) {\n\t\t\t\t$new_content .= '
    ';\n\t\t\t}\n\n\t\t\t$content = $new_content;\n\n\t\t\t// set the post views, used for popular query\n\t\t\tsell_media_set_post_views( $post_id );\n\t\t}\n\n\t\treturn apply_filters( 'sell_media_content', $content );\n\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " fn drop(&mut self) {\n if self.needs_inst_drop {\n unsafe {\n let inst = self.inst.as_mut();\n\n // The `inst.alloc` field manages the memory of the instance\n // itself. Note, though, that this field is in a `ManuallyDrop`\n // so it won't get dropped automatically in `drop_in_place`.\n // This is the point where we take over that precise drop.\n //\n // By using `take` here we're basically calling `ptr::read`\n // which \"duplicates\" the `alloc` since the `alloc` local\n // variable here is the exact same as `inst.alloc`. All we do\n // with `inst`, though, is call `drop_in_place`, which\n // invalidates every other field in `inst`.\n let alloc: Alloc = ManuallyDrop::take(&mut inst.alloc);\n\n // drop the actual instance\n std::ptr::drop_in_place(inst);\n\n // Now that we're 100% done with the instance, destructors and\n // all, we can release the memory of the instance back to the\n // original allocator from whence it came (be it mmap or uffd\n // based). This will run the \"official\" destructor for `Alloc`\n // which internally does the release. Note that after this\n // operation the `inst` pointer is invalid and can no longer be\n // used.\n drop(alloc);\n }\n }\n }", "label": 1, "label_name": "safe"} +{"code": " public function testDirectiveDefaultInvalid()\n {\n $d = $this->makeDirective('Ns.Dir');\n $d->default = 'asdf';\n $d->type = 'int';\n $d->description = 'Description';\n\n $this->expectValidationException(\"Default in directive 'Ns.Dir' had error: Expected type int, got string\");\n $this->validator->validate($this->interchange);\n }", "label": 1, "label_name": "safe"} +{"code": " public function filter(&$uri, $config, $context)\n {\n // check if filter not applicable\n if (!$config->get('HTML.SafeIframe')) {\n return true;\n }\n // check if the filter should actually trigger\n if (!$context->get('EmbeddedURI', true)) {\n return true;\n }\n $token = $context->get('CurrentToken', true);\n if (!($token && $token->name == 'iframe')) {\n return true;\n }\n // check if we actually have some whitelists enabled\n if ($this->regexp === null) {\n return false;\n }\n // actually check the whitelists\n return preg_match($this->regexp, $uri->toString());\n }", "label": 1, "label_name": "safe"} +{"code": " public function getPath()\n {\n return $this->path;\n }", "label": 1, "label_name": "safe"} +{"code": "int ConnectionImpl::onFrameSend(const nghttp2_frame* frame) {\n // The nghttp2 library does not cleanly give us a way to determine whether we received invalid\n // data from our peer. Sometimes it raises the invalid frame callback, and sometimes it does not.\n // In all cases however it will attempt to send a GOAWAY frame with an error status. If we see\n // an outgoing frame of this type, we will return an error code so that we can abort execution.\n ENVOY_CONN_LOG(trace, \"sent frame type={}\", connection_, static_cast(frame->hd.type));\n switch (frame->hd.type) {\n case NGHTTP2_GOAWAY: {\n ENVOY_CONN_LOG(debug, \"sent goaway code={}\", connection_, frame->goaway.error_code);\n if (frame->goaway.error_code != NGHTTP2_NO_ERROR) {\n return NGHTTP2_ERR_CALLBACK_FAILURE;\n }\n break;\n }\n\n case NGHTTP2_RST_STREAM: {\n ENVOY_CONN_LOG(debug, \"sent reset code={}\", connection_, frame->rst_stream.error_code);\n stats_.tx_reset_.inc();\n break;\n }\n\n case NGHTTP2_HEADERS:\n case NGHTTP2_DATA: {\n StreamImpl* stream = getStream(frame->hd.stream_id);\n if (stream->headers_) {\n // Verify that the final HeaderMap's byte size is under the limit before sending frames.\n // This assert iterates over the HeaderMap.\n ASSERT(stream->headers_->byteSize().has_value() &&\n stream->headers_->byteSize().value() == stream->headers_->byteSizeInternal());\n }\n stream->local_end_stream_sent_ = frame->hd.flags & NGHTTP2_FLAG_END_STREAM;\n break;\n }\n }\n\n return 0;\n}", "label": 1, "label_name": "safe"} +{"code": " public function testShiftJIS()\n {\n if (!HTMLPurifier_Encoder::iconvAvailable()) return;\n $this->config->set('Core.Encoding', 'Shift_JIS');\n // This actually looks like a Yen, but we're going to treat it differently\n $this->assertIdentical(\n HTMLPurifier_Encoder::convertFromUTF8('\\\\~', $this->config, $this->context),\n '\\\\~'\n );\n $this->assertIdentical(\n HTMLPurifier_Encoder::convertToUTF8('\\\\~', $this->config, $this->context),\n '\\\\~'\n );\n }", "label": 1, "label_name": "safe"} +{"code": " public function test_generateFromToken_text()\n {\n $this->assertGenerateFromToken(\n new HTMLPurifier_Token_Text('Foobar.<>'),\n 'Foobar.<>'\n );\n }", "label": 1, "label_name": "safe"} +{"code": " it 'should set wsgi_daemon_process_options' do\n is_expected.to contain_file(\"25-#{title}.conf\").with_content(\n /^ WSGIDaemonProcess example.org processes=2 threads=15$/\n )\n end", "label": 0, "label_name": "vulnerable"} +{"code": " def add_file_signed name, mode, signer\n digest_algorithms = [\n signer.digest_algorithm,\n Digest::SHA512,\n ].compact.uniq\n\n digests = add_file_digest name, mode, digest_algorithms do |io|\n yield io\n end\n\n signature_digest = digests.values.compact.find do |digest|\n digest_name =\n if digest.respond_to? :name then\n digest.name\n else\n /::([^:]+)$/ =~ digest.class.name\n $1\n end\n\n digest_name == signer.digest_name\n end\n\n raise \"no #{signer.digest_name} in #{digests.values.compact}\" unless signature_digest\n\n if signer.key then\n signature = signer.sign signature_digest.digest\n\n add_file_simple \"#{name}.sig\", 0444, signature.length do |io|\n io.write signature\n end\n end\n\n digests\n end", "label": 1, "label_name": "safe"} +{"code": " public function testOverrideSingle()\n {\n $this->assertParse('OverrideSingle.txt', array(\n 'KEY' => 'New',\n ));\n }", "label": 1, "label_name": "safe"} +{"code": " public AbstractXmlConfigRootTagRecognizer(String expectedRootNode) throws Exception {\n this.expectedRootNode = expectedRootNode;\n SAXParserFactory factory = XmlUtil.getSAXParserFactory();\n saxParser = factory.newSAXParser();\n }", "label": 1, "label_name": "safe"} +{"code": " public function update()\n {\n $project = $this->getProject();\n $category = $this->getCategory($project);\n\n $values = $this->request->getValues();\n $values['project_id'] = $project['id'];\n $values['id'] = $category['id'];\n\n list($valid, $errors) = $this->categoryValidator->validateModification($values);\n\n if ($valid) {\n if ($this->categoryModel->update($values)) {\n $this->flash->success(t('This category has been updated successfully.'));\n return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));\n } else {\n $this->flash->failure(t('Unable to update this category.'));\n }\n }\n\n return $this->edit($values, $errors);\n }", "label": 1, "label_name": "safe"} +{"code": " public function enable()\n {\n $this->checkCSRFParam();\n $project = $this->getProject();\n $swimlane_id = $this->request->getIntegerParam('swimlane_id');\n\n if ($this->swimlaneModel->enable($project['id'], $swimlane_id)) {\n $this->flash->success(t('Swimlane updated successfully.'));\n } else {\n $this->flash->failure(t('Unable to update this swimlane.'));\n }\n\n $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));\n }", "label": 0, "label_name": "vulnerable"} +{"code": "TEST_F(GroupVerifierTest, TestRequiresAnyWithAllowMissingButUnknownIssuer) {\n TestUtility::loadFromYaml(RequiresAnyConfig, proto_config_);\n proto_config_.mutable_rules(0)\n ->mutable_requires()\n ->mutable_requires_any()\n ->add_requirements()\n ->mutable_allow_missing();\n\n createAsyncMockAuthsAndVerifier(std::vector{\"example_provider\", \"other_provider\"});\n EXPECT_CALL(mock_cb_, onComplete(Status::JwtUnknownIssuer));\n\n auto headers = Http::TestRequestHeaderMapImpl{};\n context_ = Verifier::createContext(headers, parent_span_, &mock_cb_);\n verifier_->verify(context_);\n callbacks_[\"example_provider\"](Status::JwtMissed);\n callbacks_[\"other_provider\"](Status::JwtUnknownIssuer);\n}", "label": 1, "label_name": "safe"} +{"code": " $deps = get_dependency_lookup($file) + $deps;\n }\n $cache[$file] = $deps;\n return $deps;\n}", "label": 1, "label_name": "safe"} +{"code": " public function testSmtpConnect()\n {\n $this->Mail->SMTPDebug = 4; //Show connection-level errors\n $this->assertTrue($this->Mail->smtpConnect(), 'SMTP single connect failed');\n $this->Mail->smtpClose();\n $this->Mail->Host = \"ssl://localhost:12345;tls://localhost:587;10.10.10.10:54321;localhost:12345;10.10.10.10\";\n $this->assertFalse($this->Mail->smtpConnect(), 'SMTP bad multi-connect succeeded');\n $this->Mail->smtpClose();\n $this->Mail->Host = \"localhost:12345;10.10.10.10:54321;\" . $_REQUEST['mail_host'];\n $this->assertTrue($this->Mail->smtpConnect(), 'SMTP multi-connect failed');\n $this->Mail->smtpClose();\n $this->Mail->Host = \" localhost:12345 ; \" . $_REQUEST['mail_host'] . ' ';\n $this->assertTrue($this->Mail->smtpConnect(), 'SMTP hosts with stray spaces failed');\n $this->Mail->smtpClose();\n $this->Mail->Host = $_REQUEST['mail_host'];\n //Need to pick a harmless option so as not cause problems of its own! socket:bind doesn't work with Travis-CI\n $this->assertTrue(\n $this->Mail->smtpConnect(array('ssl' => array('verify_depth' => 10))),\n 'SMTP connect with options failed'\n );\n }", "label": 1, "label_name": "safe"} +{"code": "static u32 read_32(cdk_stream_t s)\n{\n\tbyte buf[4];\n\tsize_t nread = 0;\n\n\tassert(s != NULL);\n\n\tstream_read(s, buf, 4, &nread);\n\tif (nread != 4)\n\t\treturn (u32) -1;\n\treturn buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];\n}", "label": 1, "label_name": "safe"} +{"code": "static void do_sched_cfs_slack_timer(struct cfs_bandwidth *cfs_b)\n{\n\tu64 runtime = 0, slice = sched_cfs_bandwidth_slice();\n\tunsigned long flags;\n\n\t/* confirm we're still not at a refresh boundary */\n\traw_spin_lock_irqsave(&cfs_b->lock, flags);\n\tcfs_b->slack_started = false;\n\tif (cfs_b->distribute_running) {\n\t\traw_spin_unlock_irqrestore(&cfs_b->lock, flags);\n\t\treturn;\n\t}\n\n\tif (runtime_refresh_within(cfs_b, min_bandwidth_expiration)) {\n\t\traw_spin_unlock_irqrestore(&cfs_b->lock, flags);\n\t\treturn;\n\t}\n\n\tif (cfs_b->quota != RUNTIME_INF && cfs_b->runtime > slice)\n\t\truntime = cfs_b->runtime;\n\n\tif (runtime)\n\t\tcfs_b->distribute_running = 1;\n\n\traw_spin_unlock_irqrestore(&cfs_b->lock, flags);\n\n\tif (!runtime)\n\t\treturn;\n\n\truntime = distribute_cfs_runtime(cfs_b, runtime);\n\n\traw_spin_lock_irqsave(&cfs_b->lock, flags);\n\tlsub_positive(&cfs_b->runtime, runtime);\n\tcfs_b->distribute_running = 0;\n\traw_spin_unlock_irqrestore(&cfs_b->lock, flags);\n}", "label": 1, "label_name": "safe"} +{"code": "function GoodAuthDigestTestController($serverPort) {\n $args = array('Authorization' => 'Digest username=\"admin\", ' .\n 'realm=\"Restricted area\", nonce=\"564a12611dae8\", ' .\n 'uri=\"/test_auth_digest.php\", cnonce=\"MjIyMTg1\", nc=00000001, ' .\n 'qop=\"auth\", response=\"e544aaed06917adea3e5c74dd49f0e32\", ' .\n 'opaque=\"cdce8a5c95a1427d74df7acbf41c9ce0\"');\n var_dump(request(php_uname('n'), $serverPort, \"test_auth_digest.php\",\n [], [], $args));\n}", "label": 0, "label_name": "vulnerable"} +{"code": " def test_it_works_with_explicit_external_host(self, app, monkeypatch):\n with app.test_request_context():\n monkeypatch.setattr('flask.request.host_url', 'http://example.com')\n result = _validate_redirect_url('http://works.com',\n _external_host='works.com')\n assert result is True\n monkeypatch.undo()", "label": 0, "label_name": "vulnerable"} {"code": " protected function postFilterCallback($matches) {\n $url = $this->armorUrl($matches[1]);\n return ''.\n ''.\n ''.\n '';\n\n }", "label": 1, "label_name": "safe"} -{"code": "def test_digest():\n # Test that we support Digest Authentication\n http = httplib2.Http()\n password = tests.gen_password()\n handler = tests.http_reflect_with_auth(allow_scheme=\"digest\", allow_credentials=((\"joe\", password),))\n with tests.server_request(handler, request_count=3) as uri:\n response, content = http.request(uri, \"GET\")\n assert response.status == 401\n http.add_credentials(\"joe\", password)\n response, content = http.request(uri, \"GET\")\n assert response.status == 200, content.decode()", "label": 1, "label_name": "safe"} -{"code": "if(\"function\"!=typeof a)throw new TypeError(\"parseInputDate() sholud be as function\");return d.parseInputDate=a,l},l.disabledTimeIntervals=function(b){if(0===arguments.length)return d.disabledTimeIntervals?a.extend({},d.disabledTimeIntervals):d.disabledTimeIntervals;if(!b)return d.disabledTimeIntervals=!1,$(),l;if(!(b instanceof Array))throw new TypeError(\"disabledTimeIntervals() expects an array parameter\");return d.disabledTimeIntervals=b,$(),l},l.disabledHours=function(b){if(0===arguments.length)return d.disabledHours?a.extend({},d.disabledHours):d.disabledHours;if(!b)return d.disabledHours=!1,$(),l;if(!(b instanceof Array))throw new TypeError(\"disabledHours() expects an array parameter\");if(d.disabledHours=na(b),d.enabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!Q(e,\"h\");){if(e.add(1,\"h\"),24===c)throw\"Tried 24 times to find a valid date\";c++}_(e)}return $(),l},l.enabledHours=function(b){if(0===arguments.length)return d.enabledHours?a.extend({},d.enabledHours):d.enabledHours;if(!b)return d.enabledHours=!1,$(),l;if(!(b instanceof Array))throw new TypeError(\"enabledHours() expects an array parameter\");if(d.enabledHours=na(b),d.disabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!Q(e,\"h\");){if(e.add(1,\"h\"),24===c)throw\"Tried 24 times to find a valid date\";c++}_(e)}return $(),l},l.viewDate=function(a){if(0===arguments.length)return f.clone();if(!a)return f=e.clone(),l;if(!(\"string\"==typeof a||b.isMoment(a)||a instanceof Date))throw new TypeError(\"viewDate() parameter must be one of [string, moment or Date]\");return f=ga(a),J(),l},c.is(\"input\"))g=c;else if(g=c.find(d.datepickerInput),0===g.size())g=c.find(\"input\");else if(!g.is(\"input\"))throw new Error('CSS class \"'+d.datepickerInput+'\" cannot be applied to non input element');if(c.hasClass(\"input-group\")&&(n=0===c.find(\".datepickerbutton\").size()?c.find(\".input-group-addon\"):c.find(\".datepickerbutton\")),!d.inline&&!g.is(\"input\"))throw new Error(\"Could not initialize DateTimePicker without an input element\");return e=x(),f=e.clone(),a.extend(!0,d,G()),l.options(d),oa(),ka(),g.prop(\"disabled\")&&l.disable(),g.is(\"input\")&&0!==g.val().trim().length?_(ga(g.val().trim())):d.defaultDate&&void 0===g.attr(\"placeholder\")&&_(d.defaultDate),d.inline&&ea(),l};a.fn.datetimepicker=function(b){return this.each(function(){var d=a(this);d.data(\"DateTimePicker\")||(b=a.extend(!0,{},a.fn.datetimepicker.defaults,b),d.data(\"DateTimePicker\",c(d,b)))})},a.fn.datetimepicker.defaults={timeZone:\"Etc/UTC\",format:!1,dayViewHeaderFormat:\"MMMM YYYY\",extraFormats:!1,stepping:1,minDate:!1,maxDate:!1,useCurrent:!0,collapse:!0,locale:b.locale(),defaultDate:!1,disabledDates:!1,enabledDates:!1,icons:{time:\"glyphicon glyphicon-time\",date:\"glyphicon glyphicon-calendar\",up:\"glyphicon glyphicon-chevron-up\",down:\"glyphicon glyphicon-chevron-down\",previous:\"glyphicon glyphicon-chevron-left\",next:\"glyphicon glyphicon-chevron-right\",today:\"glyphicon glyphicon-screenshot\",clear:\"glyphicon glyphicon-trash\",close:\"glyphicon glyphicon-remove\"},tooltips:{today:\"Go to today\",clear:\"Clear selection\",close:\"Close the picker\",selectMonth:\"Select Month\",prevMonth:\"Previous Month\",nextMonth:\"Next Month\",selectYear:\"Select Year\",prevYear:\"Previous Year\",nextYear:\"Next Year\",selectDecade:\"Select Decade\",prevDecade:\"Previous Decade\",nextDecade:\"Next Decade\",prevCentury:\"Previous Century\",nextCentury:\"Next Century\",pickHour:\"Pick Hour\",incrementHour:\"Increment Hour\",decrementHour:\"Decrement Hour\",pickMinute:\"Pick Minute\",incrementMinute:\"Increment Minute\",decrementMinute:\"Decrement Minute\",pickSecond:\"Pick Second\",incrementSecond:\"Increment Second\",decrementSecond:\"Decrement Second\",togglePeriod:\"Toggle Period\",selectTime:\"Select Time\"},useStrict:!1,sideBySide:!1,daysOfWeekDisabled:!1,calendarWeeks:!1,viewMode:\"days\",toolbarPlacement:\"default\",showTodayButton:!1,showClear:!1,showClose:!1,widgetPositioning:{horizontal:\"auto\",vertical:\"auto\"},widgetParent:null,ignoreReadonly:!1,keepOpen:!1,focusOnShow:!0,inline:!1,keepInvalid:!1,datepickerInput:\".datepickerinput\",keyBinds:{up:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().subtract(7,\"d\")):this.date(b.clone().add(this.stepping(),\"m\"))}},down:function(a){if(!a)return void this.show();var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().add(7,\"d\")):this.date(b.clone().subtract(this.stepping(),\"m\"))},\"control up\":function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().subtract(1,\"y\")):this.date(b.clone().add(1,\"h\"))}},\"control down\":function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().add(1,\"y\")):this.date(b.clone().subtract(1,\"h\"))}},left:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().subtract(1,\"d\"))}},right:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().add(1,\"d\"))}},pageUp:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().subtract(1,\"M\"))}},pageDown:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().add(1,\"M\"))}},enter:function(){this.hide()},escape:function(){this.hide()},\"control space\":function(a){a.find(\".timepicker\").is(\":visible\")&&a.find('.btn[data-action=\"togglePeriod\"]').click()},t:function(){this.date(this.getMoment())},\"delete\":function(){this.clear()}},debug:!1,allowInputToggle:!1,disabledTimeIntervals:!1,disabledHours:!1,enabledHours:!1,viewDate:!1}});", "label": 0, "label_name": "vulnerable"} -{"code": "if(m||p){var O=[],V=null,U=null,Y=null,n=function(ea){W.setAttribute(\"disabled\",\"disabled\");for(var ta=0;taparams['mod'] = expString::escape($this->params['mod']);\n $this->params['src'] = expString::escape($this->params['src']);\n $mod = expModules::getController($this->params['mod'], $this->params['src']);\n if ($mod != null) {\n $mod->delete_instance(); // delete all assoc items\n $db->delete(\n 'sectionref',\n \"source='\" . $this->params['src'] . \"' and module='\" . $this->params['mod'] . \"'\"\n ); // delete recycle bin holder\n flash('notice', gt('Item removed from Recycle Bin'));\n }\n expHistory::back();\n }", "label": 1, "label_name": "safe"} -{"code": " static function getRSSFeed($url, $cache_duration = DAY_TIMESTAMP) {\n global $CFG_GLPI;\n\n $feed = new SimplePie();\n $feed->set_cache_location(GLPI_RSS_DIR);\n $feed->set_cache_duration($cache_duration);\n\n // proxy support\n if (!empty($CFG_GLPI[\"proxy_name\"])) {\n $prx_opt = [];\n $prx_opt[CURLOPT_PROXY] = $CFG_GLPI[\"proxy_name\"];\n $prx_opt[CURLOPT_PROXYPORT] = $CFG_GLPI[\"proxy_port\"];\n if (!empty($CFG_GLPI[\"proxy_user\"])) {\n $prx_opt[CURLOPT_HTTPAUTH] = CURLAUTH_ANYSAFE;\n $prx_opt[CURLOPT_PROXYUSERPWD] = $CFG_GLPI[\"proxy_user\"].\":\".\n Toolbox::sodiumDecrypt($CFG_GLPI[\"proxy_passwd\"]);\n }\n $feed->set_curl_options($prx_opt);\n }\n\n $feed->enable_cache(true);\n $feed->set_feed_url($url);\n $feed->force_feed(true);\n // Initialize the whole SimplePie object. Read the feed, process it, parse it, cache it, and\n // all that other good stuff. The feed's information will not be available to SimplePie before\n // this is called.\n $feed->init();\n\n // We'll make sure that the right content type and character encoding gets set automatically.\n // This function will grab the proper character encoding, as well as set the content type to text/html.\n $feed->handle_content_type();\n if ($feed->error()) {\n return false;\n }\n return $feed;\n }", "label": 1, "label_name": "safe"} -{"code": "static void *command_init(struct pci_dev *dev, int offset)\n{\n\tstruct pci_cmd_info *cmd = kmalloc(sizeof(*cmd), GFP_KERNEL);\n\tint err;\n\n\tif (!cmd)\n\t\treturn ERR_PTR(-ENOMEM);\n\n\terr = pci_read_config_word(dev, PCI_COMMAND, &cmd->val);\n\tif (err) {\n\t\tkfree(cmd);\n\t\treturn ERR_PTR(err);\n\t}\n\n\treturn cmd;\n}", "label": 1, "label_name": "safe"} -{"code": "func TestPermissions(t *testing.T) {\n\tappCtx := Given(t)\n\tprojName := \"argo-project\"\n\tprojActions := projectFixture.\n\t\tGiven(t).\n\t\tName(projName).\n\t\tWhen().\n\t\tCreate()\n\n\tsourceError := fmt.Sprintf(\"application repo %s is not permitted in project 'argo-project'\", RepoURL(RepoURLTypeFile))\n\tdestinationError := fmt.Sprintf(\"application destination {%s %s} is not permitted in project 'argo-project'\", KubernetesInternalAPIServerAddr, DeploymentNamespace())\n\n\tappCtx.\n\t\tPath(\"guestbook-logs\").\n\t\tProject(projName).\n\t\tWhen().\n\t\tIgnoreErrors().\n\t\t// ensure app is not created if project permissions are missing\n\t\tCreateApp().\n\t\tThen().\n\t\tExpect(Error(\"\", sourceError)).\n\t\tExpect(Error(\"\", destinationError)).\n\t\tWhen().\n\t\tDoNotIgnoreErrors().\n\t\t// add missing permissions, create and sync app\n\t\tAnd(func() {\n\t\t\tprojActions.AddDestination(\"*\", \"*\")\n\t\t\tprojActions.AddSource(\"*\")\n\t\t}).\n\t\tCreateApp().\n\t\tSync().\n\t\tThen().\n\t\t// make sure application resource actiions are successful\n\t\tAnd(func(app *Application) {\n\t\t\tassertResourceActions(t, app.Name, true)\n\t\t}).\n\t\tWhen().\n\t\t// remove projet permissions and \"refresh\" app\n\t\tAnd(func() {\n\t\t\tprojActions.UpdateProject(func(proj *AppProject) {\n\t\t\t\tproj.Spec.Destinations = nil\n\t\t\t\tproj.Spec.SourceRepos = nil\n\t\t\t})\n\t\t}).\n\t\tRefresh(RefreshTypeNormal).\n\t\tThen().\n\t\t// ensure app resource tree is empty when source/destination permissions are missing\n\t\tExpect(Condition(ApplicationConditionInvalidSpecError, destinationError)).\n\t\tExpect(Condition(ApplicationConditionInvalidSpecError, sourceError)).\n\t\tAnd(func(app *Application) {\n\t\t\tcloser, cdClient := ArgoCDClientset.NewApplicationClientOrDie()\n\t\t\tdefer io.Close(closer)\n\t\t\ttree, err := cdClient.ResourceTree(context.Background(), &applicationpkg.ResourcesQuery{ApplicationName: &app.Name})\n\t\t\trequire.NoError(t, err)\n\t\t\tassert.Len(t, tree.Nodes, 0)\n\t\t\tassert.Len(t, tree.OrphanedNodes, 0)\n\t\t}).\n\t\tWhen().\n\t\t// add missing permissions but deny management of Deployment kind\n\t\tAnd(func() {\n\t\t\tprojActions.\n\t\t\t\tAddDestination(\"*\", \"*\").\n\t\t\t\tAddSource(\"*\").\n\t\t\t\tUpdateProject(func(proj *AppProject) {\n\t\t\t\t\tproj.Spec.NamespaceResourceBlacklist = []metav1.GroupKind{{Group: \"*\", Kind: \"Deployment\"}}\n\t\t\t\t})\n\t\t}).\n\t\tRefresh(RefreshTypeNormal).\n\t\tThen().\n\t\t// make sure application resource actiions are failing\n\t\tAnd(func(app *Application) {\n\t\t\tassertResourceActions(t, \"test-permissions\", false)\n\t\t})\n}", "label": 1, "label_name": "safe"} -{"code": "error_t httpClientSetMethod(HttpClientContext *context, const char_t *method)\n{\n size_t m;\n size_t n;\n char_t *p;\n\n //Check parameters\n if(context == NULL || method == NULL)\n return ERROR_INVALID_PARAMETER;\n\n //Compute the length of the HTTP method\n n = osStrlen(method);\n\n //Make sure the length of the user name is acceptable\n if(n == 0 || n > HTTP_CLIENT_MAX_METHOD_LEN)\n return ERROR_INVALID_LENGTH;\n\n //Make sure the buffer contains a valid HTTP request\n if(context->bufferLen > HTTP_CLIENT_BUFFER_SIZE)\n return ERROR_INVALID_SYNTAX;\n\n //Properly terminate the string with a NULL character\n context->buffer[context->bufferLen] = '\\0';\n\n //The Request-Line begins with a method token\n p = osStrchr(context->buffer, ' ');\n //Any parsing error?\n if(p == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Compute the length of the current method token\n m = p - context->buffer;\n\n //Make sure the buffer is large enough to hold the new HTTP request method\n if((context->bufferLen + n - m) > HTTP_CLIENT_BUFFER_SIZE)\n return ERROR_BUFFER_OVERFLOW;\n\n //Make room for the new method token\n osMemmove(context->buffer + n, p, context->bufferLen + 1 - m);\n //Copy the new method token\n osStrncpy(context->buffer, method, n);\n\n //Adjust the length of the request header\n context->bufferLen = context->bufferLen + n - m;\n\n //Save HTTP request method\n osStrcpy(context->method, method);\n\n //Successful processing\n return NO_ERROR;\n}", "label": 1, "label_name": "safe"} -{"code": " it 'should have primary network (10.0.2.0)' do\n expect(subject.call(['10.0.2.0'])).to be_truthy\n end", "label": 0, "label_name": "vulnerable"} -{"code": " public static function isExist($user)\n {\n if (isset($_GET['act']) && $_GET['act'] == 'edit') {\n $id = Typo::int($_GET['id']);\n $where = \"AND `id` != '{$id}' \";\n } else {\n $where = '';\n }\n $user = sprintf('%s', Typo::cleanX($user));\n $sql = sprintf(\"SELECT `userid` FROM `user` WHERE `userid` = '%s' %s \", $user, $where);\n $usr = Db::result($sql);\n $n = Db::$num_rows;\n if ($n > 0) {\n return false;\n } else {\n return true;\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": "TfLiteStatus ReluPrepare(TfLiteContext* context, TfLiteNode* node) {\n ReluOpData* data = reinterpret_cast(node->user_data);\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n const TfLiteTensor* input = GetInput(context, node, 0);\n TfLiteTensor* output = GetOutput(context, node, 0);\n TF_LITE_ENSURE_TYPES_EQ(context, input->type, output->type);\n\n if (input->type == kTfLiteInt8 || input->type == kTfLiteUInt8) {\n double real_multiplier = input->params.scale / output->params.scale;\n QuantizeMultiplier(real_multiplier, &data->output_multiplier,\n &data->output_shift);\n }\n\n return context->ResizeTensor(context, output,\n TfLiteIntArrayCopy(input->dims));\n}", "label": 0, "label_name": "vulnerable"} -{"code": "\twatchFns: function() {\n\t\tvar result = [];\n\t\tvar fns = this.state.inputs;\n\t\tvar self = this;\n\t\tforEach(fns, function(name) {\n\t\t\tresult.push(\"var \" + name + \"=\" + self.generateFunction(name, \"s\"));\n\t\t});\n\t\tif (fns.length) {\n\t\t\tresult.push(\"fn.inputs=[\" + fns.join(\",\") + \"];\");\n\t\t}\n\t\treturn result.join(\"\");\n\t},", "label": 1, "label_name": "safe"} -{"code": "minimumSearchLength:2});$(\".fc_input_fake label\").click(function(){var a=$(this).prop(\"for\");$(\"#\"+a).val(\"\");searchUsers(\"\")});$(\".ajaxForm\").each(function(){dialog_form($(this))});$(\"a.ajaxLink\").click(function(a){a.preventDefault();a=$(this).prop(\"href\");dialog_ajax(\"Saving\",a,getDatesFromQuerystring(document.URL.split(\"?\")[1]))});$(\"#fc_sidebar_footer, #fc_sidebar\").resizable({handles:\"e\",minWidth:100,start:function(b,e){a=parseInt($(window).width(),10)},resize:function(b,e){$(\"#fc_content_container, #fc_content_footer\").css({width:a-\ne.size.width+\"px\"});$(\"#fc_sidebar_footer, #fc_sidebar, #fc_activity, #fc_sidebar_content\").css({width:e.size.width+\"px\"});$(\"#fc_add_page\").css({left:e.size.width+\"px\"})},stop:function(a,b){$.cookie(\"sidebar\",b.size.width,{path:\"/\"})}});$(\"#fc_add_page_nav\").find(\"a\").click(function(){var a=$(this);a.hasClass(\"fc_active\")||($(\"#fc_add_page\").find(\".fc_active\").removeClass(\"fc_active\"),a.addClass(\"fc_active\"),a=a.attr(\"href\"),$(a).addClass(\"fc_active\"));return!1});$(\"#fc_footer_info\").on(\"click\",", "label": 0, "label_name": "vulnerable"} -{"code": "function reqSubsystem(chan, name, cb) {\n if (chan.outgoing.state !== 'open') {\n cb(new Error('Channel is not open'));\n return;\n }\n\n chan._callbacks.push((had_err) => {\n if (had_err) {\n cb(had_err !== true\n ? had_err\n : new Error(`Unable to start subsystem: ${name}`));\n return;\n }\n chan.subtype = 'subsystem';\n cb(undefined, chan);\n });\n\n chan._client._protocol.subsystem(chan.outgoing.id, name, true);\n}", "label": 1, "label_name": "safe"} -{"code": " it \"should exist\" do\n expect(Puppet::Parser::Functions.function(\"chomp\")).to eq(\"function_chomp\")\n end", "label": 0, "label_name": "vulnerable"} -{"code": " protected function getUserzoneCookie() \n {\n \treturn null;\n }", "label": 1, "label_name": "safe"} -{"code": " $output = $i === false ? '' : substr($output, 0, $i);\n } elseif ($path === '.' || $path === '..') {\n // Step 2.D\n $path = '';\n } else {\n // Step 2.E\n $i = strpos($path, '/', $path[0] === '/');\n if ($i === false) {\n $output .= $path;\n $path = '';\n break;\n }\n $output .= substr($path, 0, $i);\n $path = substr($path, $i);\n }\n }\n\n if ($path !== '') {\n $message = sprintf(\n 'Unable to remove dot segments; hit loop limit %d (left: %s)',\n $j, var_export($path, true)\n );\n trigger_error($message, E_USER_WARNING);\n }\n\n return $output;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "void AvahiService::stop()\n{\n if (resolver) {\n resolver->Free();\n resolver->deleteLater();\n disconnect(resolver, SIGNAL(Found(int,int,const QString &,const QString &,const QString &,const QString &, int, const QString &,ushort,const QList&, uint)),\n this, SLOT(resolved(int,int,const QString &,const QString &,const QString &,const QString &, int, const QString &,ushort, const QList&, uint)));\n disconnect(resolver, SIGNAL(Failure(QString)), this, SLOT(error(QString)));\n resolver=0;\n }\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function offset($value)\n {\n $this->offset = max(0, $value);\n\n return $this;\n }", "label": 1, "label_name": "safe"} -{"code": "static int nr_recvmsg(struct kiocb *iocb, struct socket *sock,\n\t\t struct msghdr *msg, size_t size, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct sockaddr_ax25 *sax = (struct sockaddr_ax25 *)msg->msg_name;\n\tsize_t copied;\n\tstruct sk_buff *skb;\n\tint er;\n\n\t/*\n\t * This works for seqpacket too. The receiver has ordered the queue for\n\t * us! We do one quick check first though\n\t */\n\n\tlock_sock(sk);\n\tif (sk->sk_state != TCP_ESTABLISHED) {\n\t\trelease_sock(sk);\n\t\treturn -ENOTCONN;\n\t}\n\n\t/* Now we can treat all alike */\n\tif ((skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DONTWAIT, &er)) == NULL) {\n\t\trelease_sock(sk);\n\t\treturn er;\n\t}\n\n\tskb_reset_transport_header(skb);\n\tcopied = skb->len;\n\n\tif (copied > size) {\n\t\tcopied = size;\n\t\tmsg->msg_flags |= MSG_TRUNC;\n\t}\n\n\ter = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);\n\tif (er < 0) {\n\t\tskb_free_datagram(sk, skb);\n\t\trelease_sock(sk);\n\t\treturn er;\n\t}\n\n\tif (sax != NULL) {\n\t\tmemset(sax, 0, sizeof(sax));\n\t\tsax->sax25_family = AF_NETROM;\n\t\tskb_copy_from_linear_data_offset(skb, 7, sax->sax25_call.ax25_call,\n\t\t\t AX25_ADDR_LEN);\n\t}\n\n\tmsg->msg_namelen = sizeof(*sax);\n\n\tskb_free_datagram(sk, skb);\n\n\trelease_sock(sk);\n\treturn copied;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " relatedTypeString: this.translateEntityType(this.entityType),\n iconHtml: this.getIconHtml(this.entityType, this.entityId)\n }, Dep.prototype.data.call(this));\n },\n\n init: function () {\n if (this.getUser().isAdmin()) {\n this.isRemovable = true;\n }\n Dep.prototype.init.call(this);\n },\n\n setup: function () {\n var data = this.model.get('data') || {};\n\n this.entityType = this.model.get('relatedType') || data.entityType || null;\n this.entityId = this.model.get('relatedId') || data.entityId || null;\n this.entityName = this.model.get('relatedName') || data.entityName || null;\n\n this.messageData['relatedEntityType'] = this.translateEntityType(this.entityType);\n this.messageData['relatedEntity'] = '' + this.entityName +'';\n\n this.createMessage();\n }\n });\n});", "label": 0, "label_name": "vulnerable"} -{"code": " public SAXReader(boolean validating) {\n this.validating = validating;\n }", "label": 1, "label_name": "safe"} -{"code": "\t\thelp = function() {\n\t\t\t// help tab\n\t\t\thtml.push('
    ');\n\t\t\thtml.push('DON\\'T PANIC');\n\t\t\thtml.push('
    ');\n\t\t\t// end help\n\t\t},", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic function upload($_files , $file_key , $uid , $item_id = 0 , $page_id = 0 ){\n\t\t$uploadFile = $_files[$file_key] ;\n\n\t\tif( !$this->isAllowedFilename($_files[$file_key]['name']) ){\n\t\t\treturn false;\n\t\t}\n\n\t\t$oss_open = D(\"Options\")->get(\"oss_open\" ) ;\n\t\tif ($oss_open) {\n\t\t\t\t$url = $this->uploadOss($uploadFile);\n\t\t\t\tif ($url) {\n\t\t\t\t\t\t$sign = md5($url.time().rand()) ;\n\t\t\t\t\t\t$insert = array(\n\t\t\t\t\t\t\"sign\" => $sign,\n\t\t\t\t\t\t\"uid\" => $uid,\n\t\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\t\"display_name\" => $uploadFile['name'],\n\t\t\t\t\t\t\"file_type\" => $uploadFile['type'],\n\t\t\t\t\t\t\"file_size\" => $uploadFile['size'],\n\t\t\t\t\t\t\"real_url\" => $url,\n\t\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\t$file_id = D(\"UploadFile\")->add($insert);\n\t\t\t\t\t\t$insert = array(\n\t\t\t\t\t\t\t\"file_id\" => $file_id,\n\t\t\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t$ret = D(\"FilePage\")->add($insert);\n\t\t\t\t\t\t$url = server_url(\"api/attachment/visitFile\",array(\"sign\" => $sign)); \n\t\t\t\t\t return $url ;\n\t\t\t\t}\n\t\t}else{\n\t\t\t$upload = new \\Think\\Upload();// \u5b9e\u4f8b\u5316\u4e0a\u4f20\u7c7b\n\t\t\t$upload->maxSize = 1003145728 ;// \u8bbe\u7f6e\u9644\u4ef6\u4e0a\u4f20\u5927\u5c0f\n\t\t\t$upload->rootPath = './../Public/Uploads/';// \u8bbe\u7f6e\u9644\u4ef6\u4e0a\u4f20\u76ee\u5f55\n\t\t\t$upload->savePath = '';// \u8bbe\u7f6e\u9644\u4ef6\u4e0a\u4f20\u5b50\u76ee\u5f55\n\t\t\t$info = $upload->uploadOne($uploadFile) ;\n\t\t\tif(!$info) {// \u4e0a\u4f20\u9519\u8bef\u63d0\u793a\u9519\u8bef\u4fe1\u606f\n\t\t\t\tvar_dump($upload->getError());\n\t\t\t\treturn;\n\t\t\t}else{// \u4e0a\u4f20\u6210\u529f \u83b7\u53d6\u4e0a\u4f20\u6587\u4ef6\u4fe1\u606f\n\t\t\t\t$url = site_url().'/Public/Uploads/'.$info['savepath'].$info['savename'] ;\n\t\t\t\t$sign = md5($url.time().rand()) ;\n\t\t\t\t$insert = array(\n\t\t\t\t\t\"sign\" => $sign,\n\t\t\t\t\t\"uid\" => $uid,\n\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\"display_name\" => $uploadFile['name'],\n\t\t\t\t\t\"file_type\" => $uploadFile['type'],\n\t\t\t\t\t\"file_size\" => $uploadFile['size'],\n\t\t\t\t\t\"real_url\" => $url,\n\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t);\n\t\t\t\t\t$file_id = D(\"UploadFile\")->add($insert);\n\t\t\t\t\t$insert = array(\n\t\t\t\t\t\t\"file_id\" => $file_id,\n\t\t\t\t\t\t\"item_id\" => $item_id,\n\t\t\t\t\t\t\"page_id\" => $page_id,\n\t\t\t\t\t\t\"addtime\" => time(),\n\t\t\t\t\t\t);\n\t\t\t\t\t$ret = D(\"FilePage\")->add($insert);\n\t\t\t\t$url = server_url(\"api/attachment/visitFile\",array(\"sign\" => $sign));\n\t\t\t\treturn $url ;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": " public function __construct($message = null, \\Exception $previous = null, $code = 0)\n {\n parent::__construct(403, $message, $previous, array(), $code);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\tprivate static async Task ResponseTransfer(EAccess access, string botNames, string botNameTo, ulong steamID = 0) {\n\t\tif (!Enum.IsDefined(access)) {\n\t\t\tthrow new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(botNames)) {\n\t\t\tthrow new ArgumentNullException(nameof(botNames));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(botNameTo)) {\n\t\t\tthrow new ArgumentNullException(nameof(botNameTo));\n\t\t}\n\n\t\tHashSet? bots = Bot.GetBots(botNames);\n\n\t\tif ((bots == null) || (bots.Count == 0)) {\n\t\t\treturn access >= EAccess.Owner ? FormatStaticResponse(string.Format(CultureInfo.CurrentCulture, Strings.BotNotFound, botNames)) : null;\n\t\t}\n\n\t\tIList results = await Utilities.InParallel(bots.Select(bot => bot.Commands.ResponseTransfer(ProxyAccess(bot, access, steamID), botNameTo))).ConfigureAwait(false);\n\n\t\tList responses = new(results.Where(static result => !string.IsNullOrEmpty(result))!);\n\n\t\treturn responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;\n\t}", "label": 1, "label_name": "safe"} -{"code": "\tprivate static async Task ResponsePointsBalance(EAccess access, string botNames, ulong steamID = 0) {\n\t\tif (!Enum.IsDefined(access)) {\n\t\t\tthrow new InvalidEnumArgumentException(nameof(access), (int) access, typeof(EAccess));\n\t\t}\n\n\t\tif (string.IsNullOrEmpty(botNames)) {\n\t\t\tthrow new ArgumentNullException(nameof(botNames));\n\t\t}\n\n\t\tHashSet? bots = Bot.GetBots(botNames);\n\n\t\tif ((bots == null) || (bots.Count == 0)) {\n\t\t\treturn access >= EAccess.Owner ? FormatStaticResponse(string.Format(CultureInfo.CurrentCulture, Strings.BotNotFound, botNames)) : null;\n\t\t}\n\n\t\tIList results = await Utilities.InParallel(bots.Select(bot => bot.Commands.ResponsePointsBalance(ProxyAccess(bot, access, steamID)))).ConfigureAwait(false);\n\n\t\tList responses = new(results.Where(static result => !string.IsNullOrEmpty(result))!);\n\n\t\treturn responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;\n\t}", "label": 1, "label_name": "safe"} -{"code": "FstringParser_ConcatFstring(FstringParser *state, const char **str,\n const char *end, int raw, int recurse_lvl,\n struct compiling *c, const node *n)\n{\n FstringParser_check_invariants(state);\n state->fmode = 1;\n\n /* Parse the f-string. */\n while (1) {\n PyObject *literal = NULL;\n expr_ty expression = NULL;\n\n /* If there's a zero length literal in front of the\n expression, literal will be NULL. If we're at the end of\n the f-string, expression will be NULL (unless result == 1,\n see below). */\n int result = fstring_find_literal_and_expr(str, end, raw, recurse_lvl,\n &literal, &expression,\n c, n);\n if (result < 0)\n return -1;\n\n /* Add the literal, if any. */\n if (!literal) {\n /* Do nothing. Just leave last_str alone (and possibly\n NULL). */\n } else if (!state->last_str) {\n /* Note that the literal can be zero length, if the\n input string is \"\\\\\\n\" or \"\\\\\\r\", among others. */\n state->last_str = literal;\n literal = NULL;\n } else {\n /* We have a literal, concatenate it. */\n assert(PyUnicode_GET_LENGTH(literal) != 0);\n if (FstringParser_ConcatAndDel(state, literal) < 0)\n return -1;\n literal = NULL;\n }\n\n /* We've dealt with the literal now. It can't be leaked on further\n errors. */\n assert(literal == NULL);\n\n /* See if we should just loop around to get the next literal\n and expression, while ignoring the expression this\n time. This is used for un-doubling braces, as an\n optimization. */\n if (result == 1)\n continue;\n\n if (!expression)\n /* We're done with this f-string. */\n break;\n\n /* We know we have an expression. Convert any existing string\n to a Str node. */\n if (!state->last_str) {\n /* Do nothing. No previous literal. */\n } else {\n /* Convert the existing last_str literal to a Str node. */\n expr_ty str = make_str_node_and_del(&state->last_str, c, n);\n if (!str || ExprList_Append(&state->expr_list, str) < 0)\n return -1;\n }\n\n if (ExprList_Append(&state->expr_list, expression) < 0)\n return -1;\n }\n\n /* If recurse_lvl is zero, then we must be at the end of the\n string. Otherwise, we must be at a right brace. */\n\n if (recurse_lvl == 0 && *str < end-1) {\n ast_error(c, n, \"f-string: unexpected end of string\");\n return -1;\n }\n if (recurse_lvl != 0 && **str != '}') {\n ast_error(c, n, \"f-string: expecting '}'\");\n return -1;\n }\n\n FstringParser_check_invariants(state);\n return 0;\n}", "label": 1, "label_name": "safe"} -{"code": " error: function(xhr, status, error) {\n if ((status == \"timeout\") || ($.trim(error) == \"timeout\")) {\n /*\n We are not interested in timeout because:\n - it can take minutes to stop a node (resources running on it have\n to be stopped/moved and we do not need to wait for that)\n - if pcs is not able to stop a node it returns an (forceable) error\n immediatelly\n */\n return;\n }\n var message = \"Unable to stop node '\" + node + \" \" + ajax_simple_error(\n xhr, status, error\n );\n if (message.indexOf('--force') == -1) {\n alert(message);\n }\n else {\n message = message.replace(', use --force to override', '');\n if (confirm(message + \"\\n\\nDo you want to force the operation?\")) {\n node_stop(node, true);\n }\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": "0,0,80,30,\"ellipse\");e(g)}finally{t.getModel().endUpdate()}if(\"horizontalTree\"==l){var k=new mxCompactTreeLayout(t);k.edgeRouting=!1;k.levelDistance=30;D=\"edgeStyle=elbowEdgeStyle;elbow=horizontal;\"}else\"verticalTree\"==l?(k=new mxCompactTreeLayout(t,!1),k.edgeRouting=!1,k.levelDistance=30,D=\"edgeStyle=elbowEdgeStyle;elbow=vertical;\"):\"radialTree\"==l?(k=new mxRadialTreeLayout(t,!1),k.edgeRouting=!1,k.levelDistance=80):\"verticalFlow\"==l?k=new mxHierarchicalLayout(t,mxConstants.DIRECTION_NORTH):\"horizontalFlow\"==\nl?k=new mxHierarchicalLayout(t,mxConstants.DIRECTION_WEST):\"organic\"==l?(k=new mxFastOrganicLayout(t,!1),k.forceConstant=80):\"circle\"==l&&(k=new mxCircleLayout(t));if(null!=k){var m=function(A,z){t.getModel().beginUpdate();try{null!=A&&A(),k.execute(t.getDefaultParent(),g)}catch(L){throw L;}finally{A=new mxMorphing(t),A.addListener(mxEvent.DONE,mxUtils.bind(this,function(){t.getModel().endUpdate();null!=z&&z()})),A.startAnimation()}},q=mxEdgeHandler.prototype.connect;mxEdgeHandler.prototype.connect=\nfunction(A,z,L,M,n){q.apply(this,arguments);m()};t.resizeCell=function(){mxGraph.prototype.resizeCell.apply(this,arguments);m()};t.connectionHandler.addListener(mxEvent.CONNECT,function(){m()})}var v=mxUtils.button(mxResources.get(\"close\"),function(){b.confirm(mxResources.get(\"areYouSure\"),function(){null!=u.parentNode&&(t.destroy(),u.parentNode.removeChild(u));b.hideDialog()})});v.className=\"geBtn\";b.editor.cancelFirst&&d.appendChild(v);var y=mxUtils.button(mxResources.get(\"insert\"),function(A){t.clearCellOverlays();", "label": 1, "label_name": "safe"} -{"code": " public virtual async Task UploadAsync(UploadCommand cmd, CancellationToken cancellationToken = default)\n {\n cancellationToken.ThrowIfCancellationRequested();\n\n var uploadResp = new UploadResponse();\n var targetPath = cmd.TargetPath;\n var volume = targetPath.Volume;\n var warning = uploadResp.GetWarnings();\n var warningDetails = uploadResp.GetWarningDetails();\n var setNewParents = new HashSet();\n\n foreach (var uploadPath in cmd.UploadPathInfos.Distinct())\n {\n var directory = uploadPath.Directory;\n string lastParentHash = null;\n\n while (!volume.IsRoot(directory))\n {\n var hash = lastParentHash ?? directory.GetHash(volume, pathParser);\n lastParentHash = directory.GetParentHash(volume, pathParser);\n\n if (!await directory.ExistsAsync && setNewParents.Add(directory))\n uploadResp.added.Add(await directory.ToFileInfoAsync(hash, lastParentHash, volume, connector.Options, cancellationToken: cancellationToken));\n\n directory = directory.Parent;\n }\n }\n\n var uploadCount = cmd.Upload.Count();\n for (var idx = 0; idx < uploadCount; idx++)\n {\n var formFile = cmd.Upload.ElementAt(idx);\n IDirectory dest;\n string destHash;\n\n try\n {\n if (cmd.UploadPath.Count > idx)\n {\n dest = cmd.UploadPathInfos.ElementAt(idx).Directory;\n destHash = cmd.UploadPath[idx];\n }\n else\n {\n dest = targetPath.Directory;\n destHash = targetPath.HashedTarget;\n }\n\n if (!dest.CanCreateObject())\n throw new PermissionDeniedException($\"Permission denied: {volume.GetRelativePath(dest)}\");\n\n string uploadFullName = Path.Combine(dest.FullName, Path.GetFileName(formFile.FileName));\n var uploadFileInfo = new FileSystemFile(uploadFullName, volume);\n var isOverwrite = false;\n\n if (await uploadFileInfo.ExistsAsync)\n {\n if (cmd.Renames.Contains(formFile.FileName))\n {\n var fileNameWithoutExt = Path.GetFileNameWithoutExtension(formFile.FileName);\n var ext = Path.GetExtension(formFile.FileName);\n var backupName = $\"{fileNameWithoutExt}{cmd.Suffix}{ext}\";\n var fullBakName = Path.Combine(uploadFileInfo.Parent.FullName, backupName);\n var bakFile = new FileSystemFile(fullBakName, volume);\n\n if (await bakFile.ExistsAsync)\n backupName = await bakFile.GetCopyNameAsync(cmd.Suffix, cancellationToken: cancellationToken);\n\n var prevName = uploadFileInfo.Name;\n OnBeforeRename?.Invoke(this, (uploadFileInfo, backupName));\n await uploadFileInfo.RenameAsync(backupName, cancellationToken: cancellationToken);\n OnAfterRename?.Invoke(this, (uploadFileInfo, prevName));\n\n uploadResp.added.Add(await uploadFileInfo.ToFileInfoAsync(destHash, volume, pathParser, pictureEditor, videoEditor, cancellationToken: cancellationToken));\n uploadFileInfo = new FileSystemFile(uploadFullName, volume);\n }\n else if (cmd.Overwrite == 0 || (cmd.Overwrite == null && !volume.UploadOverwrite))\n {\n string newName = await uploadFileInfo.GetCopyNameAsync(cmd.Suffix, cancellationToken: cancellationToken);\n uploadFullName = Path.Combine(uploadFileInfo.DirectoryName, newName);\n uploadFileInfo = new FileSystemFile(uploadFullName, volume);\n isOverwrite = false;\n }\n else if (!uploadFileInfo.ObjectAttribute.Write)\n throw new PermissionDeniedException();\n else isOverwrite = true;\n }\n\n OnBeforeUpload?.Invoke(this, (uploadFileInfo, formFile, isOverwrite));\n using (var fileStream = await uploadFileInfo.OpenWriteAsync(cancellationToken: cancellationToken))\n {\n await formFile.CopyToAsync(fileStream, cancellationToken: cancellationToken);\n }\n OnAfterUpload?.Invoke(this, (uploadFileInfo, formFile, isOverwrite));\n\n await uploadFileInfo.RefreshAsync(cancellationToken);\n uploadResp.added.Add(await uploadFileInfo.ToFileInfoAsync(destHash, volume, pathParser, pictureEditor, videoEditor, cancellationToken: cancellationToken));\n }\n catch (Exception ex)\n {\n var rootCause = ex.GetRootCause();\n OnUploadError?.Invoke(this, ex);\n\n if (rootCause is PermissionDeniedException pEx)\n {\n warning.Add(string.IsNullOrEmpty(pEx.Message) ? $\"Permission denied: {formFile.FileName}\" : pEx.Message);\n warningDetails.Add(ErrorResponse.Factory.UploadFile(pEx, formFile.FileName));\n }\n else\n {\n warning.Add($\"Failed to upload: {formFile.FileName}\");\n warningDetails.Add(ErrorResponse.Factory.UploadFile(ex, formFile.FileName));\n }\n }\n }\n\n return uploadResp;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function index($id)\n {\n if (!is_numeric($id)) {\n throw new MethodNotAllowedException(__('No template with the provided ID exists, or you are not authorised to see it.'));\n }\n //check permissions\n $template = $this->TemplateElement->Template->checkAuthorisation($id, $this->Auth->user(), false);\n if (!$this->_isSiteAdmin() && !$template) {\n throw new MethodNotAllowedException(__('No template with the provided ID exists, or you are not authorised to see it.'));\n }\n\n $templateElements = $this->TemplateElement->find('all', array(\n 'conditions' => array(\n 'template_id' => $id,\n ),\n 'contain' => array(\n 'TemplateElementAttribute',\n 'TemplateElementText',\n 'TemplateElementFile'\n ),\n 'order' => array('TemplateElement.position ASC')\n ));\n $this->loadModel('Attribute');\n $this->set('validTypeGroups', $this->Attribute->validTypeGroups);\n $this->set('id', $id);\n $this->layout = 'ajaxTemplate';\n $this->set('elements', $templateElements);\n $mayModify = false;\n if ($this->_isSiteAdmin() || $template['Template']['org'] == $this->Auth->user('Organisation')['name']) {\n $mayModify = true;\n }\n $this->set('mayModify', $mayModify);\n $this->render('ajax/ajaxIndex');\n }", "label": 1, "label_name": "safe"} -{"code": " public function initFromGdResource($resource)\n {\n throw new \\Intervention\\Image\\Exception\\NotSupportedException(\n 'Imagick driver is unable to init from GD resource.'\n );\n }", "label": 0, "label_name": "vulnerable"} -{"code": "static VALUE from_document(VALUE klass, VALUE document)\n{\n xmlDocPtr doc;\n xmlRelaxNGParserCtxtPtr ctx;\n xmlRelaxNGPtr schema;\n VALUE errors;\n VALUE rb_schema;\n\n Data_Get_Struct(document, xmlDoc, doc);\n\n /* In case someone passes us a node. ugh. */\n doc = doc->doc;\n\n ctx = xmlRelaxNGNewDocParserCtxt(doc);\n\n errors = rb_ary_new();\n xmlSetStructuredErrorFunc((void *)errors, Nokogiri_error_array_pusher);\n\n#ifdef HAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS\n xmlRelaxNGSetParserStructuredErrors(\n ctx,\n Nokogiri_error_array_pusher,\n (void *)errors\n );\n#endif\n\n schema = xmlRelaxNGParse(ctx);\n\n xmlSetStructuredErrorFunc(NULL, NULL);\n xmlRelaxNGFreeParserCtxt(ctx);\n\n if(NULL == schema) {\n xmlErrorPtr error = xmlGetLastError();\n if(error)\n Nokogiri_error_raise(NULL, error);\n else\n rb_raise(rb_eRuntimeError, \"Could not parse document\");\n\n return Qnil;\n }\n\n rb_schema = Data_Wrap_Struct(klass, 0, dealloc, schema);\n rb_iv_set(rb_schema, \"@errors\", errors);\n\n return rb_schema;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps)\n{\n\tint start = 0;\n\tu32 prev_legacy, cur_legacy;\n\tmutex_lock(&kvm->arch.vpit->pit_state.lock);\n\tprev_legacy = kvm->arch.vpit->pit_state.flags & KVM_PIT_FLAGS_HPET_LEGACY;\n\tcur_legacy = ps->flags & KVM_PIT_FLAGS_HPET_LEGACY;\n\tif (!prev_legacy && cur_legacy)\n\t\tstart = 1;\n\tmemcpy(&kvm->arch.vpit->pit_state.channels, &ps->channels,\n\t sizeof(kvm->arch.vpit->pit_state.channels));\n\tkvm->arch.vpit->pit_state.flags = ps->flags;\n\tkvm_pit_load_count(kvm, 0, kvm->arch.vpit->pit_state.channels[0].count, start);\n\tmutex_unlock(&kvm->arch.vpit->pit_state.lock);\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {\n auto* params =\n reinterpret_cast(node->builtin_data);\n\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n\n const TfLiteTensor* input;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kInputTensor, &input));\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n\n TF_LITE_ENSURE_EQ(context, NumDimensions(input), 4);\n\n auto data_type = output->type;\n TF_LITE_ENSURE(context,\n data_type == kTfLiteFloat32 || data_type == kTfLiteUInt8 ||\n data_type == kTfLiteInt8 || data_type == kTfLiteInt32 ||\n data_type == kTfLiteInt64);\n TF_LITE_ENSURE_TYPES_EQ(context, input->type, output->type);\n\n const int block_size = params->block_size;\n const int input_height = input->dims->data[1];\n const int input_width = input->dims->data[2];\n int output_height = input_height / block_size;\n int output_width = input_width / block_size;\n\n TF_LITE_ENSURE_EQ(context, input_height, output_height * block_size);\n TF_LITE_ENSURE_EQ(context, input_width, output_width * block_size);\n\n TfLiteIntArray* output_size = TfLiteIntArrayCreate(4);\n output_size->data[0] = input->dims->data[0];\n output_size->data[1] = output_height;\n output_size->data[2] = output_width;\n output_size->data[3] = input->dims->data[3] * block_size * block_size;\n\n return context->ResizeTensor(context, output, output_size);\n}", "label": 1, "label_name": "safe"} -{"code": " function edit_optiongroup_master() {\n expHistory::set('editable', $this->params);\n \n $id = isset($this->params['id']) ? $this->params['id'] : null;\n $record = new optiongroup_master($id); \n assign_to_template(array(\n 'record'=>$record\n ));\n }", "label": 0, "label_name": "vulnerable"} -{"code": "func (m *MockCoreStrategy) RefreshTokenSignature(arg0 string) string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RefreshTokenSignature\", arg0)\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "label": 1, "label_name": "safe"} -{"code": "R_API RBinJavaAttrInfo *r_bin_java_inner_classes_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tRBinJavaClassesAttribute *icattr;\n\tRBinJavaAttrInfo *attr = NULL;\n\tRBinJavaCPTypeObj *obj;\n\tut32 i = 0;\n\tut64 offset = 0, curpos;\n\tattr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\toffset += 6;\n\tif (buf_offset + offset + 8 > sz) {\n\t\teprintf (\"Invalid amount of inner classes\\n\");\n\t\treturn NULL;\n\t}\n\tif (attr == NULL) {\n\t\t// TODO eprintf\n\t\treturn attr;\n\t}\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_INNER_CLASSES_ATTR;\n\tattr->info.inner_classes_attr.number_of_classes = R_BIN_JAVA_USHORT (buffer, offset);\n\toffset += 2;\n\tattr->info.inner_classes_attr.classes = r_list_newf (r_bin_java_inner_classes_attr_entry_free);\n\tfor (i = 0; i < attr->info.inner_classes_attr.number_of_classes; i++) {\n\t\tcurpos = buf_offset + offset;\n\t\tif (buf_offset + offset + 8 > sz) {\n\t\t\teprintf (\"Invalid amount of inner classes\\n\");\n\t\t\tbreak;\n\t\t}\n\t\ticattr = R_NEW0 (RBinJavaClassesAttribute);\n\t\tif (!icattr) {\n\t\t\tbreak;\n\t\t}\n\t\ticattr->inner_class_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->outer_class_info_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->inner_name_idx = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->inner_class_access_flags = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\ticattr->flags_str = retrieve_class_method_access_string (icattr->inner_class_access_flags);\n\t\ticattr->file_offset = curpos;\n\t\ticattr->size = 8;\n\n\t\tobj = r_bin_java_get_item_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, icattr->inner_name_idx);\n\t\tif (!obj) {\n\t\t\teprintf (\"BINCPLIS IS HULL %d\\n\", icattr->inner_name_idx);\n\t\t}\n\t\ticattr->name = r_bin_java_get_item_name_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, obj);\n\t\tif (!icattr->name) {\n\t\t\tobj = r_bin_java_get_item_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, icattr->inner_class_info_idx);\n\t\t\tif (!obj) {\n\t\t\t\teprintf (\"BINCPLIST IS NULL %d\\n\", icattr->inner_class_info_idx);\n\t\t\t}\n\t\t\ticattr->name = r_bin_java_get_item_name_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, obj);\n\t\t\tif (!icattr->name) {\n\t\t\t\ticattr->name = r_str_dup (NULL, \"NULL\");\n\t\t\t\teprintf (\"r_bin_java_inner_classes_attr: Unable to find the name for %d index.\\n\", icattr->inner_name_idx);\n\t\t\t\tfree (icattr);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tIFDBG eprintf (\"r_bin_java_inner_classes_attr: Inner class name %d is %s.\\n\", icattr->inner_name_idx, icattr->name);\n\t\tr_list_append (attr->info.inner_classes_attr.classes, (void *) icattr);\n\t}\n\tattr->size = offset;\n\t// IFDBG r_bin_java_print_inner_classes_attr_summary(attr);\n\treturn attr;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function argument($key)\n {\n return new \\Intervention\\Image\\Commands\\Argument($this, $key);\n }", "label": 0, "label_name": "vulnerable"} -{"code": " void Compute(OpKernelContext *ctx) override {\n // (0) validations\n const Tensor *a_indices, *b_indices, *a_values_t, *b_values_t, *a_shape,\n *b_shape, *thresh_t;\n\n OP_REQUIRES_OK(ctx, ctx->input(\"a_indices\", &a_indices));\n OP_REQUIRES_OK(ctx, ctx->input(\"b_indices\", &b_indices));\n OP_REQUIRES(ctx,\n TensorShapeUtils::IsMatrix(a_indices->shape()) &&\n TensorShapeUtils::IsMatrix(b_indices->shape()),\n errors::InvalidArgument(\n \"Input indices should be matrices but received shapes: \",\n a_indices->shape().DebugString(), \" and \",\n b_indices->shape().DebugString()));\n const int64 a_nnz = a_indices->dim_size(0);\n const int64 b_nnz = b_indices->dim_size(0);\n\n OP_REQUIRES_OK(ctx, ctx->input(\"a_values\", &a_values_t));\n OP_REQUIRES_OK(ctx, ctx->input(\"b_values\", &b_values_t));\n\n OP_REQUIRES(ctx,\n TensorShapeUtils::IsVector(a_values_t->shape()) &&\n TensorShapeUtils::IsVector(b_values_t->shape()),\n errors::InvalidArgument(\n \"Input values should be vectors but received shapes: \",\n a_values_t->shape().DebugString(), \" and \",\n b_values_t->shape().DebugString()));\n auto a_values = ctx->input(1).vec();\n auto b_values = ctx->input(4).vec();\n OP_REQUIRES(\n ctx, a_values.size() == a_nnz && b_values.size() == b_nnz,\n errors::InvalidArgument(\"Expected \", a_nnz, \" and \", b_nnz,\n \" non-empty input values, got \",\n a_values.size(), \" and \", b_values.size()));\n\n OP_REQUIRES_OK(ctx, ctx->input(\"a_shape\", &a_shape));\n OP_REQUIRES_OK(ctx, ctx->input(\"b_shape\", &b_shape));\n OP_REQUIRES(ctx,\n TensorShapeUtils::IsVector(a_shape->shape()) &&\n TensorShapeUtils::IsVector(b_shape->shape()),\n errors::InvalidArgument(\n \"Input shapes should be a vector but received shapes \",\n a_shape->shape().DebugString(), \" and \",\n b_shape->shape().DebugString()));\n OP_REQUIRES(\n ctx, a_shape->IsSameSize(*b_shape),\n errors::InvalidArgument(\n \"Operands do not have the same ranks; got shapes: \",\n a_shape->SummarizeValue(10), \" and \", b_shape->SummarizeValue(10)));\n const auto a_shape_flat = a_shape->flat();\n const auto b_shape_flat = b_shape->flat();\n for (int i = 0; i < a_shape->NumElements(); ++i) {\n OP_REQUIRES(ctx, a_shape_flat(i) == b_shape_flat(i),\n errors::InvalidArgument(\n \"Operands' shapes do not match: got \", a_shape_flat(i),\n \" and \", b_shape_flat(i), \" for dimension \", i));\n }\n\n OP_REQUIRES_OK(ctx, ctx->input(\"thresh\", &thresh_t));\n OP_REQUIRES(ctx, TensorShapeUtils::IsScalar(thresh_t->shape()),\n errors::InvalidArgument(\n \"The magnitude threshold must be a scalar: got shape \",\n thresh_t->shape().DebugString()));\n // std::abs() so that it works for complex{64,128} values as well\n const Treal thresh = thresh_t->scalar()();\n\n // (1) do a pass over inputs, and append values and indices to vectors\n auto a_indices_mat = a_indices->matrix();\n auto b_indices_mat = b_indices->matrix();\n std::vector> entries_to_copy; // from_a?, idx\n entries_to_copy.reserve(a_nnz + b_nnz);\n std::vector out_values;\n const int num_dims = a_shape->dim_size(0);\n\n OP_REQUIRES(ctx, num_dims > 0,\n errors::InvalidArgument(\"Invalid input_a shape. Received: \",\n a_shape->DebugString()));\n\n // The input and output sparse tensors are assumed to be ordered along\n // increasing dimension number.\n int64 i = 0, j = 0;\n T s;\n while (i < a_nnz && j < b_nnz) {\n switch (sparse::DimComparator::cmp(a_indices_mat, b_indices_mat, i, j,\n num_dims)) {\n case -1:\n entries_to_copy.emplace_back(true, i);\n out_values.push_back(a_values(i));\n ++i;\n break;\n case 0:\n s = a_values(i) + b_values(j);\n if (thresh <= std::abs(s)) {\n entries_to_copy.emplace_back(true, i);\n out_values.push_back(s);\n }\n ++i;\n ++j;\n break;\n case 1:\n entries_to_copy.emplace_back(false, j);\n out_values.push_back(b_values(j));\n ++j;\n break;\n }\n }\n\n#define HANDLE_LEFTOVERS(A_OR_B, IDX, IS_A) \\\n while (IDX < A_OR_B##_nnz) { \\\n entries_to_copy.emplace_back(IS_A, IDX); \\\n out_values.push_back(A_OR_B##_values(IDX)); \\\n ++IDX; \\\n }\n\n // at most one of these calls appends new values\n HANDLE_LEFTOVERS(a, i, true);\n HANDLE_LEFTOVERS(b, j, false);\n#undef HANDLE_LEFTOVERS\n\n // (2) allocate and fill output tensors\n const int64 sum_nnz = out_values.size();\n Tensor *out_indices_t, *out_values_t;\n OP_REQUIRES_OK(ctx,\n ctx->allocate_output(0, TensorShape({sum_nnz, num_dims}),\n &out_indices_t));\n OP_REQUIRES_OK(\n ctx, ctx->allocate_output(1, TensorShape({sum_nnz}), &out_values_t));\n auto out_indices_mat = out_indices_t->matrix();\n auto out_values_flat = out_values_t->vec();\n\n for (i = 0; i < sum_nnz; ++i) {\n const bool from_a = entries_to_copy[i].first;\n const int64 idx = entries_to_copy[i].second;\n out_indices_mat.chip<0>(i) =\n from_a ? a_indices_mat.chip<0>(idx) : b_indices_mat.chip<0>(idx);\n }\n if (sum_nnz > 0) {\n std::copy_n(out_values.begin(), sum_nnz, &out_values_flat(0));\n }\n ctx->set_output(2, *a_shape);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "do_core_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type,\n int swap, uint32_t namesz, uint32_t descsz,\n size_t noff, size_t doff, int *flags, size_t size, int clazz)\n{\n#ifdef ELFCORE\n\tint os_style = -1;\n\t/*\n\t * Sigh. The 2.0.36 kernel in Debian 2.1, at\n\t * least, doesn't correctly implement name\n\t * sections, in core dumps, as specified by\n\t * the \"Program Linking\" section of \"UNIX(R) System\n\t * V Release 4 Programmer's Guide: ANSI C and\n\t * Programming Support Tools\", because my copy\n\t * clearly says \"The first 'namesz' bytes in 'name'\n\t * contain a *null-terminated* [emphasis mine]\n\t * character representation of the entry's owner\n\t * or originator\", but the 2.0.36 kernel code\n\t * doesn't include the terminating null in the\n\t * name....\n\t */\n\tif ((namesz == 4 && strncmp((char *)&nbuf[noff], \"CORE\", 4) == 0) ||\n\t (namesz == 5 && strcmp((char *)&nbuf[noff], \"CORE\") == 0)) {\n\t\tos_style = OS_STYLE_SVR4;\n\t}\n\n\tif ((namesz == 8 && strcmp((char *)&nbuf[noff], \"FreeBSD\") == 0)) {\n\t\tos_style = OS_STYLE_FREEBSD;\n\t}\n\n\tif ((namesz >= 11 && strncmp((char *)&nbuf[noff], \"NetBSD-CORE\", 11)\n\t == 0)) {\n\t\tos_style = OS_STYLE_NETBSD;\n\t}\n\n\tif (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) {\n\t\tif (file_printf(ms, \", %s-style\", os_style_names[os_style])\n\t\t == -1)\n\t\t\treturn 1;\n\t\t*flags |= FLAGS_DID_CORE_STYLE;\n\t\t*flags |= os_style;\n\t}\n\n\tswitch (os_style) {\n\tcase OS_STYLE_NETBSD:\n\t\tif (type == NT_NETBSD_CORE_PROCINFO) {\n\t\t\tchar sbuf[512];\n\t\t\tstruct NetBSD_elfcore_procinfo pi;\n\t\t\tmemset(&pi, 0, sizeof(pi));\n\t\t\tmemcpy(&pi, nbuf + doff, descsz);\n\n\t\t\tif (file_printf(ms, \", from '%.31s', pid=%u, uid=%u, \"\n\t\t\t \"gid=%u, nlwps=%u, lwp=%u (signal %u/code %u)\",\n\t\t\t file_printable(sbuf, sizeof(sbuf),\n\t\t\t RCAST(char *, pi.cpi_name)),\n\t\t\t elf_getu32(swap, (uint32_t)pi.cpi_pid),\n\t\t\t elf_getu32(swap, pi.cpi_euid),\n\t\t\t elf_getu32(swap, pi.cpi_egid),\n\t\t\t elf_getu32(swap, pi.cpi_nlwps),\n\t\t\t elf_getu32(swap, (uint32_t)pi.cpi_siglwp),\n\t\t\t elf_getu32(swap, pi.cpi_signo),\n\t\t\t elf_getu32(swap, pi.cpi_sigcode)) == -1)\n\t\t\t\treturn 1;\n\n\t\t\t*flags |= FLAGS_DID_CORE;\n\t\t\treturn 1;\n\t\t}\n\t\tbreak;\n\n\tcase OS_STYLE_FREEBSD:\n\t\tif (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {\n\t\t\tsize_t argoff, pidoff;\n\n\t\t\tif (clazz == ELFCLASS32)\n\t\t\t\targoff = 4 + 4 + 17;\n\t\t\telse\n\t\t\t\targoff = 4 + 4 + 8 + 17;\n\t\t\tif (file_printf(ms, \", from '%.80s'\", nbuf + doff +\n\t\t\t argoff) == -1)\n\t\t\t\treturn 1;\n\t\t\tpidoff = argoff + 81 + 2;\n\t\t\tif (doff + pidoff + 4 <= size) {\n\t\t\t\tif (file_printf(ms, \", pid=%u\",\n\t\t\t\t elf_getu32(swap, *RCAST(uint32_t *, (nbuf +\n\t\t\t\t doff + pidoff)))) == -1)\n\t\t\t\t\treturn 1;\n\t\t\t}\n\t\t\t*flags |= FLAGS_DID_CORE;\n\t\t}\t\t\t \n\t\tbreak;\n\n\tdefault:\n\t\tif (type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) {\n\t\t\tsize_t i, j;\n\t\t\tunsigned char c;\n\t\t\t/*\n\t\t\t * Extract the program name. We assume\n\t\t\t * it to be 16 characters (that's what it\n\t\t\t * is in SunOS 5.x and Linux).\n\t\t\t *\n\t\t\t * Unfortunately, it's at a different offset\n\t\t\t * in various OSes, so try multiple offsets.\n\t\t\t * If the characters aren't all printable,\n\t\t\t * reject it.\n\t\t\t */\n\t\t\tfor (i = 0; i < NOFFSETS; i++) {\n\t\t\t\tunsigned char *cname, *cp;\n\t\t\t\tsize_t reloffset = prpsoffsets(i);\n\t\t\t\tsize_t noffset = doff + reloffset;\n\t\t\t\tsize_t k;\n\t\t\t\tfor (j = 0; j < 16; j++, noffset++,\n\t\t\t\t reloffset++) {\n\t\t\t\t\t/*\n\t\t\t\t\t * Make sure we're not past\n\t\t\t\t\t * the end of the buffer; if\n\t\t\t\t\t * we are, just give up.\n\t\t\t\t\t */\n\t\t\t\t\tif (noffset >= size)\n\t\t\t\t\t\tgoto tryanother;\n\n\t\t\t\t\t/*\n\t\t\t\t\t * Make sure we're not past\n\t\t\t\t\t * the end of the contents;\n\t\t\t\t\t * if we are, this obviously\n\t\t\t\t\t * isn't the right offset.\n\t\t\t\t\t */\n\t\t\t\t\tif (reloffset >= descsz)\n\t\t\t\t\t\tgoto tryanother;\n\n\t\t\t\t\tc = nbuf[noffset];\n\t\t\t\t\tif (c == '\\0') {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * A '\\0' at the\n\t\t\t\t\t\t * beginning is\n\t\t\t\t\t\t * obviously wrong.\n\t\t\t\t\t\t * Any other '\\0'\n\t\t\t\t\t\t * means we're done.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (j == 0)\n\t\t\t\t\t\t\tgoto tryanother;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * A nonprintable\n\t\t\t\t\t\t * character is also\n\t\t\t\t\t\t * wrong.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (!isprint(c) || isquote(c))\n\t\t\t\t\t\t\tgoto tryanother;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * Well, that worked.\n\t\t\t\t */\n\n\t\t\t\t/*\n\t\t\t\t * Try next offsets, in case this match is\n\t\t\t\t * in the middle of a string.\n\t\t\t\t */\n\t\t\t\tfor (k = i + 1 ; k < NOFFSETS; k++) {\n\t\t\t\t\tsize_t no;\n\t\t\t\t\tint adjust = 1;\n\t\t\t\t\tif (prpsoffsets(k) >= prpsoffsets(i))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tfor (no = doff + prpsoffsets(k);\n\t\t\t\t\t no < doff + prpsoffsets(i); no++)\n\t\t\t\t\t\tadjust = adjust\n\t\t\t\t\t\t && isprint(nbuf[no]);\n\t\t\t\t\tif (adjust)\n\t\t\t\t\t\ti = k;\n\t\t\t\t}\n\n\t\t\t\tcname = (unsigned char *)\n\t\t\t\t &nbuf[doff + prpsoffsets(i)];\n\t\t\t\tfor (cp = cname; cp < nbuf + size && *cp\n\t\t\t\t && isprint(*cp); cp++)\n\t\t\t\t\tcontinue;\n\t\t\t\t/*\n\t\t\t\t * Linux apparently appends a space at the end\n\t\t\t\t * of the command line: remove it.\n\t\t\t\t */\n\t\t\t\twhile (cp > cname && isspace(cp[-1]))\n\t\t\t\t\tcp--;\n\t\t\t\tif (file_printf(ms, \", from '%.*s'\",\n\t\t\t\t (int)(cp - cname), cname) == -1)\n\t\t\t\t\treturn 1;\n\t\t\t\t*flags |= FLAGS_DID_CORE;\n\t\t\t\treturn 1;\n\n\t\t\ttryanother:\n\t\t\t\t;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\t}\n#endif\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "template void testFeatTable(const T & table, const char * testName)\n{\n FeatureMap testFeatureMap;\n dummyFace.replace_table(TtfUtil::Tag::Feat, &table, sizeof(T));\n gr_face * face = gr_make_face_with_ops(&dummyFace, &face_handle::ops, 0);\n if (!face) throw std::runtime_error(\"failed to load font\");\n bool readStatus = testFeatureMap.readFeats(*face);\n testAssert(\"readFeats\", readStatus);\n fprintf(stderr, testName, NULL);\n testAssertEqual(\"test num features %hu,%hu\\n\", testFeatureMap.numFeats(), table.m_header.m_numFeat);\n\n for (size_t i = 0; i < sizeof(table.m_defs) / sizeof(FeatDefn); i++)\n {\n const FeatureRef * ref = testFeatureMap.findFeatureRef(table.m_defs[i].m_featId);\n testAssert(\"test feat\\n\", ref);\n testAssertEqual(\"test feat settings %hu %hu\\n\", ref->getNumSettings(), table.m_defs[i].m_numFeatSettings);\n testAssertEqual(\"test feat label %hu %hu\\n\", ref->getNameId(), table.m_defs[i].m_label);\n size_t settingsIndex = (table.m_defs[i].m_settingsOffset - sizeof(FeatHeader)\n - (sizeof(FeatDefn) * table.m_header.m_numFeat)) / sizeof(FeatSetting);\n for (size_t j = 0; j < table.m_defs[i].m_numFeatSettings; j++)\n {\n testAssertEqual(\"setting label %hu %hu\\n\", ref->getSettingName(j),\n table.m_settings[settingsIndex+j].m_label);\n }\n }\n gr_face_destroy(face);\n}", "label": 1, "label_name": "safe"} -{"code": "\tpub fn generate_web_proxy_access_token(&self) -> String {\n\t\tlet token = random_string(16);\n\t\tlet mut tokens = self.web_proxy_tokens.lock();\n\t\ttokens.prune();\n\t\ttokens.insert(token.clone(), ());\n\t\ttoken\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": " public void testWhitespaceInTransferEncoding02() {\n String requestStr = \"POST / HTTP/1.1\" +\n \"Transfer-Encoding : chunked\\r\\n\" +\n \"Host: target.com\" +\n \"Content-Length: 65\\r\\n\\r\\n\" +\n \"0\\r\\n\\r\\n\" +\n \"GET /maliciousRequest HTTP/1.1\\r\\n\" +\n \"Host: evilServer.com\\r\\n\" +\n \"Foo: x\";\n testInvalidHeaders0(requestStr);\n }", "label": 1, "label_name": "safe"} -{"code": "\tpublic GroupXStream() {\n\t\txstream = XStreamHelper.createXStreamInstance();\n\t\t\n\t\tXStream.setupDefaultSecurity(xstream);\n\t\tClass[] types = new Class[] {\n\t\t\t\tCollabTools.class, Group.class, Area.class, AreaCollection.class, GroupCollection.class,\n\t\t\t\tOLATGroupExport.class, ArrayList.class\n\t\t};\n\t\txstream.addPermission(new ExplicitTypePermission(types));\n\t\t\n\t\txstream.alias(\"OLATGroupExport\", OLATGroupExport.class);\n\t\txstream.alias(\"AreaCollection\", AreaCollection.class);\n\t\txstream.alias(\"GroupCollection\", GroupCollection.class);\n\n\t\txstream.addImplicitCollection(AreaCollection.class, \"groups\", \"Area\", Area.class);\n\t\txstream.addImplicitCollection(GroupCollection.class, \"groups\", \"Group\", Group.class);\n\t\t\n\t\txstream.aliasAttribute(OLATGroupExport.class, \"areas\", \"AreaCollection\");\n\t\txstream.aliasAttribute(OLATGroupExport.class, \"groups\", \"GroupCollection\");\n\n\t\txstream.alias(\"Area\", Area.class);\n\t\txstream.aliasAttribute(Area.class, \"name\", \"name\");\n\t\txstream.aliasAttribute(Area.class, \"key\", \"key\");\n\t\txstream.addImplicitCollection(Area.class, \"description\", \"Description\", String.class);\n\t\txstream.aliasAttribute(Area.class, \"description\", \"description\");\n\n\t\txstream.alias(\"Group\", Group.class);\n\t\txstream.alias(\"CollabTools\", CollabTools.class);\n\t\txstream.addImplicitCollection(Group.class, \"areaRelations\", \"AreaRelation\", String.class);\n\t\txstream.addImplicitCollection(Group.class, \"description\", \"Description\", String.class);\n\t\txstream.aliasAttribute(Group.class, \"key\", \"key\");\n\t\txstream.aliasAttribute(Group.class, \"name\", \"name\");\n\t\txstream.aliasAttribute(Group.class, \"maxParticipants\", \"maxParticipants\");\n\t\txstream.aliasAttribute(Group.class, \"minParticipants\", \"minParticipants\");\n\t\txstream.aliasAttribute(Group.class, \"waitingList\", \"waitingList\");\n\t\txstream.aliasAttribute(Group.class, \"autoCloseRanks\", \"autoCloseRanks\");\n\t\txstream.aliasAttribute(Group.class, \"showOwners\", \"showOwners\");\n\t\txstream.aliasAttribute(Group.class, \"showParticipants\", \"showParticipants\");\n\t\txstream.aliasAttribute(Group.class, \"showWaitingList\", \"showWaitingList\");\n\t\txstream.aliasAttribute(Group.class, \"description\", \"description\");\n\t\txstream.aliasAttribute(Group.class, \"info\", \"info\");\n\t\txstream.aliasAttribute(Group.class, \"folderAccess\", \"folderAccess\");\n\t\t\n\t\t//CollabTools\n\t\txstream.aliasAttribute(Group.class, \"tools\", \"CollabTools\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasNews\", \"hasNews\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasContactForm\", \"hasContactForm\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasCalendar\", \"hasCalendar\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasFolder\", \"hasFolder\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasForum\", \"hasForum\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasChat\", \"hasChat\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasWiki\", \"hasWiki\");\n\t\txstream.aliasAttribute(CollabTools.class, \"hasPortfolio\", \"hasPortfolio\");\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": " public function testWrongPdoErrMode()\n {\n $pdo = new \\PDO('sqlite::memory:');\n $pdo->setAttribute(\\PDO::ATTR_ERRMODE, \\PDO::ERRMODE_SILENT);\n $pdo->exec('CREATE TABLE sessions (sess_id VARCHAR(128) PRIMARY KEY, sess_data TEXT, sess_time INTEGER)');\n\n $this->setExpectedException('InvalidArgumentException');\n $storage = new LegacyPdoSessionHandler($pdo, array('db_table' => 'sessions'));\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\"dblclick\",function(La){n();mxEvent.consume(La)})}else if(!ja&&null!=pa&&0 0) {\n this.itineraryItems = new ArrayList();\n for (int i = 0; i < p.length; i++) {\n this.itineraryItems.add(new DirectoryEntry(p[i]));\n }\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public virtual Task RenameAsync(string newName, bool verify = true, CancellationToken cancellationToken = default)\n {\n cancellationToken.ThrowIfCancellationRequested();\n\n if (verify && !this.CanRename()) throw new PermissionDeniedException();\n\n var newPath = PathHelper.GetFullPath(PathHelper.SafelyCombine(Parent.FullName, Parent.FullName, newName));\n directoryInfo.MoveTo(newPath);\n return Task.FromResult(new FileSystemDirectory(newPath, volume));\n }", "label": 1, "label_name": "safe"} +{"code": " it 'rejects with empty array' do\n pp = <<-EOS\n $o = reject([],'aaa')\n notice(inline_template('reject is <%= @o.inspect %>'))\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/reject is \\[\\]/)\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": "\"-\",\"lockUnlock\",\"enterGroup\"],null,ea),O.addSeparator(),this.addSubmenu(\"layout\",O)):ka.isSelectionEmpty()&&ka.isEnabled()?(O.addSeparator(),this.addMenuItems(O,[\"editData\"],null,ea),O.addSeparator(),this.addSubmenu(\"layout\",O),this.addSubmenu(\"insert\",O),this.addMenuItems(O,[\"-\",\"exitGroup\"],null,ea)):ka.isEnabled()&&this.addMenuItems(O,[\"-\",\"lockUnlock\"],null,ea)};var H=Menus.prototype.addPopupMenuEditItems;Menus.prototype.addPopupMenuEditItems=function(O,X,ea){H.apply(this,arguments);this.editorUi.editor.graph.isSelectionEmpty()&&\nthis.addMenuItems(O,[\"copyAsImage\"],null,ea)};EditorUi.prototype.toggleFormatPanel=function(O){null!=this.formatWindow?this.formatWindow.window.setVisible(null!=O?O:!this.formatWindow.window.isVisible()):b(this)};DiagramFormatPanel.prototype.isMathOptionVisible=function(){return!0};var G=EditorUi.prototype.destroy;EditorUi.prototype.destroy=function(){null!=this.sidebarWindow&&(this.sidebarWindow.window.setVisible(!1),this.sidebarWindow.window.destroy(),this.sidebarWindow=null);null!=this.formatWindow&&", "label": 0, "label_name": "vulnerable"} +{"code": " } elseif ($token instanceof HTMLPurifier_Token_End) {\n $_extra = '';\n if ($this->_flashCompat) {\n if ($token->name == \"object\" && !empty($this->_flashStack)) {\n // doesn't do anything for now\n }\n }\n return $_extra . 'name . '>';\n\n } elseif ($token instanceof HTMLPurifier_Token_Empty) {", "label": 1, "label_name": "safe"} +{"code": " public function getErrorName($int)\n {\n if (!$this->_loaded) {\n $this->load();\n }\n if (!isset($this->errorNames[$int])) {\n return \"[Error: $int]\";\n }\n return $this->errorNames[$int];\n }", "label": 1, "label_name": "safe"} +{"code": " def log_operations(logger, ops, duration)\n prefix = \" MOPED: #{host}:#{port} \"\n indent = \" \"*prefix.length\n runtime = (\" (%.1fms)\" % duration)\n\n if ops.length == 1\n logger.debug prefix + ops.first.log_inspect + runtime\n else\n first, *middle, last = ops\n\n logger.debug prefix + first.log_inspect\n middle.each { |m| logger.debug indent + m.log_inspect }\n logger.debug indent + last.log_inspect + runtime\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": " def loadNotificationsImpl(userId: UserId, upToWhen: Option[When], request: DebikiRequest[_])\n : mvc.Result = {\n val notfsAndCounts = request.dao.loadNotificationsSkipReviewTasks(userId, upToWhen, request.who)\n OkSafeJson(notfsAndCounts.notfsJson)\n }\n\n\n def markAllNotfsAsSeen(): Action[JsValue] = PostJsonAction(RateLimits.MarkNotfAsSeen,", "label": 1, "label_name": "safe"} +{"code": "\t\t([ key, value ]) => ({ [key]: spawn.bind(null, value) }),\n\t),", "label": 1, "label_name": "safe"} +{"code": " it 'should return correct scheme' do\n should run.with_params('ftp://www.example.com/test','scheme').and_return('ftp') \n end", "label": 0, "label_name": "vulnerable"} +{"code": "\t\t\t\t\t\tunset($return[$key]);\n\t\t\t\t}\n\t\t\t}\n\t\tbreak;\n\t}\n\treturn @array_change_key_case($return,CASE_UPPER);\n}", "label": 1, "label_name": "safe"} +{"code": "function filterLeaks(ok, globals) {\n return filter(globals, function(key) {\n // Firefox and Chrome exposes iframes as index inside the window object\n if (/^d+/.test(key)) return false;\n\n // in firefox\n // if runner runs in an iframe, this iframe's window.getInterface method not init at first\n // it is assigned in some seconds\n if (global.navigator && /^getInterface/.test(key)) return false;\n\n // an iframe could be approached by window[iframeIndex]\n // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak\n if (global.navigator && /^\\d+/.test(key)) return false;\n\n // Opera and IE expose global variables for HTML element IDs (issue #243)\n if (/^mocha-/.test(key)) return false;\n\n var matched = filter(ok, function(ok) {\n if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]);\n return key == ok;\n });\n return matched.length == 0 && (!global.navigator || 'onerror' !== key);\n });\n}", "label": 1, "label_name": "safe"} +{"code": "Status InferenceContext::Multiply(DimensionHandle first,\n DimensionOrConstant second,\n DimensionHandle* out) {\n const int64_t first_value = Value(first);\n const int64_t second_value = Value(second);\n // Special cases.\n if (first_value == 0) {\n *out = first;\n } else if (second_value == 0) {\n *out = MakeDim(second);\n } else if (first_value == 1) {\n *out = MakeDim(second);\n } else if (second_value == 1) {\n *out = first;\n } else if (first_value == kUnknownDim || second_value == kUnknownDim) {\n *out = UnknownDim();\n } else {\n // Invariant: Both values are known and greater than 1.\n const int64_t product = MultiplyWithoutOverflow(first_value, second_value);\n if (product < 0) {\n return errors::InvalidArgument(\n \"Negative dimension size caused by overflow when multiplying \",\n first_value, \" and \", second_value);\n }\n *out = MakeDim(product);\n }\n return Status::OK();\n}", "label": 1, "label_name": "safe"} +{"code": " public function setUp()\n {\n parent::setUp();\n $this->obj = new HTMLPurifier_Strategy_MakeWellFormed();\n }", "label": 1, "label_name": "safe"} +{"code": " private static function _aesEncrypt($data, $secret)\n {\n if (!is_string($data)) {\n throw new \\InvalidArgumentException('Input parameter \"$data\" must be a string.');\n }\n\n if (!function_exists(\"openssl_encrypt\")) {\n throw new \\SimpleSAML_Error_Exception('The openssl PHP module is not loaded.');\n }\n\n $raw = defined('OPENSSL_RAW_DATA') ? OPENSSL_RAW_DATA : true;\n $key = openssl_digest($secret, 'sha256');\n $method = 'AES-256-CBC';\n $ivSize = 16;\n $iv = substr($key, 0, $ivSize);\n\n return $iv.openssl_encrypt($data, $method, $key, $raw, $iv);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static int pppoe_recvmsg(struct kiocb *iocb, struct socket *sock,\n\t\t struct msghdr *m, size_t total_len, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct sk_buff *skb;\n\tint error = 0;\n\n\tif (sk->sk_state & PPPOX_BOUND) {\n\t\terror = -EIO;\n\t\tgoto end;\n\t}\n\n\tskb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,\n\t\t\t\tflags & MSG_DONTWAIT, &error);\n\tif (error < 0)\n\t\tgoto end;\n\n\tm->msg_namelen = 0;\n\n\tif (skb) {\n\t\ttotal_len = min_t(size_t, total_len, skb->len);\n\t\terror = skb_copy_datagram_iovec(skb, 0, m->msg_iov, total_len);\n\t\tif (error == 0) {\n\t\t\tconsume_skb(skb);\n\t\t\treturn total_len;\n\t\t}\n\t}\n\n\tkfree_skb(skb);\nend:\n\treturn error;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testBuild()\n {\n $this->config->set('Attr.IDBlacklist', array('foo'));\n $accumulator = HTMLPurifier_IDAccumulator::build($this->config, $this->context);\n $this->assertTrue( isset($accumulator->ids['foo']) );\n }", "label": 1, "label_name": "safe"} +{"code": "fp_readl(char *s, int size, struct tok_state *tok)\n{\n PyObject* bufobj;\n const char *buf;\n Py_ssize_t buflen;\n\n /* Ask for one less byte so we can terminate it */\n assert(size > 0);\n size--;\n\n if (tok->decoding_buffer) {\n bufobj = tok->decoding_buffer;\n Py_INCREF(bufobj);\n }\n else\n {\n bufobj = PyObject_CallObject(tok->decoding_readline, NULL);\n if (bufobj == NULL)\n goto error;\n }\n if (PyUnicode_CheckExact(bufobj))\n {\n buf = PyUnicode_AsUTF8AndSize(bufobj, &buflen);\n if (buf == NULL) {\n goto error;\n }\n }\n else\n {\n buf = PyByteArray_AsString(bufobj);\n if (buf == NULL) {\n goto error;\n }\n buflen = PyByteArray_GET_SIZE(bufobj);\n }\n\n Py_XDECREF(tok->decoding_buffer);\n if (buflen > size) {\n /* Too many chars, the rest goes into tok->decoding_buffer */\n tok->decoding_buffer = PyByteArray_FromStringAndSize(buf+size,\n buflen-size);\n if (tok->decoding_buffer == NULL)\n goto error;\n buflen = size;\n }\n else\n tok->decoding_buffer = NULL;\n\n memcpy(s, buf, buflen);\n s[buflen] = '\\0';\n if (buflen == 0) /* EOF */\n s = NULL;\n Py_DECREF(bufobj);\n return s;\n\nerror:\n Py_XDECREF(bufobj);\n return error_ret(tok);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "function(){g.checked&&(null==e||e.checked)?q.removeAttribute(\"disabled\"):q.setAttribute(\"disabled\",\"disabled\")}));mxUtils.br(c);return{getLink:function(){return g.checked?\"blank\"===q.value?\"_blank\":m:null},getEditInput:function(){return g},getEditSelect:function(){return q}}};EditorUi.prototype.addLinkSection=function(c,e){function g(){var x=document.createElement(\"div\");x.style.width=\"100%\";x.style.height=\"100%\";x.style.boxSizing=\"border-box\";null!=q&&q!=mxConstants.NONE?(x.style.border=\"1px solid black\",", "label": 0, "label_name": "vulnerable"} +{"code": "void cJSON_ReplaceItemInObject( cJSON *object, const char *string, cJSON *newitem )\n{\n\tint i = 0;\n\tcJSON *c = object->child;\n\twhile ( c && cJSON_strcasecmp( c->string, string ) ) {\n\t\t++i;\n\t\tc = c->next;\n\t}\n\tif ( c ) {\n\t\tnewitem->string = cJSON_strdup( string );\n\t\tcJSON_ReplaceItemInArray( object, i, newitem );\n\t}\n}", "label": 0, "label_name": "vulnerable"} +{"code": " def handle(self, command, kwargs=None):\n \"\"\"\n Dispatch and handle processing of the given command.\n\n :param command: Name of command to run.\n :type command: unicode\n :param kwargs: Arguments to pass to the command handler. If empty, `request.POST` is used.\n :type kwargs: dict\n :return: response.\n :rtype: HttpResponse\n \"\"\"\n\n kwargs = kwargs or dict(six.iteritems(self.request.POST))\n try:\n handler = self.get_command_handler(command)\n if not handler or not callable(handler):\n raise Problem(_(\"Error! Invalid command `%s`.\") % escape(command))\n kwargs.pop(\"csrfmiddlewaretoken\", None) # The CSRF token should never be passed as a kwarg\n kwargs.pop(\"command\", None) # Nor the command\n kwargs.update(request=self.request, basket=self.basket)\n kwargs = self.preprocess_kwargs(command, kwargs)\n\n response = handler(**kwargs) or {}\n\n except (Problem, ValidationError) as exc:\n if not self.ajax:\n raise\n msg = exc.message if hasattr(exc, \"message\") else exc\n response = {\n \"error\": force_text(msg, errors=\"ignore\"),\n \"code\": force_text(getattr(exc, \"code\", None) or \"\", errors=\"ignore\"),\n }\n\n response = self.postprocess_response(command, kwargs, response)\n\n if self.ajax:\n return JsonResponse(response)\n\n return_url = response.get(\"return\") or kwargs.get(\"return\")\n if return_url and return_url.startswith(\"/\"):\n return HttpResponseRedirect(return_url)\n return redirect(\"shuup:basket\")", "label": 1, "label_name": "safe"} +{"code": "static u16 read_16(cdk_stream_t s)\n{\n\tbyte buf[2];\n\tsize_t nread;\n\n\tassert(s != NULL);\n\n\tstream_read(s, buf, 2, &nread);\n\tif (nread != 2)\n\t\treturn (u16) - 1;\n\treturn buf[0] << 8 | buf[1];\n}", "label": 0, "label_name": "vulnerable"} +{"code": " foreach(var cert in metaDataCertificates)\n {\n // Just like we stop publishing Encryption cert immediately when a Future one is added,\n // in the case of a \"Both\" cert we should switch the current use to Signing so that Idp's stop sending\n // us certs encrypted with the old key\n if (cert.Use == CertificateUse.Both && cert.Status == CertificateStatus.Current && futureBothCertExists)\n {\n cert.Use = CertificateUse.Signing;\n }\n\n if (cert.MetadataPublishOverride == MetadataPublishOverrideType.PublishEncryption)\n {\n cert.Use = CertificateUse.Encryption;\n }\n if (cert.MetadataPublishOverride == MetadataPublishOverrideType.PublishSigning)\n {\n cert.Use = CertificateUse.Signing;\n }\n if (cert.MetadataPublishOverride == MetadataPublishOverrideType.PublishUnspecified)\n {\n cert.Use = CertificateUse.Both;\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "receive_carbon(void **state)\n{\n prof_input(\"/carbons on\");\n\n prof_connect();\n assert_true(stbbr_received(\n \"\"\n ));\n\n stbbr_send(\n \"\"\n \"10\"\n \"On my mobile\"\n \"\"\n );\n assert_true(prof_output_exact(\"Buddy1 (mobile) is online, \\\"On my mobile\\\"\"));\n prof_input(\"/msg Buddy1\");\n assert_true(prof_output_exact(\"unencrypted\"));\n\n stbbr_send(\n \"\"\n \"\"\n \"\"\n \"\"\n \"test carbon from recipient\"\n \"\"\n \"\"\n \"\"\n \"\"\n );\n\n assert_true(prof_output_regex(\"Buddy1/mobile: .+test carbon from recipient\"));\n}", "label": 1, "label_name": "safe"} +{"code": "function Id(a,b){var c=a.split(\"_\");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function Jd(a,b,c){var d={mm:b?\"\u043c\u0438\u043d\u0443\u0442\u0430_\u043c\u0438\u043d\u0443\u0442\u044b_\u043c\u0438\u043d\u0443\u0442\":\"\u043c\u0438\u043d\u0443\u0442\u0443_\u043c\u0438\u043d\u0443\u0442\u044b_\u043c\u0438\u043d\u0443\u0442\",hh:\"\u0447\u0430\u0441_\u0447\u0430\u0441\u0430_\u0447\u0430\u0441\u043e\u0432\",dd:\"\u0434\u0435\u043d\u044c_\u0434\u043d\u044f_\u0434\u043d\u0435\u0439\",MM:\"\u043c\u0435\u0441\u044f\u0446_\u043c\u0435\u0441\u044f\u0446\u0430_\u043c\u0435\u0441\u044f\u0446\u0435\u0432\",yy:\"\u0433\u043e\u0434_\u0433\u043e\u0434\u0430_\u043b\u0435\u0442\"};return\"m\"===c?b?\"\u043c\u0438\u043d\u0443\u0442\u0430\":\"\u043c\u0438\u043d\u0443\u0442\u0443\":a+\" \"+Id(d[c],+a)}function Kd(a){return a>1&&5>a}function Ld(a,b,c,d){var e=a+\" \";switch(c){case\"s\":return b||d?\"p\u00e1r sek\u00fand\":\"p\u00e1r sekundami\";case\"m\":return b?\"min\u00fata\":d?\"min\u00fatu\":\"min\u00fatou\";case\"mm\":return b||d?e+(Kd(a)?\"min\u00faty\":\"min\u00fat\"):e+\"min\u00fatami\";break;case\"h\":return b?\"hodina\":d?\"hodinu\":\"hodinou\";case\"hh\":return b||d?e+(Kd(a)?\"hodiny\":\"hod\u00edn\"):e+\"hodinami\";break;case\"d\":return b||d?\"de\u0148\":\"d\u0148om\";case\"dd\":return b||d?e+(Kd(a)?\"dni\":\"dn\u00ed\"):e+\"d\u0148ami\";break;case\"M\":return b||d?\"mesiac\":\"mesiacom\";case\"MM\":return b||d?e+(Kd(a)?\"mesiace\":\"mesiacov\"):e+\"mesiacmi\";break;case\"y\":return b||d?\"rok\":\"rokom\";case\"yy\":return b||d?e+(Kd(a)?\"roky\":\"rokov\"):e+\"rokmi\"}}", "label": 0, "label_name": "vulnerable"} +{"code": " def wrapper_filename\n filename = prefix ? \"#{prefix}_#{wrapper_name}\" : wrapper_name\n \"/usr/local/rvm/bin/#{filename}\"\n end", "label": 0, "label_name": "vulnerable"} +{"code": " it 'delete_args is an array' do\n expect(instance.delete_args.class).to eq(Array)\n end", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function save_comment( $comment_id = 0, $approval = '' ) {\r\n\t\tif ( !$comment_id || 'spam' === $approval || empty( $_POST['comment_location'] ) || !is_array( $_POST['comment_location'] ) ) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t$location = array(\r\n\t\t\t'lat' => (float) $_POST['comment_location']['lat'],\r\n\t\t\t'lng' => (float) $_POST['comment_location']['lng']\r\n\t\t);\r\n\r\n\t\tGeoMashupDB::set_object_location( 'comment', $comment_id, $location );\r\n\t}\r", "label": 1, "label_name": "safe"} +{"code": " public function setTags(array $tags)\n {\n $this->tags = $tags;\n\n return $this;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n\n const TfLiteTensor* dims;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kDimsTensor, &dims));\n const TfLiteTensor* value;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kValueTensor, &value));\n\n // Make sure the 1st input tensor is 1-D.\n TF_LITE_ENSURE_EQ(context, NumDimensions(dims), 1);\n\n // Make sure the 1st input tensor is int32 or int64.\n const auto dtype = dims->type;\n TF_LITE_ENSURE(context, dtype == kTfLiteInt32 || dtype == kTfLiteInt64);\n\n // Make sure the 2nd input tensor is a scalar.\n TF_LITE_ENSURE_EQ(context, NumDimensions(value), 0);\n\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n output->type = value->type;\n\n if (IsConstantTensor(dims)) {\n TF_LITE_ENSURE_OK(context, ResizeOutput(context, dims, output));\n } else {\n SetTensorToDynamic(output);\n }\n return kTfLiteOk;\n}", "label": 1, "label_name": "safe"} +{"code": " unforwardIn(bindAddr, bindPort, cb) {\n if (!this._sock || !this._sock.writable)\n throw new Error('Not connected');\n\n // Send a request to stop forwarding us new connections for a particular\n // address and port\n\n const wantReply = (typeof cb === 'function');\n\n if (wantReply) {\n this._callbacks.push((had_err) => {\n if (had_err) {\n cb(had_err !== true\n ? had_err\n : new Error(`Unable to unbind from ${bindAddr}:${bindPort}`));\n return;\n }\n\n delete this._forwarding[`${bindAddr}:${bindPort}`];\n\n cb();\n });\n }\n\n this._protocol.cancelTcpipForward(bindAddr, bindPort, wantReply);\n\n return this;\n }", "label": 1, "label_name": "safe"} +{"code": " it 'shouldnt stop the service' do\n pp = <<-EOS\n class { 'ntp':\n service_enable => false,\n service_ensure => stopped,\n service_manage => false,\n service_name => '#{servicename}'\n }\n EOS\n apply_manifest(pp, :catch_failures => true)\n end\n\n describe service(servicename) do\n it { should be_running }\n it { should be_enabled }\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": "this.getInitValue()},reset:function(b){this.setValue(this.getInitValue(),b)},setInitValue:function(){this._.initValue=this.getValue()},resetInitValue:function(){this._.initValue=this._[\"default\"]},getInitValue:function(){return this._.initValue}},o=CKEDITOR.tools.extend({},CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors,{onChange:function(b,a){this._.domOnChangeRegistered||(b.on(\"load\",function(){this.getInputElement().on(\"change\",function(){b.parts.dialog.isVisible()&&this.fire(\"change\",{value:this.getValue()})},", "label": 1, "label_name": "safe"} {"code": " public function getStartingChars()\n {\n return $this->startingChars;\n }", "label": 1, "label_name": "safe"} -{"code": "static Image *ReadXBMImage(const ImageInfo *image_info,ExceptionInfo *exception)\n{\n char\n buffer[MagickPathExtent],\n name[MagickPathExtent];\n\n Image\n *image;\n\n int\n c;\n\n MagickBooleanType\n status;\n\n register ssize_t\n i,\n x;\n\n register Quantum\n *q;\n\n register unsigned char\n *p;\n\n short int\n hex_digits[256];\n\n ssize_t\n y;\n\n unsigned char\n *data;\n\n unsigned int\n bit,\n byte,\n bytes_per_line,\n height,\n length,\n padding,\n version,\n width;\n\n /*\n Open image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n if (image_info->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n image_info->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=AcquireImage(image_info,exception);\n status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);\n if (status == MagickFalse)\n {\n image=DestroyImageList(image);\n return((Image *) NULL);\n }\n /*\n Read X bitmap header.\n */\n width=0;\n height=0;\n while (ReadBlobString(image,buffer) != (char *) NULL)\n if (sscanf(buffer,\"#define %32s %u\",name,&width) == 2)\n if ((strlen(name) >= 6) &&\n (LocaleCompare(name+strlen(name)-6,\"_width\") == 0))\n break;\n while (ReadBlobString(image,buffer) != (char *) NULL)\n if (sscanf(buffer,\"#define %32s %u\",name,&height) == 2)\n if ((strlen(name) >= 7) &&\n (LocaleCompare(name+strlen(name)-7,\"_height\") == 0))\n break;\n image->columns=width;\n image->rows=height;\n image->depth=8;\n image->storage_class=PseudoClass;\n image->colors=2;\n /*\n Scan until hex digits.\n */\n version=11;\n while (ReadBlobString(image,buffer) != (char *) NULL)\n {\n if (sscanf(buffer,\"static short %32s = {\",name) == 1)\n version=10;\n else\n if (sscanf(buffer,\"static unsigned char %32s = {\",name) == 1)\n version=11;\n else\n if (sscanf(buffer,\"static char %32s = {\",name) == 1)\n version=11;\n else\n continue;\n p=(unsigned char *) strrchr(name,'_');\n if (p == (unsigned char *) NULL)\n p=(unsigned char *) name;\n else\n p++;\n if (LocaleCompare(\"bits[]\",(char *) p) == 0)\n break;\n }\n if ((image->columns == 0) || (image->rows == 0) ||\n (EOFBlob(image) != MagickFalse))\n ThrowReaderException(CorruptImageError,\"ImproperImageHeader\");\n /*\n Initialize image structure.\n */\n if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n /*\n Initialize colormap.\n */\n image->colormap[0].red=(MagickRealType) QuantumRange;\n image->colormap[0].green=(MagickRealType) QuantumRange;\n image->colormap[0].blue=(MagickRealType) QuantumRange;\n image->colormap[1].red=0.0;\n image->colormap[1].green=0.0;\n image->colormap[1].blue=0.0;\n if (image_info->ping != MagickFalse)\n {\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n }\n status=SetImageExtent(image,image->columns,image->rows,exception);\n if (status == MagickFalse)\n return(DestroyImageList(image));\n /*\n Initialize hex values.\n */\n hex_digits[(int) '0']=0;\n hex_digits[(int) '1']=1;\n hex_digits[(int) '2']=2;\n hex_digits[(int) '3']=3;\n hex_digits[(int) '4']=4;\n hex_digits[(int) '5']=5;\n hex_digits[(int) '6']=6;\n hex_digits[(int) '7']=7;\n hex_digits[(int) '8']=8;\n hex_digits[(int) '9']=9;\n hex_digits[(int) 'A']=10;\n hex_digits[(int) 'B']=11;\n hex_digits[(int) 'C']=12;\n hex_digits[(int) 'D']=13;\n hex_digits[(int) 'E']=14;\n hex_digits[(int) 'F']=15;\n hex_digits[(int) 'a']=10;\n hex_digits[(int) 'b']=11;\n hex_digits[(int) 'c']=12;\n hex_digits[(int) 'd']=13;\n hex_digits[(int) 'e']=14;\n hex_digits[(int) 'f']=15;\n hex_digits[(int) 'x']=0;\n hex_digits[(int) ' ']=(-1);\n hex_digits[(int) ',']=(-1);\n hex_digits[(int) '}']=(-1);\n hex_digits[(int) '\\n']=(-1);\n hex_digits[(int) '\\t']=(-1);\n /*\n Read hex image data.\n */\n padding=0;\n if (((image->columns % 16) != 0) && ((image->columns % 16) < 9) &&\n (version == 10))\n padding=1;\n bytes_per_line=(unsigned int) (image->columns+7)/8+padding;\n length=(unsigned int) image->rows;\n data=(unsigned char *) AcquireQuantumMemory(length,bytes_per_line*\n sizeof(*data));\n if (data == (unsigned char *) NULL)\n ThrowReaderException(ResourceLimitError,\"MemoryAllocationFailed\");\n p=data;\n if (version == 10)\n for (i=0; i < (ssize_t) (bytes_per_line*image->rows); (i+=2))\n {\n c=XBMInteger(image,hex_digits);\n if (c < 0)\n break;\n *p++=(unsigned char) c;\n if ((padding == 0) || (((i+2) % bytes_per_line) != 0))\n *p++=(unsigned char) (c >> 8);\n }\n else\n for (i=0; i < (ssize_t) (bytes_per_line*image->rows); i++)\n {\n c=XBMInteger(image,hex_digits);\n if (c < 0)\n break;\n *p++=(unsigned char) c;\n }\n if (EOFBlob(image) != MagickFalse)\n {\n data=(unsigned char *) RelinquishMagickMemory(data);\n ThrowReaderException(CorruptImageError,\"UnexpectedEndOfFile\");\n }\n /*\n Convert X bitmap image to pixel packets.\n */\n p=data;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (Quantum *) NULL)\n break;\n bit=0;\n byte=0;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if (bit == 0)\n byte=(unsigned int) (*p++);\n SetPixelIndex(image,(Quantum) ((byte & 0x01) != 0 ? 0x01 : 0x00),q);\n bit++;\n byte>>=1;\n if (bit == 8)\n bit=0;\n q+=GetPixelChannels(image);\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n data=(unsigned char *) RelinquishMagickMemory(data);\n (void) SyncImage(image,exception);\n (void) CloseBlob(image);\n return(GetFirstImageInList(image));\n}", "label": 1, "label_name": "safe"} -{"code": " _resolvePath(path = '.') {\n const clientPath = (() => {\n path = nodePath.normalize(path);\n if (nodePath.isAbsolute(path)) {\n return nodePath.join(path);\n } else {\n return nodePath.join(this.cwd, path);\n }\n })();\n\n const fsPath = (() => {\n const resolvedPath = nodePath.join(this.root, clientPath);\n return nodePath.resolve(nodePath.normalize(nodePath.join(resolvedPath)));\n })();\n\n return {\n clientPath,\n fsPath\n };\n }", "label": 0, "label_name": "vulnerable"} -{"code": "void jas_matrix_asl(jas_matrix_t *matrix, int n)\n{\n\tjas_matind_t i;\n\tjas_matind_t j;\n\tjas_seqent_t *rowstart;\n\tjas_matind_t rowstep;\n\tjas_seqent_t *data;\n\n\tif (jas_matrix_numrows(matrix) > 0 && jas_matrix_numcols(matrix) > 0) {\n\t\tassert(matrix->rows_);\n\t\trowstep = jas_matrix_rowstep(matrix);\n\t\tfor (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,\n\t\t rowstart += rowstep) {\n\t\t\tfor (j = matrix->numcols_, data = rowstart; j > 0; --j,\n\t\t\t ++data) {\n\t\t\t\t//*data <<= n;\n\t\t\t\t*data = jas_seqent_asl(*data, n);\n\t\t\t}\n\t\t}\n\t}\n}", "label": 1, "label_name": "safe"} -{"code": " it 'should have loopback (lo)' do\n expect(subject.call(['lo'])).to be_truthy\n end", "label": 0, "label_name": "vulnerable"} -{"code": "static int ax25_create(struct net *net, struct socket *sock, int protocol,\n\t\t int kern)\n{\n\tstruct sock *sk;\n\tax25_cb *ax25;\n\n\tif (protocol < 0 || protocol > SK_PROTOCOL_MAX)\n\t\treturn -EINVAL;\n\n\tif (!net_eq(net, &init_net))\n\t\treturn -EAFNOSUPPORT;\n\n\tswitch (sock->type) {\n\tcase SOCK_DGRAM:\n\t\tif (protocol == 0 || protocol == PF_AX25)\n\t\t\tprotocol = AX25_P_TEXT;\n\t\tbreak;\n\n\tcase SOCK_SEQPACKET:\n\t\tswitch (protocol) {\n\t\tcase 0:\n\t\tcase PF_AX25:\t/* For CLX */\n\t\t\tprotocol = AX25_P_TEXT;\n\t\t\tbreak;\n\t\tcase AX25_P_SEGMENT:\n#ifdef CONFIG_INET\n\t\tcase AX25_P_ARP:\n\t\tcase AX25_P_IP:\n#endif\n#ifdef CONFIG_NETROM\n\t\tcase AX25_P_NETROM:\n#endif\n#ifdef CONFIG_ROSE\n\t\tcase AX25_P_ROSE:\n#endif\n\t\t\treturn -ESOCKTNOSUPPORT;\n#ifdef CONFIG_NETROM_MODULE\n\t\tcase AX25_P_NETROM:\n\t\t\tif (ax25_protocol_is_registered(AX25_P_NETROM))\n\t\t\t\treturn -ESOCKTNOSUPPORT;\n\t\t\tbreak;\n#endif\n#ifdef CONFIG_ROSE_MODULE\n\t\tcase AX25_P_ROSE:\n\t\t\tif (ax25_protocol_is_registered(AX25_P_ROSE))\n\t\t\t\treturn -ESOCKTNOSUPPORT;\n#endif\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t\tbreak;\n\n\tcase SOCK_RAW:\n\t\tbreak;\n\tdefault:\n\t\treturn -ESOCKTNOSUPPORT;\n\t}\n\n\tsk = sk_alloc(net, PF_AX25, GFP_ATOMIC, &ax25_proto, kern);\n\tif (sk == NULL)\n\t\treturn -ENOMEM;\n\n\tax25 = ax25_sk(sk)->cb = ax25_create_cb();\n\tif (!ax25) {\n\t\tsk_free(sk);\n\t\treturn -ENOMEM;\n\t}\n\n\tsock_init_data(sock, sk);\n\n\tsk->sk_destruct = ax25_free_sock;\n\tsock->ops = &ax25_proto_ops;\n\tsk->sk_protocol = protocol;\n\n\tax25->sk = sk;\n\n\treturn 0;\n}", "label": 1, "label_name": "safe"} -{"code": "void RemoteFsDevice::mount()\n{\n if (details.isLocalFile()) {\n return;\n }\n if (isConnected() || proc) {\n return;\n }\n\n if (messageSent) {\n return;\n }\n if (constSambaAvahiProtocol==details.url.scheme()) {\n Details det=details;\n AvahiService *srv=Avahi::self()->getService(det.serviceName);\n if (!srv || srv->getHost().isEmpty() || 0==srv->getPort()) {\n emit error(tr(\"Failed to resolve connection details for %1\").arg(details.name));\n return;\n }\n if (constPromptPassword==det.url.password()) {\n bool ok=false;\n QString passwd=InputDialog::getPassword(QString(), &ok, QApplication::activeWindow());\n if (!ok) {\n return;\n }\n det.url.setPassword(passwd);\n }\n det.url.setScheme(constSambaProtocol);\n det.url.setHost(srv->getHost());\n det.url.setPort(srv->getPort());\n mounter()->mount(det.url.toString(), mountPoint(details, true), getuid(), getgid(), getpid());\n setStatusMessage(tr(\"Connecting...\"));\n messageSent=true;\n return;\n }\n if (constSambaProtocol==details.url.scheme()) {\n Details det=details;\n if (constPromptPassword==det.url.password()) {\n bool ok=false;\n QString passwd=InputDialog::getPassword(QString(), &ok, QApplication::activeWindow());\n if (!ok) {\n return;\n }\n det.url.setPassword(passwd);\n }\n mounter()->mount(det.url.toString(), mountPoint(details, true), getuid(), getgid(), getpid());\n setStatusMessage(tr(\"Connecting...\"));\n messageSent=true;\n return;\n }\n\n QString cmd;\n QStringList args;\n QString askPass;\n if (!details.isLocalFile() && !details.isEmpty()) {\n // If user has added 'IdentityFile' to extra options, then no password prompting is required...\n bool needAskPass=!details.extraOptions.contains(\"IdentityFile=\");\n\n if (needAskPass) {\n QStringList askPassList;\n if (Utils::KDE==Utils::currentDe()) {\n askPassList << QLatin1String(\"ksshaskpass\") << QLatin1String(\"ssh-askpass\") << QLatin1String(\"ssh-askpass-gnome\");\n } else {\n askPassList << QLatin1String(\"ssh-askpass-gnome\") << QLatin1String(\"ssh-askpass\") << QLatin1String(\"ksshaskpass\");\n }\n\n for (const QString &ap: askPassList) {\n askPass=Utils::findExe(ap);\n if (!askPass.isEmpty()) {\n break;\n }\n }\n\n if (askPass.isEmpty()) {\n emit error(tr(\"No suitable ssh-askpass application installed! This is required for entering passwords.\"));\n return;\n }\n }\n QString sshfs=Utils::findExe(\"sshfs\");\n if (sshfs.isEmpty()) {\n emit error(tr(\"\\\"sshfs\\\" is not installed!\"));\n return;\n }\n cmd=Utils::findExe(\"setsid\");\n if (!cmd.isEmpty()) {\n QString mp=mountPoint(details, true);\n if (mp.isEmpty()) {\n emit error(\"Failed to determine mount point\"); // TODO: 2.4 make translatable. For now, error should never happen!\n }\n if (!QDir(mp).entryList(QDir::NoDot|QDir::NoDotDot|QDir::AllEntries|QDir::Hidden).isEmpty()) {\n emit error(tr(\"Mount point (\\\"%1\\\") is not empty!\").arg(mp));\n return;\n }\n\n args << sshfs << details.url.userName()+QChar('@')+details.url.host()+QChar(':')+details.url.path()<< QLatin1String(\"-p\")\n << QString::number(details.url.port()) << mountPoint(details, true)\n << QLatin1String(\"-o\") << QLatin1String(\"ServerAliveInterval=15\");\n //<< QLatin1String(\"-o\") << QLatin1String(\"Ciphers=arcfour\");\n if (!details.extraOptions.isEmpty()) {\n args << details.extraOptions.split(' ', QString::SkipEmptyParts);\n }\n } else {\n emit error(tr(\"\\\"sshfs\\\" is not installed!\").replace(\"sshfs\", \"setsid\")); // TODO: 2.4 use correct string!\n }\n }\n\n if (!cmd.isEmpty()) {\n setStatusMessage(tr(\"Connecting...\"));\n proc=new QProcess(this);\n proc->setProperty(\"mount\", true);\n\n if (!askPass.isEmpty()) {\n QProcessEnvironment env = QProcessEnvironment::systemEnvironment();\n env.insert(\"SSH_ASKPASS\", askPass);\n proc->setProcessEnvironment(env);\n }\n connect(proc, SIGNAL(finished(int)), SLOT(procFinished(int)));\n proc->start(cmd, args, QIODevice::ReadOnly);\n }\n}", "label": 0, "label_name": "vulnerable"} -{"code": "static inline size_t GetPSDRowSize(Image *image)\n{\n if (image->depth == 1)\n return((image->columns+7)/8);\n else\n return(image->columns*GetPSDPacketSize(image));\n}", "label": 0, "label_name": "vulnerable"} -{"code": "P)this.editPlantUmlData(D,G,P);else if(P=this.graph.getAttributeForCell(D,\"mermaidData\"),null!=P)this.editMermaidData(D,G,P);else{var K=g.getCellStyle(D);\"1\"==mxUtils.getValue(K,\"metaEdit\",\"0\")?d.showDataDialog(D):k.apply(this,arguments)}}catch(F){d.handleError(F)}};g.getLinkTitle=function(D){return d.getLinkTitle(D)};g.customLinkClicked=function(D){var G=!1;try{d.handleCustomLink(D),G=!0}catch(P){d.handleError(P)}return G};var l=g.parseBackgroundImage;g.parseBackgroundImage=function(D){var G=l.apply(this,", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic void testSelectByOperationsNotSpecifiedOrSign() {\n\n\t\tJWKSelector selector = new JWKSelector(new JWKMatcher.Builder().keyOperations(KeyOperation.SIGN, null).build());\n\n\t\tList keyList = new ArrayList<>();\n\t\tkeyList.add(new RSAKey.Builder(new Base64URL(\"n\"), new Base64URL(\"e\")).keyID(\"1\")\n\t\t\t.keyOperations(new HashSet<>(Collections.singletonList(KeyOperation.SIGN))).build());\n\t\tkeyList.add(new ECKey.Builder(ECKey.Curve.P_256, EC_P256_X, EC_P256_Y).keyID(\"2\").build());\n\t\tkeyList.add(new ECKey.Builder(ECKey.Curve.P_256, EC_P256_X, EC_P256_Y).keyID(\"3\")\n\t\t\t.keyOperations(new HashSet<>(Collections.singletonList(KeyOperation.ENCRYPT))).build());\n\n\t\tJWKSet jwkSet = new JWKSet(keyList);\n\n\t\tList matches = selector.select(jwkSet);\n\n\t\tRSAKey key1 = (RSAKey)matches.get(0);\n\t\tassertEquals(KeyType.RSA, key1.getKeyType());\n\t\tassertEquals(\"1\", key1.getKeyID());\n\n\t\tECKey key2 = (ECKey)matches.get(1);\n\t\tassertEquals(KeyType.EC, key2.getKeyType());\n\t\tassertEquals(\"2\", key2.getKeyID());\n\n\t\tassertEquals(2, matches.size());\n\t}", "label": 1, "label_name": "safe"} -{"code": "void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new)\n{\n unsigned char *data = NULL;\n int size;\n loff_t offs;\n\n if (new == -1)\n\tnew = FAT_EOF(fs);\n else if ((long)new == -2)\n\tnew = FAT_BAD(fs);\n switch (fs->fat_bits) {\n case 12:\n\tdata = fs->fat + cluster * 3 / 2;\n\toffs = fs->fat_start + cluster * 3 / 2;\n\tif (cluster & 1) {\n\t FAT_ENTRY prevEntry;\n\t get_fat(&prevEntry, fs->fat, cluster - 1, fs);\n\t data[0] = ((new & 0xf) << 4) | (prevEntry.value >> 8);\n\t data[1] = new >> 4;\n\t} else {\n\t FAT_ENTRY subseqEntry;\n\t if (cluster != fs->clusters + 1)\n\t\tget_fat(&subseqEntry, fs->fat, cluster + 1, fs);\n\t else\n\t\tsubseqEntry.value = 0;\n\t data[0] = new & 0xff;\n\t data[1] = (new >> 8) | ((0xff & subseqEntry.value) << 4);\n\t}\n\tsize = 2;\n\tbreak;\n case 16:\n\tdata = fs->fat + cluster * 2;\n\toffs = fs->fat_start + cluster * 2;\n\t*(unsigned short *)data = htole16(new);\n\tsize = 2;\n\tbreak;\n case 32:\n\t{\n\t FAT_ENTRY curEntry;\n\t get_fat(&curEntry, fs->fat, cluster, fs);\n\n\t data = fs->fat + cluster * 4;\n\t offs = fs->fat_start + cluster * 4;\n\t /* According to M$, the high 4 bits of a FAT32 entry are reserved and\n\t * are not part of the cluster number. So we never touch them. */\n\t *(uint32_t *)data = htole32((new & 0xfffffff) |\n\t\t\t\t\t (curEntry.reserved << 28));\n\t size = 4;\n\t}\n\tbreak;\n default:\n\tdie(\"Bad FAT entry size: %d bits.\", fs->fat_bits);\n }\n fs_write(offs, size, data);\n if (fs->nfats > 1) {\n\tfs_write(offs + fs->fat_size, size, data);\n }\n}", "label": 1, "label_name": "safe"} -{"code": "static boolean ReadIPTCProfile(j_decompress_ptr jpeg_info)\n{\n char\n magick[MagickPathExtent];\n\n ErrorManager\n *error_manager;\n\n ExceptionInfo\n *exception;\n\n Image\n *image;\n\n MagickBooleanType\n status;\n\n register ssize_t\n i;\n\n register unsigned char\n *p;\n\n size_t\n length;\n\n StringInfo\n *iptc_profile,\n *profile;\n\n /*\n Determine length of binary data stored here.\n */\n length=(size_t) ((size_t) GetCharacter(jpeg_info) << 8);\n length+=(size_t) GetCharacter(jpeg_info);\n length-=2;\n if (length <= 14)\n {\n while (length-- > 0)\n if (GetCharacter(jpeg_info) == EOF)\n break;\n return(TRUE);\n }\n /*\n Validate that this was written as a Photoshop resource format slug.\n */\n for (i=0; i < 10; i++)\n magick[i]=(char) GetCharacter(jpeg_info);\n magick[10]='\\0';\n length-=10;\n if (length <= 10)\n return(TRUE);\n if (LocaleCompare(magick,\"Photoshop \") != 0)\n {\n /*\n Not a IPTC profile, return.\n */\n for (i=0; i < (ssize_t) length; i++)\n if (GetCharacter(jpeg_info) == EOF)\n break;\n return(TRUE);\n }\n /*\n Remove the version number.\n */\n for (i=0; i < 4; i++)\n if (GetCharacter(jpeg_info) == EOF)\n break;\n if (length <= 11)\n return(TRUE);\n length-=4;\n error_manager=(ErrorManager *) jpeg_info->client_data;\n exception=error_manager->exception;\n image=error_manager->image;\n profile=BlobToStringInfo((const void *) NULL,length);\n if (profile == (StringInfo *) NULL)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(FALSE);\n }\n error_manager->profile=profile;\n p=GetStringInfoDatum(profile);\n for (i=0; i < (ssize_t) length; i++)\n {\n int\n c;\n\n c=GetCharacter(jpeg_info);\n if (c == EOF)\n break;\n *p++=(unsigned char) c;\n }\n error_manager->profile=NULL;\n if (i != (ssize_t) length)\n {\n profile=DestroyStringInfo(profile);\n (void) ThrowMagickException(exception,GetMagickModule(),\n CorruptImageError,\"InsufficientImageDataInFile\",\"`%s'\",\n image->filename);\n return(FALSE);\n }\n /*\n The IPTC profile is actually an 8bim.\n */\n iptc_profile=(StringInfo *) GetImageProfile(image,\"8bim\");\n if (iptc_profile != (StringInfo *) NULL)\n {\n ConcatenateStringInfo(iptc_profile,profile);\n profile=DestroyStringInfo(profile);\n }\n else\n {\n status=SetImageProfile(image,\"8bim\",profile,exception);\n profile=DestroyStringInfo(profile);\n if (status == MagickFalse)\n {\n (void) ThrowMagickException(exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",image->filename);\n return(FALSE);\n }\n }\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(CoderEvent,GetMagickModule(),\n \"Profile: iptc, %.20g bytes\",(double) length);\n return(TRUE);\n}", "label": 1, "label_name": "safe"} -{"code": " public function testDefaultLocaleWithoutSession()\n {\n $listener = new LocaleListener($this->requestStack, 'fr');\n $event = $this->getEvent($request = Request::create('/'));\n\n $listener->onKernelRequest($event);\n $this->assertEquals('fr', $request->getLocale());\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function destroy($name) {\n if (!isset($this->_storage[$name])) {\n trigger_error(\"Attempted to destroy non-existent variable $name\",\n E_USER_ERROR);\n return;\n }\n unset($this->_storage[$name]);\n }", "label": 1, "label_name": "safe"} -{"code": " function get_plural_forms() {\n // lets assume message number 0 is header\n // this is true, right?\n $this->load_tables();\n\n // cache header field for plural forms\n if (! is_string($this->pluralheader)) {\n if ($this->enable_cache) {\n $header = $this->cache_translations[\"\"];\n } else {\n $header = $this->get_translation_string(0);\n }\n $expr = $this->extract_plural_forms_header_from_po_header($header);\n $this->pluralheader = $this->sanitize_plural_expression($expr);\n }\n return $this->pluralheader;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "function(u,E,J,T){for(var N=0;N htmlentities(self::$search_type),\n 'stext' => htmlentities(self::$search_text),\n 'method' => htmlentities(self::$search_method),\n 'datelimit' => self::$search_date_limit,\n 'fields' => self::$search_fields,\n 'sort' => self::$search_sort,\n 'chars' => htmlentities(self::$search_chars),\n 'order' => self::$search_order,\n 'forum_id' => self::$forum_id,\n 'memory_limit' => self::$memory_limit,\n 'composevars' => self::$composevars,\n 'rowstart' => self::$rowstart,\n 'search_param' => htmlentities(self::$search_param),\n ];\n\n return $key === NULL ? $info : (isset($info[$key]) ? $info[$key] : NULL);\n }", "label": 1, "label_name": "safe"} -{"code": "(ma.style.backgroundImage=\"url(\"+ja+\")\",ma.style.backgroundPosition=\"center center\",ma.style.backgroundRepeat=\"no-repeat\",ma.style.backgroundSize=\"24px 24px\",ma.style.width=\"34px\",ma.innerHTML=\"\"):ba||(ma.style.backgroundImage=\"url(\"+mxWindow.prototype.normalizeImage+\")\",ma.style.backgroundPosition=\"right 6px center\",ma.style.backgroundRepeat=\"no-repeat\",ma.style.paddingRight=\"22px\");return ma}function F(ca,ba,ja,ia,ma,qa){var oa=document.createElement(\"a\");oa.className=\"1\"==urlParams.sketch?\"geToolbarButton\":\n\"geMenuItem\";oa.style.display=\"inline-block\";oa.style.boxSizing=\"border-box\";oa.style.height=\"30px\";oa.style.padding=\"6px\";oa.style.position=\"relative\";oa.style.verticalAlign=\"top\";oa.style.top=\"0px\";\"1\"==urlParams.sketch&&(oa.style.borderStyle=\"none\",oa.style.boxShadow=\"none\",oa.style.padding=\"6px\",oa.style.margin=\"0px\");null!=E.statusContainer?S.insertBefore(oa,E.statusContainer):S.appendChild(oa);null!=qa?(oa.style.backgroundImage=\"url(\"+qa+\")\",oa.style.backgroundPosition=\"center center\",oa.style.backgroundRepeat=\n\"no-repeat\",oa.style.backgroundSize=\"24px 24px\",oa.style.width=\"34px\"):mxUtils.write(oa,ca);mxEvent.addListener(oa,mxClient.IS_POINTER?\"pointerdown\":\"mousedown\",mxUtils.bind(this,function(na){na.preventDefault()}));mxEvent.addListener(oa,\"click\",function(na){\"disabled\"!=oa.getAttribute(\"disabled\")&&ba(na);mxEvent.consume(na)});null==ja&&(oa.style.marginRight=\"4px\");null!=ia&&oa.setAttribute(\"title\",ia);null!=ma&&(ca=function(){ma.isEnabled()?(oa.removeAttribute(\"disabled\"),oa.style.cursor=\"pointer\"):\n(oa.setAttribute(\"disabled\",\"disabled\"),oa.style.cursor=\"default\")},ma.addListener(\"stateChanged\",ca),H.addListener(\"enabledChanged\",ca),ca());return oa}function G(ca,ba,ja){ja=document.createElement(\"div\");ja.className=\"geMenuItem\";ja.style.display=\"inline-block\";ja.style.verticalAlign=\"top\";ja.style.marginRight=\"6px\";ja.style.padding=\"0 4px 0 4px\";ja.style.height=\"30px\";ja.style.position=\"relative\";ja.style.top=\"0px\";\"1\"==urlParams.sketch&&(ja.style.boxShadow=\"none\");for(var ia=0;ia=k.scrollHeight-k.offsetHeight&&C()},mxEvent.addListener(k,\"scroll\",B))}),y)});t()};GitHubClient.prototype.logout=function(){this.clearPersistentToken();this.setUser(null);b=null}})();TrelloFile=function(b,e,f){DrawioFile.call(this,b,e);this.meta=f;this.saveNeededCounter=0};mxUtils.extend(TrelloFile,DrawioFile);TrelloFile.prototype.getHash=function(){return\"T\"+encodeURIComponent(this.meta.compoundId)};TrelloFile.prototype.getMode=function(){return App.MODE_TRELLO};TrelloFile.prototype.isAutosave=function(){return!0};TrelloFile.prototype.getTitle=function(){return this.meta.name};TrelloFile.prototype.isRenamable=function(){return!1};TrelloFile.prototype.getSize=function(){return this.meta.bytes};", "label": 0, "label_name": "vulnerable"} -{"code": "static int rfcomm_get_dev_list(void __user *arg)\n{\n\tstruct rfcomm_dev *dev;\n\tstruct rfcomm_dev_list_req *dl;\n\tstruct rfcomm_dev_info *di;\n\tint n = 0, size, err;\n\tu16 dev_num;\n\n\tBT_DBG(\"\");\n\n\tif (get_user(dev_num, (u16 __user *) arg))\n\t\treturn -EFAULT;\n\n\tif (!dev_num || dev_num > (PAGE_SIZE * 4) / sizeof(*di))\n\t\treturn -EINVAL;\n\n\tsize = sizeof(*dl) + dev_num * sizeof(*di);\n\n\tdl = kzalloc(size, GFP_KERNEL);\n\tif (!dl)\n\t\treturn -ENOMEM;\n\n\tdi = dl->dev_info;\n\n\tspin_lock(&rfcomm_dev_lock);\n\n\tlist_for_each_entry(dev, &rfcomm_dev_list, list) {\n\t\tif (test_bit(RFCOMM_TTY_RELEASED, &dev->flags))\n\t\t\tcontinue;\n\t\t(di + n)->id = dev->id;\n\t\t(di + n)->flags = dev->flags;\n\t\t(di + n)->state = dev->dlc->state;\n\t\t(di + n)->channel = dev->channel;\n\t\tbacpy(&(di + n)->src, &dev->src);\n\t\tbacpy(&(di + n)->dst, &dev->dst);\n\t\tif (++n >= dev_num)\n\t\t\tbreak;\n\t}\n\n\tspin_unlock(&rfcomm_dev_lock);\n\n\tdl->dev_num = n;\n\tsize = sizeof(*dl) + n * sizeof(*di);\n\n\terr = copy_to_user(arg, dl, size);\n\tkfree(dl);\n\n\treturn err ? -EFAULT : 0;\n}", "label": 1, "label_name": "safe"} -{"code": "(function(){var r=function(c,j){function r(){var a=arguments,b=this.getContentElement(\"advanced\",\"txtdlgGenStyle\");b&&b.commit.apply(b,a);this.foreach(function(b){b.commit&&\"txtdlgGenStyle\"!=b.id&&b.commit.apply(b,a)})}function i(a){if(!s){s=1;var b=this.getDialog(),d=b.imageElement;if(d){this.commit(f,d);for(var a=[].concat(a),e=a.length,c,g=0;g_url/?database=$db\", false, stream_context_create(array('http' => array(\n\t\t\t\t'method' => 'POST',\n\t\t\t\t'content' => $this->isQuerySelectLike($query) ? \"$query FORMAT JSONCompact\" : $query,\n\t\t\t\t'header' => 'Content-type: application/x-www-form-urlencoded',\n\t\t\t\t'ignore_errors' => 1, // available since PHP 5.2.10\n\t\t\t))));\n\n\t\t\tif ($file === false) {\n\t\t\t\t$this->error = $php_errormsg;\n\t\t\t\treturn $file;\n\t\t\t}\n\t\t\tif (!preg_match('~^HTTP/[0-9.]+ 2~i', $http_response_header[0])) {\n\t\t\t\t$this->error = $file;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$return = json_decode($file, true);\n\t\t\tif ($return === null) {\n\t\t\t\tif (!$this->isQuerySelectLike($query) && $file === '') {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t$this->errno = json_last_error();\n\t\t\t\tif (function_exists('json_last_error_msg')) {\n\t\t\t\t\t$this->error = json_last_error_msg();\n\t\t\t\t} else {\n\t\t\t\t\t$constants = get_defined_constants(true);\n\t\t\t\t\tforeach ($constants['json'] as $name => $value) {\n\t\t\t\t\t\tif ($value == $this->errno && preg_match('~^JSON_ERROR_~', $name)) {\n\t\t\t\t\t\t\t$this->error = $name;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn new Min_Result($return);\n\t\t}", "label": 0, "label_name": "vulnerable"} -{"code": " public static function getIconName($module)\n {\n return static::$iconNames[$module] ?? strtolower(str_replace('_', '-', $module));\n }", "label": 1, "label_name": "safe"} -{"code": " function drawError(ctx,err,x,y,upper,lower,drawUpper,drawLower,radius,offset,minmax){\n\n //shadow offset\n y += offset;\n upper += offset;\n lower += offset;\n\n // error bar - avoid plotting over circles\n if (err.err == 'x'){\n if (upper > x + radius) drawPath(ctx, [[upper,y],[Math.max(x + radius,minmax[0]),y]]);\n else drawUpper = false;\n if (lower < x - radius) drawPath(ctx, [[Math.min(x - radius,minmax[1]),y],[lower,y]] );\n else drawLower = false;\n }\n else {\n if (upper < y - radius) drawPath(ctx, [[x,upper],[x,Math.min(y - radius,minmax[0])]] );\n else drawUpper = false;\n if (lower > y + radius) drawPath(ctx, [[x,Math.max(y + radius,minmax[1])],[x,lower]] );\n else drawLower = false;\n }\n\n //internal radius value in errorbar, allows to plot radius 0 points and still keep proper sized caps\n //this is a way to get errorbars on lines without visible connecting dots\n radius = err.radius != null? err.radius: radius;\n\n // upper cap\n if (drawUpper) {\n if (err.upperCap == '-'){\n if (err.err=='x') drawPath(ctx, [[upper,y - radius],[upper,y + radius]] );\n else drawPath(ctx, [[x - radius,upper],[x + radius,upper]] );\n } else if ($.isFunction(err.upperCap)){\n if (err.err=='x') err.upperCap(ctx, upper, y, radius);\n else err.upperCap(ctx, x, upper, radius);\n }\n }\n // lower cap\n if (drawLower) {\n if (err.lowerCap == '-'){\n if (err.err=='x') drawPath(ctx, [[lower,y - radius],[lower,y + radius]] );\n else drawPath(ctx, [[x - radius,lower],[x + radius,lower]] );\n } else if ($.isFunction(err.lowerCap)){\n if (err.err=='x') err.lowerCap(ctx, lower, y, radius);\n else err.lowerCap(ctx, x, lower, radius);\n }\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": "int64_t OpLevelCostEstimator::CalculateTensorSize(\n const OpInfo::TensorProperties& tensor, bool* found_unknown_shapes) {\n int64_t count = CalculateTensorElementCount(tensor, found_unknown_shapes);\n int size = DataTypeSize(BaseType(tensor.dtype()));\n VLOG(2) << \"Count: \" << count << \" DataTypeSize: \" << size;\n int64_t tensor_size = MultiplyWithoutOverflow(count, size);\n if (tensor_size < 0) {\n VLOG(1) << \"Overflow encountered when computing tensor size, multiplying \"\n << count << \" with \" << size;\n return -1;\n }\n return tensor_size;\n}", "label": 1, "label_name": "safe"} -{"code": " it \"removes the stored credentials\" do\n cluster.logout :admin\n cluster.auth.should be_empty\n end", "label": 0, "label_name": "vulnerable"} -{"code": " public function testHandleWhenAListenerReturnsAResponse()\n {\n $dispatcher = new EventDispatcher();\n $dispatcher->addListener(KernelEvents::REQUEST, function ($event) {\n $event->setResponse(new Response('hello'));\n });\n\n $kernel = new HttpKernel($dispatcher, $this->getResolver());\n\n $this->assertEquals('hello', $kernel->handle(new Request())->getContent());\n }", "label": 0, "label_name": "vulnerable"} -{"code": "return this.collapsed||a.type!=CKEDITOR.NODE_ELEMENT?a:a.getChild(this.endOffset-1)||a},getNextEditableNode:b(),getPreviousEditableNode:b(1),scrollIntoView:function(){var a=new CKEDITOR.dom.element.createFromHtml(\" \",this.document),b,c,d,f=this.clone();f.optimize();if(d=f.startContainer.type==CKEDITOR.NODE_TEXT){c=f.startContainer.getText();b=f.startContainer.split(f.startOffset);a.insertAfter(f.startContainer)}else f.insertNode(a);a.scrollIntoView();if(d){f.startContainer.setText(c);\nb.remove()}a.remove()}}})();CKEDITOR.POSITION_AFTER_START=1;CKEDITOR.POSITION_BEFORE_END=2;CKEDITOR.POSITION_BEFORE_START=3;CKEDITOR.POSITION_AFTER_END=4;CKEDITOR.ENLARGE_ELEMENT=1;CKEDITOR.ENLARGE_BLOCK_CONTENTS=2;CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS=3;CKEDITOR.ENLARGE_INLINE=4;CKEDITOR.START=1;CKEDITOR.END=2;CKEDITOR.SHRINK_ELEMENT=1;CKEDITOR.SHRINK_TEXT=2;\"use strict\";", "label": 1, "label_name": "safe"} -{"code": " protected function getAuthorizationHeaders($token = null)\n {\n return ['Authorization' => 'Bearer ' . $token];\n }", "label": 0, "label_name": "vulnerable"} -{"code": " private static List GetMonitors()\r\n {\r\n List monitors = new List();\r\n\r\n EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero,\r\n (IntPtr hMonitor, IntPtr hdcMonitor, ref RECT lprcMonitor, IntPtr dwData) =>\r\n {\r\n MONITORINFOEX monitorInfo = new MONITORINFOEX();\r\n monitorInfo.cbSize = Marshal.SizeOf(typeof(MONITORINFOEX));\r\n\r\n GetMonitorInfo(hMonitor, ref monitorInfo);\r\n\r\n monitors.Add(new Monitor()\r\n {\r\n Primary = (monitorInfo.dwFlags & MONITORINFOF_PRIMARY) != 0,\r\n DeviceName = monitorInfo.szDevice,\r\n Rect = Rectangle.FromLTRB(monitorInfo.rcMonitor.Left,\r\n monitorInfo.rcMonitor.Top,\r\n monitorInfo.rcMonitor.Right,\r\n monitorInfo.rcMonitor.Bottom),\r\n WorkRect = Rectangle.FromLTRB(monitorInfo.rcWork.Left,\r\n monitorInfo.rcWork.Top,\r\n monitorInfo.rcWork.Right,\r\n monitorInfo.rcWork.Bottom)\r\n });\r\n\r\n return true;\r\n },\r\n IntPtr.Zero\r\n );\r\n\r\n return monitors;\r\n }\r", "label": 1, "label_name": "safe"} -{"code": "\"startWidth\",this.defaultArrowWidth)};Ca.prototype.getEndArrowWidth=function(){return this.getEdgeWidth()+mxUtils.getNumber(this.style,\"endWidth\",this.defaultArrowWidth)};Ca.prototype.getEdgeWidth=function(){return mxUtils.getNumber(this.style,\"width\",this.defaultWidth)+Math.max(0,this.strokewidth-1)};mxCellRenderer.registerShape(\"flexArrow\",Ca);mxUtils.extend(Qa,mxActor);Qa.prototype.size=30;Qa.prototype.isRoundable=function(){return!0};Qa.prototype.redrawPath=function(c,l,x,p,v){l=Math.min(v,parseFloat(mxUtils.getValue(this.style,", "label": 1, "label_name": "safe"} -{"code": " def check_owner\n return if params[:id].nil? or params[:id].empty? or @login_user.nil?\n\n begin\n owner_id = Workflow.find(params[:id]).user_id\n rescue\n owner_id = -1\n end\n if !@login_user.admin?(User::AUTH_WORKFLOW) and owner_id != @login_user.id\n Log.add_check(request, '[check_owner]'+request.to_s)\n\n flash[:notice] = t('msg.need_to_be_owner')\n redirect_to(:controller => 'desktop', :action => 'show')\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": " this._transport.on(\"chunk\", (messageChunk: Buffer) => {\r\n /**\r\n * notify the observers that ClientSecureChannelLayer has received a message chunk\r\n * @event receive_chunk\r\n * @param message_chunk\r\n */\r\n this.emit(\"receive_chunk\", messageChunk);\r\n this._on_receive_message_chunk(messageChunk);\r\n });\r", "label": 1, "label_name": "safe"} -{"code": " public function theme_switch() {\n if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file\n flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.'));\n }\n \texpSettings::change('DISPLAY_THEME_REAL', $this->params['theme']);\n\t expSession::set('display_theme',$this->params['theme']);\n\t $sv = isset($this->params['sv'])?$this->params['sv']:'';\n\t if (strtolower($sv)=='default') {\n\t $sv = '';\n\t }\n\t expSettings::change('THEME_STYLE_REAL',$sv);\n\t expSession::set('theme_style',$sv);\n\t expDatabase::install_dbtables(); // update tables to include any custom definitions in the new theme\n\n // $message = (MINIFY != 1) ? \"Exponent is now minifying Javascript and CSS\" : \"Exponent is no longer minifying Javascript and CSS\" ;\n // flash('message',$message);\n\t $message = gt(\"You have selected the\").\" '\".$this->params['theme'].\"' \".gt(\"theme\");\n\t if ($sv != '') {\n\t\t $message .= ' '.gt('with').' '.$this->params['sv'].' '.gt('style variation');\n\t }\n\t flash('message',$message);\n// expSession::un_set('framework');\n expSession::set('force_less_compile', 1);\n// expTheme::removeSmartyCache();\n expSession::clearAllUsersSessionCache();\n \texpHistory::returnTo('manageable');\n }\t", "label": 0, "label_name": "vulnerable"} -{"code": " public void translate(ServerVehicleMovePacket packet, GeyserSession session) {\n Entity entity = session.getRidingVehicleEntity();\n if (entity == null) return;\n\n entity.moveAbsolute(session, Vector3f.from(packet.getX(), packet.getY(), packet.getZ()), packet.getYaw(), packet.getPitch(), false, true);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\texpand: function( id ) {\n\t\tvar self = this;\n\n\t\t// Set the current theme model\n\t\tthis.model = self.collection.get( id );\n\n\t\t// Trigger a route update for the current model\n\t\tthemes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.id ) );\n\n\t\t// Sets this.view to 'detail'\n\t\tthis.setView( 'detail' );\n\t\t$( 'body' ).addClass( 'modal-open' );\n\n\t\t// Set up the theme details view\n\t\tthis.overlay = new themes.view.Details({\n\t\t\tmodel: self.model\n\t\t});\n\n\t\tthis.overlay.render();\n\t\tthis.$overlay.html( this.overlay.el );\n\n\t\t// Bind to theme:next and theme:previous\n\t\t// triggered by the arrow keys\n\t\t//\n\t\t// Keep track of the current model so we\n\t\t// can infer an index position\n\t\tthis.listenTo( this.overlay, 'theme:next', function() {\n\t\t\t// Renders the next theme on the overlay\n\t\t\tself.next( [ self.model.cid ] );\n\n\t\t})\n\t\t.listenTo( this.overlay, 'theme:previous', function() {\n\t\t\t// Renders the previous theme on the overlay\n\t\t\tself.previous( [ self.model.cid ] );\n\t\t});\n\t},", "label": 0, "label_name": "vulnerable"} -{"code": "static s32 gf_avc_read_pps_bs_internal(GF_BitStream *bs, AVCState *avc, u32 nal_hdr)\n{\n\ts32 pps_id;\n\tAVC_PPS *pps;\n\n\tgf_bs_enable_emulation_byte_removal(bs, GF_TRUE);\n\n\tif (!nal_hdr) {\n\t\tgf_bs_read_int_log(bs, 1, \"forbidden_zero_bit\");\n\t\tgf_bs_read_int_log(bs, 2, \"nal_ref_idc\");\n\t\tgf_bs_read_int_log(bs, 5, \"nal_unit_type\");\n\t}\n\tpps_id = gf_bs_read_ue_log(bs, \"pps_id\");\n\tif (pps_id >= 255) {\n\t\treturn -1;\n\t}\n\tpps = &avc->pps[pps_id];\n\tpps->id = pps_id;\n\n\tif (!pps->status) pps->status = 1;\n\tpps->sps_id = gf_bs_read_ue_log(bs, \"sps_id\");\n\tif (pps->sps_id >= 32) {\n\t\tpps->sps_id = 0;\n\t\treturn -1;\n\t}\n\t/*sps_id may be refer to regular SPS or subseq sps, depending on the coded slice referring to the pps*/\n\tif (!avc->sps[pps->sps_id].state && !avc->sps[pps->sps_id + GF_SVC_SSPS_ID_SHIFT].state) {\n\t\treturn -1;\n\t}\n\tavc->pps_active_idx = pps->id; /*set active sps*/\n\tavc->sps_active_idx = pps->sps_id; /*set active sps*/\n\tpps->entropy_coding_mode_flag = gf_bs_read_int_log(bs, 1, \"entropy_coding_mode_flag\");\n\tpps->pic_order_present = gf_bs_read_int_log(bs, 1, \"pic_order_present\");\n\tpps->slice_group_count = gf_bs_read_ue_log(bs, \"slice_group_count_minus1\") + 1;\n\tif (pps->slice_group_count > 1) {\n\t\tu32 iGroup;\n\t\tpps->mb_slice_group_map_type = gf_bs_read_ue_log(bs, \"mb_slice_group_map_type\");\n\t\tif (pps->mb_slice_group_map_type == 0) {\n\t\t\tfor (iGroup = 0; iGroup <= pps->slice_group_count - 1; iGroup++)\n\t\t\t\tgf_bs_read_ue_log_idx(bs, \"run_length_minus1\", iGroup);\n\t\t}\n\t\telse if (pps->mb_slice_group_map_type == 2) {\n\t\t\tfor (iGroup = 0; iGroup < pps->slice_group_count - 1; iGroup++) {\n\t\t\t\tgf_bs_read_ue_log_idx(bs, \"top_left\", iGroup);\n\t\t\t\tgf_bs_read_ue_log_idx(bs, \"bottom_right\", iGroup);\n\t\t\t}\n\t\t}\n\t\telse if (pps->mb_slice_group_map_type == 3 || pps->mb_slice_group_map_type == 4 || pps->mb_slice_group_map_type == 5) {\n\t\t\tgf_bs_read_int_log(bs, 1, \"slice_group_change_direction_flag\");\n\t\t\tgf_bs_read_ue_log(bs, \"slice_group_change_rate_minus1\");\n\t\t}\n\t\telse if (pps->mb_slice_group_map_type == 6) {\n\t\t\tu32 i;\n\t\t\tpps->pic_size_in_map_units_minus1 = gf_bs_read_ue_log(bs, \"pic_size_in_map_units_minus1\");\n\t\t\tfor (i = 0; i <= pps->pic_size_in_map_units_minus1; i++) {\n\t\t\t\tgf_bs_read_int_log_idx(bs, (u32)ceil(log(pps->slice_group_count) / log(2)), \"slice_group_id\", i);\n\t\t\t}\n\t\t}\n\t}\n\tpps->num_ref_idx_l0_default_active_minus1 = gf_bs_read_ue_log(bs, \"num_ref_idx_l0_default_active_minus1\");\n\tpps->num_ref_idx_l1_default_active_minus1 = gf_bs_read_ue_log(bs, \"num_ref_idx_l1_default_active_minus1\");\n\n\t/*\n\tif ((pps->ref_count[0] > 32) || (pps->ref_count[1] > 32)) goto exit;\n\t*/\n\n\tpps->weighted_pred_flag = gf_bs_read_int_log(bs, 1, \"weighted_pred_flag\");\n\tgf_bs_read_int_log(bs, 2, \"weighted_bipred_idc\");\n\tgf_bs_read_se_log(bs, \"init_qp_minus26\");\n\tgf_bs_read_se_log(bs, \"init_qs_minus26\");\n\tgf_bs_read_se_log(bs, \"chroma_qp_index_offset\");\n\tpps->deblocking_filter_control_present_flag = gf_bs_read_int_log(bs, 1, \"deblocking_filter_control_present_flag\");\n\tgf_bs_read_int_log(bs, 1, \"constrained_intra_pred\");\n\tpps->redundant_pic_cnt_present = gf_bs_read_int_log(bs, 1, \"redundant_pic_cnt_present\");\n\n\treturn pps_id;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "void dhcpClientParseAck(DhcpClientContext *context,\n const DhcpMessage *message, size_t length)\n{\n uint_t i;\n uint_t j;\n uint_t n;\n DhcpOption *option;\n DhcpOption *serverIdOption;\n NetInterface *interface;\n NetInterface *logicalInterface;\n NetInterface *physicalInterface;\n\n //Point to the underlying network interface\n interface = context->settings.interface;\n //Point to the logical interface\n logicalInterface = nicGetLogicalInterface(interface);\n //Point to the physical interface\n physicalInterface = nicGetPhysicalInterface(interface);\n\n //Index of the IP address in the list of addresses assigned to the interface\n i = context->settings.ipAddrIndex;\n\n //Discard any received packet that does not match the transaction ID\n if(ntohl(message->xid) != context->transactionId)\n return;\n\n //Make sure the IP address assigned to the client is valid\n if(message->yiaddr == IPV4_UNSPECIFIED_ADDR)\n return;\n\n //Check MAC address\n if(!macCompAddr(&message->chaddr, &logicalInterface->macAddr))\n return;\n\n //A DHCP server always returns its own address in the Server Identifier option\n serverIdOption = dhcpGetOption(message, length, DHCP_OPT_SERVER_IDENTIFIER);\n\n //Failed to retrieve the Server Identifier option?\n if(serverIdOption == NULL || serverIdOption->length != 4)\n return;\n\n //Check current state\n if(context->state == DHCP_STATE_SELECTING)\n {\n //A DHCPACK message is not acceptable when rapid commit is disallowed\n if(!context->settings.rapidCommit)\n return;\n\n //Search for the Rapid Commit option\n option = dhcpGetOption(message, length, DHCP_OPT_RAPID_COMMIT);\n\n //A server must include this option in a DHCPACK message sent\n //in a response to a DHCPDISCOVER message when completing the\n //DHCPDISCOVER-DHCPACK message exchange\n if(option == NULL || option->length != 0)\n return;\n }\n else if(context->state == DHCP_STATE_REQUESTING ||\n context->state == DHCP_STATE_RENEWING)\n {\n //Check the server identifier\n if(!ipv4CompAddr(serverIdOption->value, &context->serverIpAddr))\n return;\n }\n else if(context->state == DHCP_STATE_REBOOTING ||\n context->state == DHCP_STATE_REBINDING)\n {\n //Do not check the server identifier\n }\n else\n {\n //Silently discard the DHCPACK message\n return;\n }\n\n //Retrieve IP Address Lease Time option\n option = dhcpGetOption(message, length, DHCP_OPT_IP_ADDRESS_LEASE_TIME);\n\n //Failed to retrieve specified option?\n if(option == NULL || option->length != 4)\n return;\n\n //Record the lease time\n context->leaseTime = LOAD32BE(option->value);\n\n //Retrieve Renewal Time Value option\n option = dhcpGetOption(message, length, DHCP_OPT_RENEWAL_TIME_VALUE);\n\n //Specified option found?\n if(option != NULL && option->length == 4)\n {\n //This option specifies the time interval from address assignment\n //until the client transitions to the RENEWING state\n context->t1 = LOAD32BE(option->value);\n }\n else if(context->leaseTime != DHCP_INFINITE_TIME)\n {\n //By default, T1 is set to 50% of the lease time\n context->t1 = context->leaseTime / 2;\n }\n else\n {\n //Infinite lease\n context->t1 = DHCP_INFINITE_TIME;\n }\n\n //Retrieve Rebinding Time value option\n option = dhcpGetOption(message, length, DHCP_OPT_REBINDING_TIME_VALUE);\n\n //Specified option found?\n if(option != NULL && option->length == 4)\n {\n //This option specifies the time interval from address assignment\n //until the client transitions to the REBINDING state\n context->t2 = LOAD32BE(option->value);\n }\n else if(context->leaseTime != DHCP_INFINITE_TIME)\n {\n //By default, T2 is set to 87.5% of the lease time\n context->t2 = context->leaseTime * 7 / 8;\n }\n else\n {\n //Infinite lease\n context->t2 = DHCP_INFINITE_TIME;\n }\n\n //Retrieve Subnet Mask option\n option = dhcpGetOption(message, length, DHCP_OPT_SUBNET_MASK);\n\n //The specified option has been found?\n if(option != NULL && option->length == sizeof(Ipv4Addr))\n {\n //Save subnet mask\n ipv4CopyAddr(&interface->ipv4Context.addrList[i].subnetMask,\n option->value);\n }\n\n //Retrieve Router option\n option = dhcpGetOption(message, length, DHCP_OPT_ROUTER);\n\n //The specified option has been found?\n if(option != NULL && !(option->length % sizeof(Ipv4Addr)))\n {\n //Save default gateway\n if(option->length >= sizeof(Ipv4Addr))\n {\n ipv4CopyAddr(&interface->ipv4Context.addrList[i].defaultGateway,\n option->value);\n }\n }\n\n //Use the DNS servers provided by the DHCP server?\n if(!context->settings.manualDnsConfig)\n {\n //Retrieve DNS Server option\n option = dhcpGetOption(message, length, DHCP_OPT_DNS_SERVER);\n\n //The specified option has been found?\n if(option != NULL && !(option->length % sizeof(Ipv4Addr)))\n {\n //Get the number of addresses provided in the response\n n = option->length / sizeof(Ipv4Addr);\n\n //Loop through the list of addresses\n for(j = 0; j < n && j < IPV4_DNS_SERVER_LIST_SIZE; j++)\n {\n //Save DNS server address\n ipv4CopyAddr(&interface->ipv4Context.dnsServerList[j],\n option->value + j * sizeof(Ipv4Addr));\n }\n }\n }\n\n //Retrieve MTU option\n option = dhcpGetOption(message, length, DHCP_OPT_INTERFACE_MTU);\n\n //The specified option has been found?\n if(option != NULL && option->length == 2)\n {\n //This option specifies the MTU to use on this interface\n n = LOAD16BE(option->value);\n\n //Make sure that the option's value is acceptable\n if(n >= IPV4_MINIMUM_MTU && n <= physicalInterface->nicDriver->mtu)\n {\n //Set the MTU to be used on the interface\n interface->ipv4Context.linkMtu = n;\n }\n }\n\n //Record the IP address of the DHCP server\n ipv4CopyAddr(&context->serverIpAddr, serverIdOption->value);\n //Record the IP address assigned to the client\n context->requestedIpAddr = message->yiaddr;\n\n //Save the time a which the lease was obtained\n context->leaseStartTime = osGetSystemTime();\n\n //Check current state\n if(context->state == DHCP_STATE_REQUESTING ||\n context->state == DHCP_STATE_REBOOTING)\n {\n //Use the IP address as a tentative address\n interface->ipv4Context.addrList[i].addr = message->yiaddr;\n interface->ipv4Context.addrList[i].state = IPV4_ADDR_STATE_TENTATIVE;\n\n //Clear conflict flag\n interface->ipv4Context.addrList[i].conflict = FALSE;\n\n //The client should probe the newly received address\n dhcpClientChangeState(context, DHCP_STATE_PROBING, 0);\n }\n else\n {\n //Assign the IP address to the client\n interface->ipv4Context.addrList[i].addr = message->yiaddr;\n interface->ipv4Context.addrList[i].state = IPV4_ADDR_STATE_VALID;\n\n#if (MDNS_RESPONDER_SUPPORT == ENABLED)\n //Restart mDNS probing process\n mdnsResponderStartProbing(interface->mdnsResponderContext);\n#endif\n //The client transitions to the BOUND state\n dhcpClientChangeState(context, DHCP_STATE_BOUND, 0);\n }\n}", "label": 1, "label_name": "safe"} -{"code": "\t\tpublic JpaOrder nullsFirst() {\n\t\t\treturn with(NullHandling.NULLS_FIRST);\n\t\t}", "label": 1, "label_name": "safe"} -{"code": " protected function getColumn(array $project)\n {\n $column = $this->columnModel->getById($this->request->getIntegerParam('column_id'));\n\n if (empty($column)) {\n throw new PageNotFoundException();\n }\n\n if ($column['project_id'] != $project['id']) {\n throw new AccessForbiddenException();\n }\n\n return $column;\n }", "label": 1, "label_name": "safe"} -{"code": "\t\tfb.setSize = function (width) {\n\t\t\tif (fbPlayer !== null && !isNaN(width)) {\n\t\t\t\tfbContainer.style.width = width;\n\t\t\t}\n\t\t};", "label": 0, "label_name": "vulnerable"} -{"code": "func (m *U) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowUnrecognized\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: U: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: U: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 2:\n\t\t\tif wireType == 1 {\n\t\t\t\tvar v uint64\n\t\t\t\tif (iNdEx + 8) > l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tv = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:]))\n\t\t\t\tiNdEx += 8\n\t\t\t\tv2 := float64(math.Float64frombits(v))\n\t\t\t\tm.Field2 = append(m.Field2, v2)\n\t\t\t} else if wireType == 2 {\n\t\t\t\tvar packedLen int\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif shift >= 64 {\n\t\t\t\t\t\treturn ErrIntOverflowUnrecognized\n\t\t\t\t\t}\n\t\t\t\t\tif iNdEx >= l {\n\t\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\t\tiNdEx++\n\t\t\t\t\tpackedLen |= int(b&0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif packedLen < 0 {\n\t\t\t\t\treturn ErrInvalidLengthUnrecognized\n\t\t\t\t}\n\t\t\t\tpostIndex := iNdEx + packedLen\n\t\t\t\tif postIndex < 0 {\n\t\t\t\t\treturn ErrInvalidLengthUnrecognized\n\t\t\t\t}\n\t\t\t\tif postIndex > l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tvar elementCount int\n\t\t\t\telementCount = packedLen / 8\n\t\t\t\tif elementCount != 0 && len(m.Field2) == 0 {\n\t\t\t\t\tm.Field2 = make([]float64, 0, elementCount)\n\t\t\t\t}\n\t\t\t\tfor iNdEx < postIndex {\n\t\t\t\t\tvar v uint64\n\t\t\t\t\tif (iNdEx + 8) > l {\n\t\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tv = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:]))\n\t\t\t\t\tiNdEx += 8\n\t\t\t\t\tv2 := float64(math.Float64frombits(v))\n\t\t\t\t\tm.Field2 = append(m.Field2, v2)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Field2\", wireType)\n\t\t\t}\n\t\tcase 3:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Field3\", wireType)\n\t\t\t}\n\t\t\tvar v uint32\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowUnrecognized\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tv |= uint32(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tm.Field3 = &v\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipUnrecognized(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif skippy < 0 {\n\t\t\t\treturn ErrInvalidLengthUnrecognized\n\t\t\t}\n\t\t\tif (iNdEx + skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthUnrecognized\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 0, "label_name": "vulnerable"} -{"code": "int64_t OpLevelCostEstimator::CalculateOutputSize(const OpInfo& op_info,\n bool* found_unknown_shapes) {\n int64_t total_output_size = 0;\n // Use float as default for calculations.\n for (const auto& output : op_info.outputs()) {\n DataType dt = output.dtype();\n const auto& original_output_shape = output.shape();\n int64_t output_size = DataTypeSize(BaseType(dt));\n int num_dims = std::max(1, original_output_shape.dim_size());\n auto output_shape = MaybeGetMinimumShape(original_output_shape, num_dims,\n found_unknown_shapes);\n for (const auto& dim : output_shape.dim()) {\n output_size *= dim.size();\n }\n total_output_size += output_size;\n VLOG(1) << \"Output Size: \" << output_size\n << \" Total Output Size:\" << total_output_size;\n }\n return total_output_size;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "check_rpcsec_auth(struct svc_req *rqstp)\n{\n gss_ctx_id_t ctx;\n krb5_context kctx;\n OM_uint32 maj_stat, min_stat;\n gss_name_t name;\n krb5_principal princ;\n int ret, success;\n krb5_data *c1, *c2, *realm;\n gss_buffer_desc gss_str;\n kadm5_server_handle_t handle;\n size_t slen;\n char *sdots;\n\n success = 0;\n handle = (kadm5_server_handle_t)global_server_handle;\n\n if (rqstp->rq_cred.oa_flavor != RPCSEC_GSS)\n\t return 0;\n\n ctx = rqstp->rq_svccred;\n\n maj_stat = gss_inquire_context(&min_stat, ctx, NULL, &name,\n\t\t\t\t NULL, NULL, NULL, NULL, NULL);\n if (maj_stat != GSS_S_COMPLETE) {\n\t krb5_klog_syslog(LOG_ERR, _(\"check_rpcsec_auth: failed \"\n\t\t\t\t \"inquire_context, stat=%u\"), maj_stat);\n\t log_badauth(maj_stat, min_stat, rqstp->rq_xprt, NULL);\n\t goto fail_name;\n }\n\n kctx = handle->context;\n ret = gss_to_krb5_name_1(rqstp, kctx, name, &princ, &gss_str);\n if (ret == 0)\n\t goto fail_name;\n\n slen = gss_str.length;\n trunc_name(&slen, &sdots);\n /*\n * Since we accept with GSS_C_NO_NAME, the client can authenticate\n * against the entire kdb. Therefore, ensure that the service\n * name is something reasonable.\n */\n if (krb5_princ_size(kctx, princ) != 2)\n\t goto fail_princ;\n\n c1 = krb5_princ_component(kctx, princ, 0);\n c2 = krb5_princ_component(kctx, princ, 1);\n realm = krb5_princ_realm(kctx, princ);\n if (strncmp(handle->params.realm, realm->data, realm->length) == 0\n\t && strncmp(\"kadmin\", c1->data, c1->length) == 0) {\n\n\t if (strncmp(\"history\", c2->data, c2->length) == 0)\n\t goto fail_princ;\n\t else\n\t success = 1;\n }\n\nfail_princ:\n if (!success) {\n\t krb5_klog_syslog(LOG_ERR, _(\"bad service principal %.*s%s\"),\n\t\t\t (int) slen, (char *) gss_str.value, sdots);\n }\n gss_release_buffer(&min_stat, &gss_str);\n krb5_free_principal(kctx, princ);\nfail_name:\n gss_release_name(&min_stat, &name);\n return success;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " recurseBuild($myNode, $newLeft, $newRight);\n }\n //eDebug($TheTree,true);\n\n echo \"Done\";\n\n /*function flattenArray(array $array){\n $ret_array = array();\n $counter=0;\n foreach(new RecursiveIteratorIterator(new RecursiveArrayIterator($array)) as $key=>$value) {\n if ($key=='id') {\n $counter++;\n }\n $ret_array[$counter][$key] = $value;\n }\n return $ret_array;\n }*/\n\n // takes a flat array with propper parent/child relationships in propper order\n // and adds the lft and rgt extents correctly for a nested set\n\n /*function nestify($categories) {\n // Trees mapped\n $trees = array();\n $trackParents = array();\n $depth=0;\n $counter=1;\n $prevDepth=0;\n\n foreach ($categories as $key=>$val) {\n if ($counter==1) {\n # first in loop. We should only hit this once: first.\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else if ($val['depth']>$prevDepth) {\n # we have a child of the previous node\n $trackParents[] = $key-1;\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else if ($val['depth']==$prevDepth) {\n # we have a sibling of the previous node\n $categories[$key-1]['rgt'] = $counter;\n $counter++;\n $categories[$key]['lft'] = $counter;\n $counter++;\n } else {\n # we have moved up in depth, but how far up?\n $categories[$key-1]['rgt'] = $counter;\n $counter++;\n $l=count($trackParents);\n while($l > 0 && $trackParents[$l - 1]['depth'] >= $val['depth']) {\n $categories[$trackParents[$l - 1]]['rgt'] = $counter;\n array_pop($trackParents);\n $counter++;\n $l--;\n }\n\n $categories[$key]['lft'] = $counter;\n //???$counter++;\n }\n $prevDepth=$val['depth'];\n }\n\n $categories[$key]['rgt'] = $counter;\n return $categories;\n } */\n\n // takes a flat nested set formatted array and creates a multi-dimensional array from it\n\n /*function toHierarchy($collection)\n {\n // Trees mapped\n $trees = array();\n $l = 0;\n\n if (count($collection) > 0) {\n // Node Stack. Used to help building the hierarchy\n $stack = array();\n\n foreach ($collection as $node) {\n $item = $node;\n $item['children'] = array();\n\n // Number of stack items\n $l = count($stack);\n\n // Check if we're dealing with different levels\n while($l > 0 && $stack[$l - 1]['depth'] >= $item['depth']) {\n array_pop($stack);\n $l--;\n }\n\n // Stack is empty (we are inspecting the root)\n if ($l == 0) {\n // Assigning the root node\n $i = count($trees);\n $trees[$i] = $item;\n $stack[] = & $trees[$i];\n } else {\n // Add node to parent\n $i = count($stack[$l - 1]['children']);\n $stack[$l - 1]['children'][$i] = $item;\n $stack[] = & $stack[$l - 1]['children'][$i];\n }\n }\n }\n\n return $trees;\n }*/\n\n // this will test our data manipulation\n // eDebug(toHierarchy(nestify(flattenArray($TheTree))),1);\n\n /*$flat_fixed_cats = nestify(flattenArray($TheTree));\n\n foreach ($flat_fixed_cats as $k=>$v) {\n $cat = new storeCategory($v['id']);\n $cat->lft = $v['lft'];\n $cat->rgt = $v['rgt'];\n $cat->save();\n eDebug($cat);\n }\n */\n //-Show Array Structure--//\n // print_r($TheTree);\n //\n //\n // //--Print the Categories, and send their children to DrawBranch--//\n // //--The code below allows you to keep track of what category you're currently drawing--//\n //\n // printf(\"
      \");\n //\n // foreach($TheTree as $MyNode) {\n // printf(\"
    • {$MyNode['Name']}
    • \");\n // if(is_array($MyNode[\"Children\"]) && !empty($MyNode[\"Children\"])) {\n // DrawBranch($MyNode[\"Children\"]);\n // }\n // }\n // printf(\"
    \");\n // //--Recursive printer, should draw a child, and any of its children--//\n //\n // function DrawBranch($Node){\n // printf(\"
      \");\n //\n // foreach($Node as $Entity) {\n // printf(\"
    • {$Entity['Name']}
    • \");\n //\n // if(is_array($Entity[\"Children\"]) && !empty($Entity[\"Children\"])) {\n // DrawBranch($Entity[\"Children\"]);\n // }\n //\n // printf(\"
    \");\n // }\n // }\n }", "label": 1, "label_name": "safe"} -{"code": "ua=E.actions.get(\"zoomOut\"),Da=E.actions.get(\"resetView\");p=E.actions.get(\"fullscreen\");var Fa=E.actions.get(\"undo\"),Ka=E.actions.get(\"redo\"),Oa=F(\"\",Fa.funct,null,mxResources.get(\"undo\")+\" (\"+Fa.shortcut+\")\",Fa,Editor.undoImage),Ia=F(\"\",Ka.funct,null,mxResources.get(\"redo\")+\" (\"+Ka.shortcut+\")\",Ka,Editor.redoImage),Ea=F(\"\",p.funct,null,mxResources.get(\"fullscreen\"),p,Editor.fullscreenImage);if(null!=T){C=function(){ta.style.display=null!=E.pages&&(\"0\"!=urlParams.pages||1 str:\n \"\"\"\n Adds word boundary characters to the start and end of an\n expression to require that the match occur as a whole word,\n but do so respecting the fact that strings starting or ending\n with non-word characters will change word boundaries.\n \"\"\"\n # we can't use \\b as it chokes on unicode. however \\W seems to be okay\n # as shorthand for [^0-9A-Za-z_].\n return r\"(^|\\W)%s(\\W|$)\" % (r,)", "label": 0, "label_name": "vulnerable"} -{"code": "static int rfcomm_sock_getname(struct socket *sock, struct sockaddr *addr, int *len, int peer)\n{\n\tstruct sockaddr_rc *sa = (struct sockaddr_rc *) addr;\n\tstruct sock *sk = sock->sk;\n\n\tBT_DBG(\"sock %p, sk %p\", sock, sk);\n\n\tmemset(sa, 0, sizeof(*sa));\n\tsa->rc_family = AF_BLUETOOTH;\n\tsa->rc_channel = rfcomm_pi(sk)->channel;\n\tif (peer)\n\t\tbacpy(&sa->rc_bdaddr, &bt_sk(sk)->dst);\n\telse\n\t\tbacpy(&sa->rc_bdaddr, &bt_sk(sk)->src);\n\n\t*len = sizeof(struct sockaddr_rc);\n\treturn 0;\n}", "label": 1, "label_name": "safe"} -{"code": " it \"should raise a ParseError if argument 1 isn't 'encode' or 'decode'\" do\n expect { scope.function_base64([\"bees\",\"astring\"]) }.to(raise_error(Puppet::ParseError, /first argument must be one of/))\n end", "label": 0, "label_name": "vulnerable"} -{"code": " function update_option_master() {\n global $db;\n\n $id = empty($this->params['id']) ? null : $this->params['id'];\n $opt = new option_master($id);\n $oldtitle = $opt->title;\n\n $opt->update($this->params);\n\n // if the title of the master changed we should update the option groups that are already using it.\n if ($oldtitle != $opt->title) {\n\n }$db->sql('UPDATE '.$db->prefix.'option SET title=\"'.$opt->title.'\" WHERE option_master_id='.$opt->id);\n\n expHistory::back();\n }", "label": 1, "label_name": "safe"} -{"code": " public function getMessage()\n {\n if (!$this->isSuccessful()) {\n return $this->data['error']['message'];\n }\n\n return;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "mxUtils.getOffset(l.container),U=l.view.translate,X=l.view.scale,u=null!=b.currentPage?b.currentPage.getId():null;c(\"cursor\",{pageId:u,x:Math.round((M.getX()-W.x+l.container.scrollLeft)/X-U.x),y:Math.round((M.getY()-W.y+l.container.scrollTop)/X-U.y)})}}function n(M,W){var U=null!=b.currentPage?b.currentPage.getId():null;if(null!=M&&null!=M.cursor&&null!=M.lastCursor)if(null!=M.lastCursor.hide||!b.isShowRemoteCursors()||null!=M.lastCursor.pageId&&M.lastCursor.pageId!=U)M.cursor.style.display=\"none\";\nelse{U=function(){var N=Math.max(l.container.scrollLeft,Math.min(l.container.scrollLeft+l.container.clientWidth-M.cursor.clientWidth,E)),Q=Math.max(l.container.scrollTop-22,Math.min(l.container.scrollTop+l.container.clientHeight-M.cursor.clientHeight,J));T.style.opacity=N!=E||Q!=J?0:1;M.cursor.style.left=N+\"px\";M.cursor.style.top=Q+\"px\";M.cursor.style.display=\"\"};var X=l.view.translate,u=l.view.scale,E=(X.x+M.lastCursor.x)*u+8,J=(X.y+M.lastCursor.y)*u-12,T=M.cursor.getElementsByTagName(\"img\")[0];\nW?(mxUtils.setPrefixedStyle(M.cursor.style,\"transition\",\"all 600ms ease-out\"),mxUtils.setPrefixedStyle(T.style,\"transition\",\"all 600ms ease-out\"),window.setTimeout(U,0)):(mxUtils.setPrefixedStyle(M.cursor.style,\"transition\",null),mxUtils.setPrefixedStyle(T.style,\"transition\",null),U())}}function v(M,W){function U(){if(null==y[u]){var Y=t[u];null==Y&&(Y=p%x.length,t[u]=Y,p++);var ba=x[Y];Y=11>2;c2=(x&3)<<4|A>>4;c3=(A&15)<<2|z>>6;c4=z&63;r=\"\";r+=q(c1&63);r+=q(c2&63);r+=q(c3&63);return r+=q(c4&63)}function q(x){if(10>x)return String.fromCharCode(48+x);x-=10;if(26>x)return String.fromCharCode(65+x);x-=26;if(26>x)return String.fromCharCode(97+x);x-=26;return 0==x?\"-\":1==x?\"_\":\"?\"}var v=new XMLHttpRequest;v.open(\"GET\",(\"txt\"==e?PLANT_URL+\"/txt/\":\"png\"==e?PLANT_URL+\"/png/\":\nPLANT_URL+\"/svg/\")+function(x){r=\"\";for(i=0;ithis.status)if(\"txt\"==e)g(this.response);else{var A=new FileReader;A.readAsDataURL(this.response);A.onloadend=function(z){var L=new Image;L.onload=\nfunction(){try{var M=L.width,n=L.height;if(0==M&&0==n){var y=A.result,K=y.indexOf(\",\"),B=decodeURIComponent(escape(atob(y.substring(K+1)))),F=mxUtils.parseXml(B).getElementsByTagName(\"svg\");0> 13) + 2) << 1;\n if (frame - frame_start < offset || frame_end - frame < count*2 + width)\n return AVERROR_INVALIDDATA;\n for (i = 0; i < count; i++) {\n frame[0] = frame[1] =\n frame[width] = frame[width + 1] = frame[-offset];\n\n frame += 2;\n }\n } else if (bitbuf & (mask << 1)) {\n v = bytestream2_get_le16(gb)*2;\n if (frame - frame_end < v)\n return AVERROR_INVALIDDATA;\n frame += v;\n } else {\n if (frame_end - frame < width + 4)\n return AVERROR_INVALIDDATA;\n frame[0] = frame[1] =\n frame[width] = frame[width + 1] = bytestream2_get_byte(gb);\n frame += 2;\n frame[0] = frame[1] =\n frame[width] = frame[width + 1] = bytestream2_get_byte(gb);\n frame += 2;\n }\n mask <<= 2;\n }\n\n return 0;\n}", "label": 1, "label_name": "safe"} -{"code": "TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node, bool is_arg_max) {\n const TfLiteTensor* input = GetInput(context, node, kInputTensor);\n const TfLiteTensor* axis = GetInput(context, node, kAxis);\n TfLiteTensor* output = GetOutput(context, node, kOutputTensor);\n if (IsDynamicTensor(output)) {\n TF_LITE_ENSURE_STATUS(ResizeOutput(context, input, axis, output));\n }\n\n#define TF_LITE_ARG_MIN_MAX(data_type, axis_type, output_type) \\\n optimized_ops::ArgMinMax( \\\n GetTensorShape(input), GetTensorData(input), \\\n GetTensorData(axis), GetTensorShape(output), \\\n GetTensorData(output), \\\n GetComparefunction(is_arg_max))\n if (axis->type == kTfLiteInt32) {\n switch (output->type) {\n case kTfLiteInt32: {\n switch (input->type) {\n case kTfLiteFloat32:\n TF_LITE_ARG_MIN_MAX(float, int32_t, int32_t);\n break;\n case kTfLiteUInt8:\n TF_LITE_ARG_MIN_MAX(uint8_t, int32_t, int32_t);\n break;\n case kTfLiteInt8:\n TF_LITE_ARG_MIN_MAX(int8_t, int32_t, int32_t);\n break;\n case kTfLiteInt32:\n TF_LITE_ARG_MIN_MAX(int32_t, int32_t, int32_t);\n break;\n default:\n context->ReportError(context,\n \"Only float32, uint8, int8 and int32 are \"\n \"supported currently, got %s.\",\n TfLiteTypeGetName(input->type));\n return kTfLiteError;\n }\n } break;\n case kTfLiteInt64: {\n switch (input->type) {\n case kTfLiteFloat32:\n TF_LITE_ARG_MIN_MAX(float, int32_t, int64_t);\n break;\n case kTfLiteUInt8:\n TF_LITE_ARG_MIN_MAX(uint8_t, int32_t, int64_t);\n break;\n case kTfLiteInt8:\n TF_LITE_ARG_MIN_MAX(int8_t, int32_t, int64_t);\n break;\n case kTfLiteInt32:\n TF_LITE_ARG_MIN_MAX(int32_t, int32_t, int64_t);\n break;\n default:\n context->ReportError(context,\n \"Only float32, uint8, int8 and int32 are \"\n \"supported currently, got %s.\",\n TfLiteTypeGetName(input->type));\n return kTfLiteError;\n }\n } break;\n default:\n context->ReportError(\n context, \"Only int32 and int64 are supported currently, got %s.\",\n TfLiteTypeGetName(output->type));\n return kTfLiteError;\n }\n } else {\n switch (output->type) {\n case kTfLiteInt32: {\n switch (input->type) {\n case kTfLiteFloat32:\n TF_LITE_ARG_MIN_MAX(float, int64_t, int32_t);\n break;\n case kTfLiteUInt8:\n TF_LITE_ARG_MIN_MAX(uint8_t, int64_t, int32_t);\n break;\n case kTfLiteInt8:\n TF_LITE_ARG_MIN_MAX(int8_t, int64_t, int32_t);\n break;\n case kTfLiteInt32:\n TF_LITE_ARG_MIN_MAX(int32_t, int64_t, int32_t);\n break;\n default:\n context->ReportError(context,\n \"Only float32, uint8, int8 and int32 are \"\n \"supported currently, got %s.\",\n TfLiteTypeGetName(input->type));\n return kTfLiteError;\n }\n } break;\n case kTfLiteInt64: {\n switch (input->type) {\n case kTfLiteFloat32:\n TF_LITE_ARG_MIN_MAX(float, int64_t, int64_t);\n break;\n case kTfLiteUInt8:\n TF_LITE_ARG_MIN_MAX(uint8_t, int64_t, int64_t);\n break;\n case kTfLiteInt8:\n TF_LITE_ARG_MIN_MAX(int8_t, int64_t, int64_t);\n break;\n case kTfLiteInt32:\n TF_LITE_ARG_MIN_MAX(int32_t, int64_t, int64_t);\n break;\n default:\n context->ReportError(context,\n \"Only float32, uint8, int8 and int32 are \"\n \"supported currently, got %s.\",\n TfLiteTypeGetName(input->type));\n return kTfLiteError;\n }\n } break;\n default:\n context->ReportError(\n context, \"Only int32 and int64 are supported currently, got %s.\",\n TfLiteTypeGetName(output->type));\n return kTfLiteError;\n }\n }\n#undef TF_LITE_ARG_MIN_MAX\n\n return kTfLiteOk;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " it 'should work' do\n pp = <<-EOS\n class { 'mysql::server': root_password => 'test' }\n EOS\n\n # Run it twice and test for idempotency\n apply_manifest(pp, :catch_failures => true)\n expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": "!0);V.init()}))})})}));d.actions.put(\"liveImage\",new Action(\"Live image...\",function(){var n=d.getCurrentFile();null!=n&&d.spinner.spin(document.body,mxResources.get(\"loading\"))&&d.getPublicUrl(d.getCurrentFile(),function(y){d.spinner.stop();null!=y?(y=new EmbedDialog(d,''),d.showDialog(y.container,450,240,!0,!0),y.init()):d.handleError({message:mxResources.get(\"invalidPublicUrl\")})})}));d.actions.put(\"embedImage\",", "label": 0, "label_name": "vulnerable"} -{"code": " public function downloadCsvAction(Request $request)\n {\n $this->checkPermission('reports');\n if ($exportFile = $request->get('exportFile')) {\n $exportFile = PIMCORE_SYSTEM_TEMP_DIRECTORY . '/' . basename($exportFile);\n $response = new BinaryFileResponse($exportFile);\n $response->headers->set('Content-Type', 'text/csv; charset=UTF-8');\n $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'export.csv');\n $response->deleteFileAfterSend(true);\n\n return $response;\n }\n throw new FileNotFoundException(\"File \\\"$exportFile\\\" not found!\");\n }", "label": 1, "label_name": "safe"} -{"code": " it 'does ticket merge (07.01)' do\n group_no_permission = create(:group)\n ticket1 = create(\n :ticket,\n title: 'ticket merge1',\n group: ticket_group,\n customer_id: customer_user.id,\n )\n ticket2 = create(\n :ticket,\n title: 'ticket merge2',\n group: ticket_group,\n customer_id: customer_user.id,\n )\n ticket3 = create(\n :ticket,\n title: 'ticket merge2',\n group: group_no_permission,\n customer_id: customer_user.id,\n )\n\n authenticated_as(customer_user)\n get \"/api/v1/ticket_merge/#{ticket2.id}/#{ticket1.id}\", params: {}, as: :json\n expect(response).to have_http_status(:unauthorized)\n\n authenticated_as(agent_user)\n get \"/api/v1/ticket_merge/#{ticket2.id}/#{ticket1.id}\", params: {}, as: :json\n expect(response).to have_http_status(:ok)\n expect(json_response).to be_a_kind_of(Hash)\n expect(json_response['result']).to eq('failed')\n expect(json_response['message']).to eq('No such master ticket number!')\n\n get \"/api/v1/ticket_merge/#{ticket3.id}/#{ticket1.number}\", params: {}, as: :json\n expect(response).to have_http_status(:unauthorized)\n expect(json_response).to be_a_kind_of(Hash)\n expect(json_response['error']).to eq('Not authorized')\n expect(json_response['error_human']).to eq('Not authorized')\n\n get \"/api/v1/ticket_merge/#{ticket1.id}/#{ticket3.number}\", params: {}, as: :json\n expect(response).to have_http_status(:unauthorized)\n expect(json_response).to be_a_kind_of(Hash)\n expect(json_response['error']).to eq('Not authorized')\n expect(json_response['error_human']).to eq('Not authorized')\n\n get \"/api/v1/ticket_merge/#{ticket1.id}/#{ticket2.number}\", params: {}, as: :json\n expect(response).to have_http_status(:ok)\n expect(json_response).to be_a_kind_of(Hash)\n expect(json_response['result']).to eq('success')\n expect(json_response['master_ticket']['id']).to eq(ticket2.id)\n end", "label": 1, "label_name": "safe"} -{"code": " def test_received_nonsense_nothing(self):\n data = b\"\\r\\n\\r\\n\"\n result = self.parser.received(data)\n self.assertEqual(result, 4)\n self.assertTrue(self.parser.completed)\n self.assertEqual(self.parser.headers, {})", "label": 1, "label_name": "safe"} -{"code": " private function getDefinitionId($id)\n {\n $seen = array();\n while ($this->container->hasAlias($id)) {\n if (isset($seen[$id])) {\n throw new ServiceCircularReferenceException($id, array_keys($seen));\n }\n $seen[$id] = true;\n $id = (string) $this->container->getAlias($id);\n }\n\n return $id;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public static function add($tags) {\r\n\r\n $tag = explode(\",\", $tags);\r\n foreach ($tag as $t) {\r\n if (self::exist($t)) {\r\n return false;\r\n }else{\r\n $slug = Typo::slugify(Typo::cleanX($t));\r\n $cat = Typo::cleanX($t);\r\n $tag = Db::insert(\r\n sprintf(\"INSERT INTO `cat` VALUES (null, '%s', '%s', '%d', '', 'tag' )\",\r\n $cat, $slug, 0\r\n )\r\n );\r\n return true;\r\n }\r\n }\r\n\r\n\r\n }\r", "label": 0, "label_name": "vulnerable"} -{"code": " close: function(event, ui) {\n login_dialog_opened = false;\n location = \"/logout\";\n },", "label": 1, "label_name": "safe"} -{"code": "static int cac_get_serial_nr_from_CUID(sc_card_t* card, sc_serial_number_t* serial)\n{\n\tcac_private_data_t * priv = CAC_DATA(card);\n\n\tSC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_NORMAL);\n if (card->serialnr.len) {\n *serial = card->serialnr;\n SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_SUCCESS);\n }\n\tif (priv->cac_id_len) {\n\t\tserial->len = MIN(priv->cac_id_len, SC_MAX_SERIALNR);\n\t\tmemcpy(serial->value, priv->cac_id, serial->len);\n\t\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_SUCCESS);\n\t}\n\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_FILE_NOT_FOUND);\n}", "label": 1, "label_name": "safe"} -{"code": " ErrorType decrypt(unsigned char* packet,\n uint32_t packet_len,\n unsigned char* length_bytes,\n unsigned char* tag) {\n ErrorType r = kErrNone;\n\n // `packet` layout:\n // \n\n int outlen;\n\n // Increment IV\n unsigned char lastiv[1];\n if (!EVP_CIPHER_CTX_ctrl(ctx_, EVP_CTRL_GCM_IV_GEN, 1, lastiv)) {\n r = kErrOpenSSL;\n goto out;\n }\n\n // Set AAD (the packet length)\n if (!EVP_DecryptUpdate(ctx_, nullptr, &outlen, length_bytes, 4)) {\n r = kErrOpenSSL;\n goto out;\n }\n if (outlen != 4) {\n r = kErrAADFailure;\n goto out;\n }\n\n // Decrypt everything but the packet length\n if (EVP_DecryptUpdate(ctx_, packet, &outlen, packet, packet_len) != 1) {\n r = kErrOpenSSL;\n goto out;\n }\n if (static_cast(outlen) != packet_len) {\n r = kErrPartialDecrypt;\n goto out;\n }\n\n // Set authentication tag\n if (EVP_CIPHER_CTX_ctrl(ctx_, EVP_CTRL_AEAD_SET_TAG, 16, tag) != 1) {\n r = kErrOpenSSL;\n goto out;\n }\n\n // Verify authentication tag\n if (!EVP_DecryptFinal_ex(ctx_, nullptr, &outlen)) {\n r = kErrOpenSSL;\n goto out;\n }\n\nout:\n return r;\n }", "label": 1, "label_name": "safe"} -{"code": "\t\t\t\tselect = function() {\n\t\t\t\t\tvar name = input.val().replace(/\\.((tar\\.(gz|bz|bz2|z|lzo))|cpio\\.gz|ps\\.gz|xcf\\.(gz|bz2)|[a-z0-9]{1,4})$/ig, '');\n\t\t\t\t\tinError = false;\n\t\t\t\t\tif (fm.UA.Mobile) {\n\t\t\t\t\t\toverlay.on('click', cancel)\n\t\t\t\t\t\t\t.removeClass('ui-front').elfinderoverlay('show');\n\t\t\t\t\t}\n\t\t\t\t\tinput.select().focus();\n\t\t\t\t\tinput[0].setSelectionRange && input[0].setSelectionRange(0, name.length);\n\t\t\t\t},", "label": 1, "label_name": "safe"} -{"code": " \"should return zero values\": function(res) {\n assert.equal(res.length, 0);\n },", "label": 0, "label_name": "vulnerable"} -{"code": "juniper_ggsn_print(netdissect_options *ndo,\n const struct pcap_pkthdr *h, register const u_char *p)\n{\n struct juniper_l2info_t l2info;\n struct juniper_ggsn_header {\n uint8_t svc_id;\n uint8_t flags_len;\n uint8_t proto;\n uint8_t flags;\n uint8_t vlan_id[2];\n uint8_t res[2];\n };\n const struct juniper_ggsn_header *gh;\n\n l2info.pictype = DLT_JUNIPER_GGSN;\n if (juniper_parse_header(ndo, p, h, &l2info) == 0)\n return l2info.header_len;\n\n p+=l2info.header_len;\n gh = (struct juniper_ggsn_header *)&l2info.cookie;\n\n ND_TCHECK(*gh);\n if (ndo->ndo_eflag) {\n ND_PRINT((ndo, \"proto %s (%u), vlan %u: \",\n tok2str(juniper_protocol_values,\"Unknown\",gh->proto),\n gh->proto,\n EXTRACT_16BITS(&gh->vlan_id[0])));\n }\n\n switch (gh->proto) {\n case JUNIPER_PROTO_IPV4:\n ip_print(ndo, p, l2info.length);\n break;\n case JUNIPER_PROTO_IPV6:\n ip6_print(ndo, p, l2info.length);\n break;\n default:\n if (!ndo->ndo_eflag)\n ND_PRINT((ndo, \"unknown GGSN proto (%u)\", gh->proto));\n }\n\n return l2info.header_len;\n\ntrunc:\n\tND_PRINT((ndo, \"[|juniper_services]\"));\n\treturn l2info.header_len;\n}", "label": 1, "label_name": "safe"} -{"code": "TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {\n auto* params = reinterpret_cast(node->builtin_data);\n OpData* data = reinterpret_cast(node->user_data);\n\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n\n const TfLiteTensor* input1;\n TF_LITE_ENSURE_OK(context,\n GetInputSafe(context, node, kInputTensor1, &input1));\n const TfLiteTensor* input2;\n TF_LITE_ENSURE_OK(context,\n GetInputSafe(context, node, kInputTensor2, &input2));\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n\n TF_LITE_ENSURE_TYPES_EQ(context, input1->type, input2->type);\n output->type = input2->type;\n\n data->requires_broadcast = !HaveSameShapes(input1, input2);\n\n TfLiteIntArray* output_size = nullptr;\n if (data->requires_broadcast) {\n TF_LITE_ENSURE_OK(context, CalculateShapeForBroadcast(\n context, input1, input2, &output_size));\n } else {\n output_size = TfLiteIntArrayCopy(input1->dims);\n }\n\n if (output->type == kTfLiteUInt8) {\n TF_LITE_ENSURE_STATUS(CalculateActivationRangeQuantized(\n context, params->activation, output, &data->output_activation_min,\n &data->output_activation_max));\n const double real_multiplier =\n input1->params.scale / (input2->params.scale * output->params.scale);\n QuantizeMultiplier(real_multiplier, &data->output_multiplier,\n &data->output_shift);\n }\n\n return context->ResizeTensor(context, output, output_size);\n}", "label": 1, "label_name": "safe"} -{"code": " def test_basic_auth_invalid_username(self):\n with self.assertRaises(InvalidStatusCode) as raised:\n self.start_client(user_info=(\"goodbye\", \"iloveyou\"))\n self.assertEqual(raised.exception.status_code, 401)", "label": 1, "label_name": "safe"} -{"code": " private String getPath(String test, int sequence, boolean poison) {\n String path = contextPath + \"/servlet?action=\" + test + \"&sequence=\" + sequence;\n if (poison) {\n path += \"&poison=true\";\n }\n return path;\n }", "label": 1, "label_name": "safe"} -{"code": " } elseif ($trusted || $check_comments) {\n // always cleanup comments\n $trailing_hyphen = false;\n if ($e) {\n // perform check whether or not there's a trailing hyphen\n if (substr($token->data, -1) == '-') {\n $trailing_hyphen = true;\n }\n }\n $token->data = rtrim($token->data, '-');\n $found_double_hyphen = false;\n while (strpos($token->data, '--') !== false) {\n $found_double_hyphen = true;\n $token->data = str_replace('--', '-', $token->data);\n }\n if ($trusted || !empty($comment_lookup[trim($token->data)]) ||\n ($comment_regexp !== null && preg_match($comment_regexp, trim($token->data)))) {\n // OK good\n if ($e) {\n if ($trailing_hyphen) {\n $e->send(\n E_NOTICE,\n 'Strategy_RemoveForeignElements: Trailing hyphen in comment removed'\n );\n }\n if ($found_double_hyphen) {\n $e->send(E_NOTICE, 'Strategy_RemoveForeignElements: Hyphens in comment collapsed');\n }\n }\n } else {\n if ($e) {\n $e->send(E_NOTICE, 'Strategy_RemoveForeignElements: Comment removed');\n }\n continue;\n }\n } else {", "label": 1, "label_name": "safe"} -{"code": " it 'finds short ipv6' do\n shell(\"mysql -NBe \\\"SHOW GRANTS FOR 'test'@'::1/128'\\\"\") do |r|\n expect(r.stdout).to match(/GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'::1\\/128'/)\n expect(r.stderr).to be_empty\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": " public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider)\n {\n $this->expressionLanguageProviders[] = $provider;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " it 'should exec for CentOS identified from operatingsystem' do\n allow(Facter.fact(:osfamily)).to receive(:value).and_return(nil)\n allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('CentOS')\n expect(subject).to receive(:execute).with(%w{/sbin/service iptables save})\n subject.persist_iptables(proto)\n end", "label": 0, "label_name": "vulnerable"} -{"code": " it param[:title] do\n matches = Array(param[:match])\n\n if matches.all? { |m| m.is_a? Regexp }\n matches.each { |item| should contain_concat__fragment(\"#{title}-header\").with_content(item) }\n else\n lines = subject.resource('concat::fragment', \"#{title}-header\").send(:parameters)[:content].split(\"\\n\")\n (lines & Array(param[:match])).should == Array(param[:match])\n end\n Array(param[:notmatch]).each do |item|\n should contain_concat__fragment(\"#{title}-header\").without_content(item)\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": "TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {\n const TfLiteTensor* cond_tensor;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kInputConditionTensor,\n &cond_tensor));\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n\n if (IsDynamicTensor(output)) {\n TF_LITE_ENSURE_OK(context,\n ResizeOutputTensor(context, cond_tensor, output));\n }\n\n TfLiteIntArray* dims = cond_tensor->dims;\n if (dims->size == 0) {\n // Scalar tensors are not supported.\n TF_LITE_KERNEL_LOG(context, \"Where op requires condition w/ rank > 0\");\n return kTfLiteError;\n }\n\n reference_ops::SelectTrueCoords(GetTensorShape(cond_tensor),\n GetTensorData(cond_tensor),\n GetTensorData(output));\n return kTfLiteOk;\n}", "label": 1, "label_name": "safe"} -{"code": " protected function getDefault($key, $default)\n {\n if ( ! $this->fallback) {\n return $default;\n }\n\n return $this->fallback->get($key, $default);\n }", "label": 0, "label_name": "vulnerable"} -{"code": " $product_status = new product_status($pstat);\n if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (oi.products_status = '\" . $product_status->title . \"'\";\n } else {\n $sqltmp .= \" OR oi.products_status = '\" . $product_status->title . \"'\";\n }\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n\n if (!empty($p['uidata'])) {\n $sqlwhere .= \" AND oi.user_input_fields != '' AND oi.user_input_fields != 'a:0:{}'\";\n }\n\n $inc = 0;\n $sqltmp = '';\n foreach ($p['discounts'] as $d) {\n if ($d == -1) continue;\n else if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND (od.discounts_id = \" . $d;\n } else {\n $sqltmp .= \" OR od.discounts_id = \" . $d;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n\n if (!empty($p['blshpname'])) {\n $sqlwhere .= \" AND (b.firstname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR s.firstname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR b.lastname LIKE '%\" . $p['blshpname'] . \"%'\";\n $sqlwhere .= \" OR s.lastname LIKE '%\" . $p['blshpname'] . \"%')\";\n }\n\n if (!empty($p['email'])) {\n $sqlwhere .= \" AND (b.email LIKE '%\" . $p['email'] . \"%'\";\n $sqlwhere .= \" OR s.email LIKE '%\" . $p['email'] . \"%')\";\n }\n\n if (!empty($p['zip'])) {\n if ($p['bl-sp-zip'] == 'b') $sqlwhere .= \" AND b.zip LIKE '%\" . $p['zip'] . \"%'\";\n else if ($p['bl-sp-zip'] == 's') $sqlwhere .= \" AND s.zip LIKE '%\" . $p['zip'] . \"%'\";\n }\n\n if (isset($p['state'])) {\n $inc = 0;\n $sqltmp = '';\n foreach ($p['state'] as $s) {\n if ($s == -1) continue;\n else if ($inc == 0) {\n $inc++;\n if ($p['bl-sp-state'] == 'b') $sqltmp .= \" AND (b.state = \" . $s;\n else if ($p['bl-sp-state'] == 's') $sqltmp .= \" AND (s.state = \" . $s;\n } else {\n if ($p['bl-sp-state'] == 'b') $sqltmp .= \" OR b.state = \" . $s;\n else if ($p['bl-sp-state'] == 's') $sqltmp .= \" OR s.state = \" . $s;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }\n\n if (isset($p['payment_method'])) {\n $inc = 0;\n $sqltmp = '';\n //get each calculator's id \n\n foreach ($p['payment_method'] as $s) {\n if ($s == -1) continue;\n if ($s == 'VisaCard' || $s == 'AmExCard' || $s == 'MasterCard' || $s == 'DiscoverCard') {\n $paymentQuery = 'b.billing_options LIKE \"%' . $s . '%\"';\n } else {\n $bc = new billingcalculator();\n $calc = $bc->findBy('calculator_name', $s);\n $paymentQuery = 'billingcalculator_id = ' . $calc->id;\n }\n\n if ($inc == 0) {\n $inc++;\n $sqltmp .= \" AND ( \" . $paymentQuery;\n } else {\n $sqltmp .= \" OR \" . $paymentQuery;\n }\n }\n if (!empty($sqltmp)) $sqlwhere .= $sqltmp .= \")\";\n }\n\n //echo $sql . $sqlwhere . \"
    \";\n /*\n Need: order, orderitems, order status, ordertype, billingmethods, geo region, shipping methods, products\n [date-startdate] => \n [time-h-startdate] => \n [time-m-startdate] => \n [ampm-startdate] => am\n [date-enddate] => \n [time-h-enddate] => \n [time-m-enddate] => \n [ampm-enddate] => am\n [order_status] => Array\n (\n [0] => 0\n [1] => 1\n [2] => 2\n )\n\n [order_type] => Array\n (\n [0] => 0\n [1] => 2\n )\n\n [order-range-op] => e\n [order-range-num] => \n [order-price-op] => l\n [order-price-num] => \n [pnam] => \n [sku] => \n [discounts] => Array\n (\n [0] => -1\n )\n\n [blshpname] => \n [email] => \n [bl-sp-zip] => s\n [zip] => \n [bl-sp-state] => s\n [state] => Array\n (\n [0] => -1\n )\n\n [status] => Array\n (\n [0] => -1\n )\n\n )\n */\n\n //$sqlwhere .= \" ORDER BY purchased_date DESC\";\n $count_sql .= $sql . $sqlwhere;\n $sql = $start_sql . $sql;\n expSession::set('order_print_query', $sql . $sqlwhere);\n $reportRecords = $db->selectObjectsBySql($sql . $sqlwhere);\n expSession::set('order_export_values', $reportRecords);\n\n //eDebug(expSession::get('order_export_values'));\n //$where = 1;//$this->aggregateWhereClause();\n //$order = 'id';\n //$prod = new product();\n // $order = new order();\n //$items = $prod->find('all', 1, 'id DESC',25); \n //$items = $order->find('all', 1, 'id DESC',25); \n //$res = $mod->find('all',$sql,'id',25);\n //eDebug($items);\n //eDebug($sql . $sqlwhere); \n\n $page = new expPaginator(array(\n //'model'=>'order',\n //'records'=>$items,\n // 'where'=>$where,\n 'count_sql' => $count_sql,\n 'sql' => $sql . $sqlwhere,\n 'limit' => empty($this->config['limit']) ? 350 : $this->config['limit'],\n 'order' => 'invoice_id',\n 'dir' => 'DESC',\n 'page' => (isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller' => $this->baseclassname,\n 'action' => $this->params['action'],\n 'columns' => array(\n 'actupon' => true,\n gt('Order #') => 'invoice_id|controller=order,action=show,showby=id',\n gt('Purchased Date') => 'purchased_date',\n gt('First') => 'bfirst',\n gt('Last') => 'blast',\n gt('Total') => 'grand_total',\n gt('Status Changed Date') => 'status_changed_date',\n gt('Order Type') => 'order_type',\n gt('Status') => 'status_title'\n ),\n ));\n\n //strftime(\"%a %d-%m-%Y\", get_first_day(3, 1, 2007)); Thursday, 1 April 2010 \n //$d_month_previous = date('n', mktime(0,0,0,(strftime(\"%m\")-1),1,strftime(\"%Y\")));\n\n $action_items = array(\n 'print_orders' => 'Print Orders',\n 'export_odbc' => 'Export Shipping Data to CSV',\n 'export_status_report' => 'Export Order Status Data to CSV',\n 'export_inventory' => 'Export Inventory Data to CSV',\n 'export_user_input_report' => 'Export User Input Data to CSV',\n 'export_order_items' => 'Export Order Items Data to CSV',\n 'show_payment_summary' => 'Show Payment & Tax Summary'\n );\n assign_to_template(array(\n 'page' => $page,\n 'action_items' => $action_items\n ));\n }", "label": 0, "label_name": "vulnerable"} -{"code": "def test_httpie_sessions_upgrade_all(tmp_path, mock_env, extra_args, extra_variables):\n mock_env._create_temp_config_dir = False\n mock_env.config_dir = tmp_path / \"config\"\n\n session_dir = mock_env.config_dir / SESSIONS_DIR_NAME / DUMMY_HOST\n session_dir.mkdir(parents=True)\n for original_session_file in SESSION_FILES_OLD:\n shutil.copy(original_session_file, session_dir)\n\n result = httpie(\n 'cli', 'sessions', 'upgrade-all', *extra_args, env=mock_env\n )\n assert result.exit_status == ExitStatus.SUCCESS\n\n for refactored_session_file, expected_session_file in zip(\n sorted(session_dir.glob(\"*.json\")),\n SESSION_FILES_NEW\n ):\n assert read_session_file(refactored_session_file) == read_session_file(\n expected_session_file, extra_variables=extra_variables\n )", "label": 1, "label_name": "safe"} -{"code": " it 'should remove Mysql_User[root@::1]' do\n should contain_mysql_user('root@::1').with_ensure('absent')\n end", "label": 0, "label_name": "vulnerable"} -{"code": " private function _pLookAhead()\n {\n if ($this->currentToken instanceof HTMLPurifier_Token_Start) {\n $nesting = 1;\n } else {\n $nesting = 0;\n }\n $ok = false;\n $i = null;\n while ($this->forwardUntilEndToken($i, $current, $nesting)) {\n $result = $this->_checkNeedsP($current);\n if ($result !== null) {\n $ok = $result;\n break;\n }\n }\n return $ok;\n }", "label": 1, "label_name": "safe"} -{"code": " it \"should execute 'git init --bare'\" do\n resource[:ensure] = :bare\n resource.delete(:source)\n expects_chdir\n expects_mkdir\n expects_directory?(false)\n provider.expects(:working_copy_exists?).returns(false)\n provider.expects(:git).with('init', '--bare')\n provider.create\n end", "label": 0, "label_name": "vulnerable"} -{"code": "static PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int num_fields)\n{\n _Py_IDENTIFIER(__module__);\n _Py_IDENTIFIER(_ast3);\n PyObject *fnames, *result;\n int i;\n fnames = PyTuple_New(num_fields);\n if (!fnames) return NULL;\n for (i = 0; i < num_fields; i++) {\n PyObject *field = PyUnicode_FromString(fields[i]);\n if (!field) {\n Py_DECREF(fnames);\n return NULL;\n }\n PyTuple_SET_ITEM(fnames, i, field);\n }\n result = PyObject_CallFunction((PyObject*)&PyType_Type, \"s(O){OOOO}\",\n type, base,\n _PyUnicode_FromId(&PyId__fields), fnames,\n _PyUnicode_FromId(&PyId___module__),\n _PyUnicode_FromId(&PyId__ast3));\n Py_DECREF(fnames);\n return (PyTypeObject*)result;\n}", "label": 1, "label_name": "safe"} -{"code": " function startReads() {\n let reads = 0;\n let psrc = 0;\n while (pdst < fsize && reads < concurrency) {\n const chunk =\n (pdst + chunkSize > fsize ? fsize - pdst : chunkSize);\n singleRead(psrc, pdst, chunk);\n psrc += chunk;\n pdst += chunk;\n ++reads;\n }\n }", "label": 1, "label_name": "safe"} -{"code": "jas_image_t *bmp_decode(jas_stream_t *in, char *optstr)\n{\n\tjas_image_t *image;\n\tbmp_hdr_t hdr;\n\tbmp_info_t *info;\n\tuint_fast16_t cmptno;\n\tjas_image_cmptparm_t cmptparms[3];\n\tjas_image_cmptparm_t *cmptparm;\n\tuint_fast16_t numcmpts;\n\tlong n;\n\tbmp_dec_importopts_t opts;\n\tsize_t num_samples;\n\n\timage = 0;\n\tinfo = 0;\n\n\tif (bmp_dec_parseopts(optstr, &opts)) {\n\t\tgoto error;\n\t}\n\n\tjas_eprintf(\n\t \"THE BMP FORMAT IS NOT FULLY SUPPORTED!\\n\"\n\t \"THAT IS, THE JASPER SOFTWARE CANNOT DECODE ALL TYPES OF BMP DATA.\\n\"\n\t \"IF YOU HAVE ANY PROBLEMS, PLEASE TRY CONVERTING YOUR IMAGE DATA\\n\"\n\t \"TO THE PNM FORMAT, AND USING THIS FORMAT INSTEAD.\\n\"\n\t );\n\n\t/* Read the bitmap header. */\n\tif (bmp_gethdr(in, &hdr)) {\n\t\tjas_eprintf(\"cannot get header\\n\");\n\t\tgoto error;\n\t}\n\tJAS_DBGLOG(1, (\n\t \"BMP header: magic 0x%x; siz %d; res1 %d; res2 %d; off %d\\n\",\n\t hdr.magic, hdr.siz, hdr.reserved1, hdr.reserved2, hdr.off\n\t ));\n\n\t/* Read the bitmap information. */\n\tif (!(info = bmp_getinfo(in))) {\n\t\tjas_eprintf(\"cannot get info\\n\");\n\t\tgoto error;\n\t}\n\tJAS_DBGLOG(1,\n\t (\"BMP information: len %ld; width %ld; height %ld; numplanes %d; \"\n\t \"depth %d; enctype %ld; siz %ld; hres %ld; vres %ld; numcolors %ld; \"\n\t \"mincolors %ld\\n\", JAS_CAST(long, info->len),\n\t JAS_CAST(long, info->width), JAS_CAST(long, info->height),\n\t JAS_CAST(long, info->numplanes), JAS_CAST(long, info->depth),\n\t JAS_CAST(long, info->enctype), JAS_CAST(long, info->siz),\n\t JAS_CAST(long, info->hres), JAS_CAST(long, info->vres),\n\t JAS_CAST(long, info->numcolors), JAS_CAST(long, info->mincolors)));\n\n\tif (info->width < 0 || info->height < 0 || info->numplanes < 0 ||\n\t info->depth < 0 || info->siz < 0 || info->hres < 0 || info->vres < 0) {\n\t\tjas_eprintf(\"corrupt bit stream\\n\");\n\t\tgoto error;\n\t}\n\n\tif (!jas_safe_size_mul3(info->width, info->height, info->numplanes,\n\t &num_samples)) {\n\t\tjas_eprintf(\"image size too large\\n\");\n\t\tgoto error;\n\t}\n\n\tif (opts.max_samples > 0 && num_samples > opts.max_samples) {\n\t\tjas_eprintf(\"maximum number of pixels exceeded (%zu)\\n\",\n\t\t opts.max_samples);\n\t\tgoto error;\n\t}\n\n\t/* Ensure that we support this type of BMP file. */\n\tif (!bmp_issupported(&hdr, info)) {\n\t\tjas_eprintf(\"error: unsupported BMP encoding\\n\");\n\t\tgoto error;\n\t}\n\n\t/* Skip over any useless data between the end of the palette\n\t and start of the bitmap data. */\n\tif ((n = hdr.off - (BMP_HDRLEN + BMP_INFOLEN + BMP_PALLEN(info))) < 0) {\n\t\tjas_eprintf(\"error: possibly bad bitmap offset?\\n\");\n\t\tgoto error;\n\t}\n\tif (n > 0) {\n\t\tjas_eprintf(\"skipping unknown data in BMP file\\n\");\n\t\tif (bmp_gobble(in, n)) {\n\t\t\tgoto error;\n\t\t}\n\t}\n\n\t/* Get the number of components. */\n\tnumcmpts = bmp_numcmpts(info);\n\n\tfor (cmptno = 0, cmptparm = cmptparms; cmptno < numcmpts; ++cmptno,\n\t ++cmptparm) {\n\t\tcmptparm->tlx = 0;\n\t\tcmptparm->tly = 0;\n\t\tcmptparm->hstep = 1;\n\t\tcmptparm->vstep = 1;\n\t\tcmptparm->width = info->width;\n\t\tcmptparm->height = info->height;\n\t\tcmptparm->prec = 8;\n\t\tcmptparm->sgnd = false;\n\t}\n\n\t/* Create image object. */\n\tif (!(image = jas_image_create(numcmpts, cmptparms,\n\t JAS_CLRSPC_UNKNOWN))) {\n\t\tgoto error;\n\t}\n\n\tif (numcmpts == 3) {\n\t\tjas_image_setclrspc(image, JAS_CLRSPC_SRGB);\n\t\tjas_image_setcmpttype(image, 0,\n\t\t JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_R));\n\t\tjas_image_setcmpttype(image, 1,\n\t\t JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_G));\n\t\tjas_image_setcmpttype(image, 2,\n\t\t JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_B));\n\t} else {\n\t\tjas_image_setclrspc(image, JAS_CLRSPC_SGRAY);\n\t\tjas_image_setcmpttype(image, 0,\n\t\t JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_GRAY_Y));\n\t}\n\n\t/* Read the bitmap data. */\n\tif (bmp_getdata(in, info, image)) {\n\t\tgoto error;\n\t}\n\n\tbmp_info_destroy(info);\n\n\treturn image;\n\nerror:\n\tif (info) {\n\t\tbmp_info_destroy(info);\n\t}\n\tif (image) {\n\t\tjas_image_destroy(image);\n\t}\n\treturn 0;\n}", "label": 1, "label_name": "safe"} -{"code": " public static function referenceFixtures() {\n return array(\n 'campaign' => array ('Campaign', '.CampaignMailingBehaviorTest'),\n 'lists' => 'X2List',\n 'credentials' => 'Credentials',\n 'users' => 'User',\n 'profile' => array('Profile','.marketing')\n );\n }", "label": 0, "label_name": "vulnerable"} -{"code": " return $fa->nameGlyph($icons, 'icon-');\r\n }\r\n } else {\r\n return array();\r\n }\r\n }\r", "label": 0, "label_name": "vulnerable"} -{"code": " def test_escape_backtick\n assert_equal \"\\\\`\", escape_javascript(\"`\")\n end", "label": 1, "label_name": "safe"} -{"code": " public void testHeaderNameEndsWithControlChar1d() {\n testHeaderNameEndsWithControlChar(0x1d);\n }", "label": 1, "label_name": "safe"} -{"code": "def guest_only(view_func):\n # TODO: test!\n @wraps(view_func)\n def wrapper(request, *args, **kwargs):\n if request.user.is_authenticated:\n return redirect(request.GET.get('next', request.user.st.get_absolute_url()))\n\n return view_func(request, *args, **kwargs)\n\n return wrapper", "label": 0, "label_name": "vulnerable"} -{"code": "_PyObject_ArenaMalloc(void *ctx, size_t size)\n{\n return malloc(size);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "\t\t\tcustomColsBuild = function() {\n\t\t\t\tvar customCols = '';\n\t\t\t\tvar columns = fm.options.uiOptions.cwd.listView.columns;\n\t\t\t\tfor (var i = 0; i < columns.length; i++) {\n\t\t\t\t\tcustomCols += '{' + columns[i] + '}';\n\t\t\t\t}\n\t\t\t\treturn customCols;\n\t\t\t},", "label": 0, "label_name": "vulnerable"} -{"code": "function enableCurrency(e) {\n var button = $(e.currentTarget);\n var currencyId = parseInt(button.data('id'));\n\n $.post(enableCurrencyUrl, {\n _token: token,\n id: currencyId\n }).done(function (data) {\n // lame but it works\n location.reload();\n }).fail(function () {\n console.error('I failed :(');\n });\n return false;\n}", "label": 1, "label_name": "safe"} -{"code": "get_strings_2_svc(gstrings_arg *arg, struct svc_req *rqstp)\n{\n static gstrings_ret ret;\n char *prime_arg;\n gss_buffer_desc client_name = GSS_C_EMPTY_BUFFER;\n gss_buffer_desc service_name = GSS_C_EMPTY_BUFFER;\n OM_uint32 minor_stat;\n kadm5_server_handle_t handle;\n const char *errmsg = NULL;\n\n xdr_free(xdr_gstrings_ret, &ret);\n\n if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle)))\n goto exit_func;\n\n if ((ret.code = check_handle((void *)handle)))\n goto exit_func;\n\n ret.api_version = handle->api_version;\n\n if (setup_gss_names(rqstp, &client_name, &service_name) < 0) {\n ret.code = KADM5_FAILURE;\n goto exit_func;\n }\n if (krb5_unparse_name(handle->context, arg->princ, &prime_arg)) {\n ret.code = KADM5_BAD_PRINCIPAL;\n goto exit_func;\n }\n\n if (! cmp_gss_krb5_name(handle, rqst2name(rqstp), arg->princ) &&\n (CHANGEPW_SERVICE(rqstp) || !kadm5int_acl_check(handle->context,\n rqst2name(rqstp),\n ACL_INQUIRE,\n arg->princ,\n NULL))) {\n ret.code = KADM5_AUTH_GET;\n log_unauth(\"kadm5_get_strings\", prime_arg,\n &client_name, &service_name, rqstp);\n } else {\n ret.code = kadm5_get_strings((void *)handle, arg->princ, &ret.strings,\n &ret.count);\n if (ret.code != 0)\n errmsg = krb5_get_error_message(handle->context, ret.code);\n\n log_done(\"kadm5_get_strings\", prime_arg, errmsg,\n &client_name, &service_name, rqstp);\n\n if (errmsg != NULL)\n krb5_free_error_message(handle->context, errmsg);\n }\n free(prime_arg);\nexit_func:\n gss_release_buffer(&minor_stat, &client_name);\n gss_release_buffer(&minor_stat, &service_name);\n free_server_handle(handle);\n return &ret;\n}", "label": 1, "label_name": "safe"} -{"code": "flac_read_loop (SF_PRIVATE *psf, unsigned len)\n{\tFLAC_PRIVATE* pflac = (FLAC_PRIVATE*) psf->codec_data ;\n\n\tpflac->pos = 0 ;\n\tpflac->len = len ;\n\tpflac->remain = len ;\n\n\t/* First copy data that has already been decoded and buffered. */\n\tif (pflac->frame != NULL && pflac->bufferpos < pflac->frame->header.blocksize)\n\t\tflac_buffer_copy (psf) ;\n\n\t/* Decode some more. */\n\twhile (pflac->pos < pflac->len)\n\t{\tif (FLAC__stream_decoder_process_single (pflac->fsd) == 0)\n\t\t\tbreak ;\n\t\tif (FLAC__stream_decoder_get_state (pflac->fsd) >= FLAC__STREAM_DECODER_END_OF_STREAM)\n\t\t\tbreak ;\n\t\t} ;\n\n\tpflac->ptr = NULL ;\n\n\treturn pflac->pos ;\n} /* flac_read_loop */", "label": 0, "label_name": "vulnerable"} -{"code": "function phorum_htmlpurifier_common()\n{\n require_once(dirname(__FILE__).'/htmlpurifier/HTMLPurifier.auto.php');\n require(dirname(__FILE__).'/init-config.php');\n\n $config = phorum_htmlpurifier_get_config();\n HTMLPurifier::getInstance($config);\n\n // increment revision.txt if you want to invalidate the cache\n $GLOBALS['PHORUM']['mod_htmlpurifier']['body_cache_serial'] = $config->getSerial();\n\n // load migration\n if (file_exists(dirname(__FILE__) . '/migrate.php')) {\n include(dirname(__FILE__) . '/migrate.php');\n } else {\n echo 'Error: No migration path specified for HTML Purifier, please check\n modes/htmlpurifier/migrate.bbcode.php for instructions on\n how to migrate from your previous markup language.';\n exit;\n }\n\n if (!function_exists('phorum_htmlpurifier_migrate')) {\n // Dummy function\n function phorum_htmlpurifier_migrate($data) {return $data;}\n }\n\n}", "label": 1, "label_name": "safe"} -{"code": "def test_get_frontend_context_variables_safe(component):\n # Set component.name to a potential XSS attack\n component.name = ''\n\n class Meta:\n safe = [\n \"name\",\n ]\n\n setattr(component, \"Meta\", Meta())\n\n frontend_context_variables = component.get_frontend_context_variables()\n frontend_context_variables_dict = orjson.loads(frontend_context_variables)\n assert len(frontend_context_variables_dict) == 1\n assert (\n frontend_context_variables_dict.get(\"name\")\n == ''\n )", "label": 0, "label_name": "vulnerable"} -{"code": " def test_quotas_update_as_user(self):\n body = {'quota_class_set': {'instances': 50, 'cores': 50,\n 'ram': 51200, 'volumes': 10,\n 'gigabytes': 1000, 'floating_ips': 10,\n 'metadata_items': 128, 'injected_files': 5,\n 'injected_file_content_bytes': 10240}}\n\n req = fakes.HTTPRequest.blank(\n '/v2/fake4/os-quota-class-sets/test_class')\n self.assertRaises(webob.exc.HTTPForbidden, self.controller.update,\n req, 'test_class', body)", "label": 0, "label_name": "vulnerable"} -{"code": " public void testUri() {\n final HttpHeadersBase headers = newHttp2Headers();\n assertThat(headers.uri()).isEqualTo(URI.create(\"https://netty.io/index.html\"));\n }", "label": 0, "label_name": "vulnerable"} -{"code": "func (m *SizeMessage) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowSizeunderscore\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: SizeMessage: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: SizeMessage: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Size_\", wireType)\n\t\t\t}\n\t\t\tvar v int64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowSizeunderscore\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tv |= int64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tm.Size_ = &v\n\t\tcase 2:\n\t\t\tif wireType != 0 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Equal_\", wireType)\n\t\t\t}\n\t\t\tvar v int\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowSizeunderscore\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tv |= int(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tb := bool(v != 0)\n\t\t\tm.Equal_ = &b\n\t\tcase 3:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field String_\", wireType)\n\t\t\t}\n\t\t\tvar stringLen uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowSizeunderscore\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tintStringLen := int(stringLen)\n\t\t\tif intStringLen < 0 {\n\t\t\t\treturn ErrInvalidLengthSizeunderscore\n\t\t\t}\n\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthSizeunderscore\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\ts := string(dAtA[iNdEx:postIndex])\n\t\t\tm.String_ = &s\n\t\t\tiNdEx = postIndex\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipSizeunderscore(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthSizeunderscore\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 1, "label_name": "safe"} -{"code": "static inline u32 net_hash_mix(const struct net *net)\n{\n\treturn net->hash_mix;\n}", "label": 1, "label_name": "safe"} -{"code": " def edit_timecard\n Log.add_info(request, params.inspect)\n\n date_s = params[:date]\n\n if date_s.nil? or date_s.empty?\n @date = Date.today\n date_s = @date.strftime(Schedule::SYS_DATE_FORM)\n else\n @date = Date.parse(date_s)\n end\n\n @timecard = Timecard.get_for(@login_user.id, date_s)\n\n render(:partial => 'timecard', :layout => false)\n end", "label": 0, "label_name": "vulnerable"} -{"code": "SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count)\n{\n\tconst char *sysinfo_table[] = {\n\t\tutsname()->sysname,\n\t\tutsname()->nodename,\n\t\tutsname()->release,\n\t\tutsname()->version,\n\t\tutsname()->machine,\n\t\t\"alpha\",\t/* instruction set architecture */\n\t\t\"dummy\",\t/* hardware serial number */\n\t\t\"dummy\",\t/* hardware manufacturer */\n\t\t\"dummy\",\t/* secure RPC domain */\n\t};\n\tunsigned long offset;\n\tconst char *res;\n\tlong len, err = -EINVAL;\n\n\toffset = command-1;\n\tif (offset >= ARRAY_SIZE(sysinfo_table)) {\n\t\t/* Digital UNIX has a few unpublished interfaces here */\n\t\tprintk(\"sysinfo(%d)\", command);\n\t\tgoto out;\n\t}\n\n\tdown_read(&uts_sem);\n\tres = sysinfo_table[offset];\n\tlen = strlen(res)+1;\n\tif ((unsigned long)len > (unsigned long)count)\n\t\tlen = count;\n\tif (copy_to_user(buf, res, len))\n\t\terr = -EFAULT;\n\telse\n\t\terr = 0;\n\tup_read(&uts_sem);\n out:\n\treturn err;\n}", "label": 1, "label_name": "safe"} -{"code": " public function getCardReference()\n {\n if (isset($this->data['object']) && 'customer' === $this->data['object']) {\n if (!empty($this->data['default_card'])) {\n return $this->data['default_card'];\n }\n if (!empty($this->data['id'])) {\n return $this->data['id'];\n }\n }\n if (isset($this->data['object']) && 'card' === $this->data['object']) {\n if (!empty($this->data['id'])) {\n return $this->data['id'];\n }\n }\n if (isset($this->data['object']) && 'charge' === $this->data['object']) {\n if (! empty($this->data['source'])) {\n if (! empty($this->data['source']['id'])) {\n return $this->data['source']['id'];\n }\n }\n }\n\n return;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\t\tdm.setSize = function (width, height) {\n\t\t\tif (dmIframe) {\n\t\t\t\tdmIframe.width = width;\n\t\t\t\tdmIframe.height = height;\n\t\t\t}\n\t\t};", "label": 0, "label_name": "vulnerable"} -{"code": "static bool dccp_new(struct nf_conn *ct, const struct sk_buff *skb,\n\t\t unsigned int dataoff, unsigned int *timeouts)\n{\n\tstruct net *net = nf_ct_net(ct);\n\tstruct dccp_net *dn;\n\tstruct dccp_hdr _dh, *dh;\n\tconst char *msg;\n\tu_int8_t state;\n\n\tdh = skb_header_pointer(skb, dataoff, sizeof(_dh), &dh);\n\tBUG_ON(dh == NULL);\n\n\tstate = dccp_state_table[CT_DCCP_ROLE_CLIENT][dh->dccph_type][CT_DCCP_NONE];\n\tswitch (state) {\n\tdefault:\n\t\tdn = dccp_pernet(net);\n\t\tif (dn->dccp_loose == 0) {\n\t\t\tmsg = \"nf_ct_dccp: not picking up existing connection \";\n\t\t\tgoto out_invalid;\n\t\t}\n\tcase CT_DCCP_REQUEST:\n\t\tbreak;\n\tcase CT_DCCP_INVALID:\n\t\tmsg = \"nf_ct_dccp: invalid state transition \";\n\t\tgoto out_invalid;\n\t}\n\n\tct->proto.dccp.role[IP_CT_DIR_ORIGINAL] = CT_DCCP_ROLE_CLIENT;\n\tct->proto.dccp.role[IP_CT_DIR_REPLY] = CT_DCCP_ROLE_SERVER;\n\tct->proto.dccp.state = CT_DCCP_NONE;\n\tct->proto.dccp.last_pkt = DCCP_PKT_REQUEST;\n\tct->proto.dccp.last_dir = IP_CT_DIR_ORIGINAL;\n\tct->proto.dccp.handshake_seq = 0;\n\treturn true;\n\nout_invalid:\n\tif (LOG_INVALID(net, IPPROTO_DCCP))\n\t\tnf_log_packet(net, nf_ct_l3num(ct), 0, skb, NULL, NULL,\n\t\t\t NULL, \"%s\", msg);\n\treturn false;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "static void pcrypt_free(struct crypto_instance *inst)\n{\n\tstruct pcrypt_instance_ctx *ctx = crypto_instance_ctx(inst);\n\n\tcrypto_drop_aead(&ctx->spawn);\n\tkfree(inst);\n}", "label": 0, "label_name": "vulnerable"} -{"code": " void getWithDefaultValueWorks() {\n final HttpHeadersBase headers = newEmptyHeaders();\n headers.add(\"name1\", \"value1\");\n\n assertThat(headers.get(\"name1\", \"defaultvalue\")).isEqualTo(\"value1\");\n assertThat(headers.get(\"noname\", \"defaultvalue\")).isEqualTo(\"defaultvalue\");\n }", "label": 1, "label_name": "safe"} -{"code": " it 'installs the right package' do\n pp = <<-EOS\n class { 'ntp':\n package_ensure => present,\n package_name => ['#{packagename}'],\n }\n EOS\n apply_manifest(pp, :catch_failures => true)\n end\n\n describe package(packagename) do\n it { should be_installed }\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": "spell_add_word(\n char_u\t*word,\n int\t\tlen,\n int\t\twhat,\t // SPELL_ADD_ values\n int\t\tidx,\t // \"zG\" and \"zW\": zero, otherwise index in\n\t\t\t // 'spellfile'\n int\t\tundo)\t // TRUE for \"zug\", \"zuG\", \"zuw\" and \"zuW\"\n{\n FILE\t*fd = NULL;\n buf_T\t*buf = NULL;\n int\t\tnew_spf = FALSE;\n char_u\t*fname;\n char_u\t*fnamebuf = NULL;\n char_u\tline[MAXWLEN * 2];\n long\tfpos, fpos_next = 0;\n int\t\ti;\n char_u\t*spf;\n\n if (!valid_spell_word(word))\n {\n\temsg(_(e_illegal_character_in_word));\n\treturn;\n }\n\n if (idx == 0)\t // use internal wordlist\n {\n\tif (int_wordlist == NULL)\n\t{\n\t int_wordlist = vim_tempname('s', FALSE);\n\t if (int_wordlist == NULL)\n\t\treturn;\n\t}\n\tfname = int_wordlist;\n }\n else\n {\n\t// If 'spellfile' isn't set figure out a good default value.\n\tif (*curwin->w_s->b_p_spf == NUL)\n\t{\n\t init_spellfile();\n\t new_spf = TRUE;\n\t}\n\n\tif (*curwin->w_s->b_p_spf == NUL)\n\t{\n\t semsg(_(e_option_str_is_not_set), \"spellfile\");\n\t return;\n\t}\n\tfnamebuf = alloc(MAXPATHL);\n\tif (fnamebuf == NULL)\n\t return;\n\n\tfor (spf = curwin->w_s->b_p_spf, i = 1; *spf != NUL; ++i)\n\t{\n\t copy_option_part(&spf, fnamebuf, MAXPATHL, \",\");\n\t if (i == idx)\n\t\tbreak;\n\t if (*spf == NUL)\n\t {\n\t\tsemsg(_(e_spellfile_does_not_have_nr_entries), idx);\n\t\tvim_free(fnamebuf);\n\t\treturn;\n\t }\n\t}\n\n\t// Check that the user isn't editing the .add file somewhere.\n\tbuf = buflist_findname_exp(fnamebuf);\n\tif (buf != NULL && buf->b_ml.ml_mfp == NULL)\n\t buf = NULL;\n\tif (buf != NULL && bufIsChanged(buf))\n\t{\n\t emsg(_(e_file_is_loaded_in_another_buffer));\n\t vim_free(fnamebuf);\n\t return;\n\t}\n\n\tfname = fnamebuf;\n }\n\n if (what == SPELL_ADD_BAD || undo)\n {\n\t// When the word appears as good word we need to remove that one,\n\t// since its flags sort before the one with WF_BANNED.\n\tfd = mch_fopen((char *)fname, \"r\");\n\tif (fd != NULL)\n\t{\n\t while (!vim_fgets(line, MAXWLEN * 2, fd))\n\t {\n\t\tfpos = fpos_next;\n\t\tfpos_next = ftell(fd);\n\t\tif (fpos_next < 0)\n\t\t break; // should never happen\n\t\tif (STRNCMP(word, line, len) == 0\n\t\t\t&& (line[len] == '/' || line[len] < ' '))\n\t\t{\n\t\t // Found duplicate word. Remove it by writing a '#' at\n\t\t // the start of the line. Mixing reading and writing\n\t\t // doesn't work for all systems, close the file first.\n\t\t fclose(fd);\n\t\t fd = mch_fopen((char *)fname, \"r+\");\n\t\t if (fd == NULL)\n\t\t\tbreak;\n\t\t if (fseek(fd, fpos, SEEK_SET) == 0)\n\t\t {\n\t\t\tfputc('#', fd);\n\t\t\tif (undo)\n\t\t\t{\n\t\t\t home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE);\n\t\t\t smsg(_(\"Word '%.*s' removed from %s\"),\n\t\t\t\t\t\t\t len, word, NameBuff);\n\t\t\t}\n\t\t }\n\t\t if (fseek(fd, fpos_next, SEEK_SET) != 0)\n\t\t {\n\t\t\tPERROR(_(\"Seek error in spellfile\"));\n\t\t\tbreak;\n\t\t }\n\t\t}\n\t }\n\t if (fd != NULL)\n\t\tfclose(fd);\n\t}\n }\n\n if (!undo)\n {\n\tfd = mch_fopen((char *)fname, \"a\");\n\tif (fd == NULL && new_spf)\n\t{\n\t char_u *p;\n\n\t // We just initialized the 'spellfile' option and can't open the\n\t // file. We may need to create the \"spell\" directory first. We\n\t // already checked the runtime directory is writable in\n\t // init_spellfile().\n\t if (!dir_of_file_exists(fname) && (p = gettail_sep(fname)) != fname)\n\t {\n\t\tint c = *p;\n\n\t\t// The directory doesn't exist. Try creating it and opening\n\t\t// the file again.\n\t\t*p = NUL;\n\t\tvim_mkdir(fname, 0755);\n\t\t*p = c;\n\t\tfd = mch_fopen((char *)fname, \"a\");\n\t }\n\t}\n\n\tif (fd == NULL)\n\t semsg(_(e_cant_open_file_str), fname);\n\telse\n\t{\n\t if (what == SPELL_ADD_BAD)\n\t\tfprintf(fd, \"%.*s/!\\n\", len, word);\n\t else if (what == SPELL_ADD_RARE)\n\t\tfprintf(fd, \"%.*s/?\\n\", len, word);\n\t else\n\t\tfprintf(fd, \"%.*s\\n\", len, word);\n\t fclose(fd);\n\n\t home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE);\n\t smsg(_(\"Word '%.*s' added to %s\"), len, word, NameBuff);\n\t}\n }\n\n if (fd != NULL)\n {\n\t// Update the .add.spl file.\n\tmkspell(1, &fname, FALSE, TRUE, TRUE);\n\n\t// If the .add file is edited somewhere, reload it.\n\tif (buf != NULL)\n\t buf_reload(buf, buf->b_orig_mode, FALSE);\n\n\tredraw_all_later(SOME_VALID);\n }\n vim_free(fnamebuf);\n}", "label": 1, "label_name": "safe"} -{"code": "def create_class_from_xml_string(target_class, xml_string):\n \"\"\"Creates an instance of the target class from a string.\n\n :param target_class: The class which will be instantiated and populated\n with the contents of the XML. This class must have a c_tag and a\n c_namespace class variable.\n :param xml_string: A string which contains valid XML. The root element\n of the XML string should match the tag and namespace of the desired\n class.\n\n :return: An instance of the target class with members assigned according to\n the contents of the XML - or None if the root XML tag and namespace did\n not match those of the target class.\n \"\"\"\n if not isinstance(xml_string, six.binary_type):\n xml_string = xml_string.encode('utf-8')\n tree = ElementTree.fromstring(xml_string)\n return create_class_from_element_tree(target_class, tree)", "label": 0, "label_name": "vulnerable"} -{"code": " public function testWithPortCannotBeZero()\n {\n (new Uri())->withPort(0);\n }", "label": 1, "label_name": "safe"} -{"code": "this.init=function(){function G(H){if(null!=H){var S=H.getAttribute(\"background\");if(null==S||\"\"==S||S==mxConstants.NONE)S=Editor.isDarkMode()?\"transparent\":\"#ffffff\";B.style.backgroundColor=S;(new mxCodec(H.ownerDocument)).decode(H,I.getModel());I.maxFitScale=1;I.fit(8);I.center()}return H}function P(H){null!=H&&(H=G(Editor.parseDiagramNode(H)));return H}mxEvent.addListener(E,\"change\",function(H){z=parseInt(E.value);P(L[z]);mxEvent.consume(H)});if(\"mxfile\"==t.nodeName){var J=t.getElementsByTagName(\"diagram\");", "label": 1, "label_name": "safe"} -{"code": " public function __construct($config) {\n $def = $config->getCSSDefinition();\n $this->info['font-style'] = $def->info['font-style'];\n $this->info['font-variant'] = $def->info['font-variant'];\n $this->info['font-weight'] = $def->info['font-weight'];\n $this->info['font-size'] = $def->info['font-size'];\n $this->info['line-height'] = $def->info['line-height'];\n $this->info['font-family'] = $def->info['font-family'];\n }", "label": 1, "label_name": "safe"} -{"code": "\t\t\tupdateFunc = function( i, contexts, values ) {\n\t\t\t\treturn function( value ) {\n\t\t\t\t\tcontexts[ i ] = this;\n\t\t\t\t\tvalues[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;\n\t\t\t\t\tif ( values === progressValues ) {\n\t\t\t\t\t\tdeferred.notifyWith( contexts, values );\n\t\t\t\t\t} else if ( !( --remaining ) ) {\n\t\t\t\t\t\tdeferred.resolveWith( contexts, values );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},", "label": 1, "label_name": "safe"} -{"code": "exports.watch = function(files, fn){\n var options = { interval: 100 };\n files.forEach(function(file){\n debug('file %s', file);\n fs.watchFile(file, options, function(curr, prev){\n if (prev.mtime < curr.mtime) fn(file);\n });\n });\n};", "label": 0, "label_name": "vulnerable"} -{"code": " def generation_time\n ::Time.at(to_bson.unpack(\"N\")[0]).utc\n end", "label": 1, "label_name": "safe"} -{"code": "static int __init pcd_init(void)\n{\n\tstruct pcd_unit *cd;\n\tint unit;\n\n\tif (disable)\n\t\treturn -EINVAL;\n\n\tpcd_init_units();\n\n\tif (pcd_detect())\n\t\treturn -ENODEV;\n\n\t/* get the atapi capabilities page */\n\tpcd_probe_capabilities();\n\n\tif (register_blkdev(major, name)) {\n\t\tfor (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {\n\t\t\tif (!cd->disk)\n\t\t\t\tcontinue;\n\n\t\t\tblk_cleanup_queue(cd->disk->queue);\n\t\t\tblk_mq_free_tag_set(&cd->tag_set);\n\t\t\tput_disk(cd->disk);\n\t\t}\n\t\treturn -EBUSY;\n\t}\n\n\tfor (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) {\n\t\tif (cd->present) {\n\t\t\tregister_cdrom(&cd->info);\n\t\t\tcd->disk->private_data = cd;\n\t\t\tadd_disk(cd->disk);\n\t\t}\n\t}\n\n\treturn 0;\n}", "label": 1, "label_name": "safe"} -{"code": "void mlock_vma_page(struct page *page)\n{\n\t/* Serialize with page migration */\n\tBUG_ON(!PageLocked(page));\n\n\tif (!TestSetPageMlocked(page)) {\n\t\tmod_zone_page_state(page_zone(page), NR_MLOCK,\n\t\t\t\t hpage_nr_pages(page));\n\t\tcount_vm_event(UNEVICTABLE_PGMLOCKED);\n\t\tif (!isolate_lru_page(page))\n\t\t\tputback_lru_page(page);\n\t}\n}", "label": 1, "label_name": "safe"} -{"code": "TEST(BasicInterpreter, AllocateTwice) {\n Interpreter interpreter;\n ASSERT_EQ(interpreter.AddTensors(2), kTfLiteOk);\n ASSERT_EQ(interpreter.SetInputs({0}), kTfLiteOk);\n ASSERT_EQ(interpreter.SetOutputs({1}), kTfLiteOk);\n\n TfLiteQuantizationParams quantized;\n ASSERT_EQ(interpreter.SetTensorParametersReadWrite(0, kTfLiteFloat32, \"\", {3},\n quantized),\n kTfLiteOk);\n ASSERT_EQ(interpreter.SetTensorParametersReadWrite(1, kTfLiteFloat32, \"\", {3},\n quantized),\n kTfLiteOk);\n\n TfLiteRegistration reg = {nullptr, nullptr, nullptr, nullptr};\n reg.prepare = [](TfLiteContext* context, TfLiteNode* node) {\n const TfLiteTensor* tensor0;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 0, &tensor0));\n TfLiteTensor* tensor1;\n TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, 0, &tensor1));\n TfLiteIntArray* newSize = TfLiteIntArrayCopy(tensor0->dims);\n return context->ResizeTensor(context, tensor1, newSize);\n };\n reg.invoke = [](TfLiteContext* context, TfLiteNode* node) {\n const TfLiteTensor* a0;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 0, &a0));\n TfLiteTensor* a1;\n TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, 0, &a1));\n int num = a0->dims->data[0];\n for (int i = 0; i < num; i++) {\n a1->data.f[i] = a0->data.f[i];\n }\n return kTfLiteOk;\n };\n ASSERT_EQ(\n interpreter.AddNodeWithParameters({0}, {1}, nullptr, 0, nullptr, ®),\n kTfLiteOk);\n ASSERT_EQ(interpreter.ResizeInputTensor(0, {3}), kTfLiteOk);\n ASSERT_EQ(interpreter.AllocateTensors(), kTfLiteOk);\n ASSERT_EQ(interpreter.Invoke(), kTfLiteOk);\n char* old_tensor0_ptr = interpreter.tensor(0)->data.raw;\n char* old_tensor1_ptr = interpreter.tensor(1)->data.raw;\n\n ASSERT_EQ(interpreter.AllocateTensors(), kTfLiteOk);\n ASSERT_EQ(interpreter.Invoke(), kTfLiteOk);\n ASSERT_EQ(old_tensor0_ptr, interpreter.tensor(0)->data.raw);\n ASSERT_EQ(old_tensor1_ptr, interpreter.tensor(1)->data.raw);\n}", "label": 1, "label_name": "safe"} -{"code": "a._.elementsPath&&(b=a._.elementsPath.filters)&&b.push(function(b){var i=b.getName(),e=k[i]||!1;\"link\"==e&&0===b.getAttribute(\"href\").indexOf(\"mailto:\")?e=\"email\":\"span\"==i?b.getStyle(\"font-size\")?e=\"size\":b.getStyle(\"color\")&&(e=\"color\"):\"img\"==e&&(b=b.data(\"cke-saved-src\")||b.getAttribute(\"src\"))&&0===b.indexOf(a.config.smiley_path)&&(e=\"smiley\");return e})}})})();CKEDITOR.config.plugins='dialogui,dialog,a11yhelp,basicstyles,blockquote,clipboard,panel,floatpanel,menu,contextmenu,resize,button,toolbar,elementspath,enterkey,entities,popup,filebrowser,floatingspace,listblock,richcombo,format,horizontalrule,htmlwriter,wysiwygarea,image,indent,indentlist,fakeobjects,link,list,magicline,maximize,pastetext,pastefromword,removeformat,sourcearea,specialchar,menubutton,scayt,stylescombo,tab,table,tabletools,undo,wsc,bbcode';CKEDITOR.config.skin='moono';(function() {var setIcons = function(icons, strip) {var path = CKEDITOR.getUrl( 'plugins/' + strip );icons = icons.split( ',' );for ( var i = 0; i < icons.length; i++ )CKEDITOR.skin.icons[ icons[ i ] ] = { path: path, offset: -icons[ ++i ], bgsize : icons[ ++i ] };};if (CKEDITOR.env.hidpi) setIcons('bold,0,,italic,24,,strike,48,,subscript,72,,superscript,96,,underline,120,,blockquote,144,,copy-rtl,168,,copy,192,,cut-rtl,216,,cut,240,,paste-rtl,264,,paste,288,,horizontalrule,312,,image,336,,indent-rtl,360,,indent,384,,outdent-rtl,408,,outdent,432,,anchor-rtl,456,,anchor,480,,link,504,,unlink,528,,bulletedlist-rtl,552,,bulletedlist,576,,numberedlist-rtl,600,,numberedlist,624,,maximize,648,,pastetext-rtl,672,,pastetext,696,,pastefromword-rtl,720,,pastefromword,744,,removeformat,768,,source-rtl,792,,source,816,,specialchar,840,,scayt,864,,table,888,,redo-rtl,912,,redo,936,,undo-rtl,960,,undo,984,,spellchecker,1008,','icons_hidpi.png');else setIcons('bold,0,auto,italic,24,auto,strike,48,auto,subscript,72,auto,superscript,96,auto,underline,120,auto,blockquote,144,auto,copy-rtl,168,auto,copy,192,auto,cut-rtl,216,auto,cut,240,auto,paste-rtl,264,auto,paste,288,auto,horizontalrule,312,auto,image,336,auto,indent-rtl,360,auto,indent,384,auto,outdent-rtl,408,auto,outdent,432,auto,anchor-rtl,456,auto,anchor,480,auto,link,504,auto,unlink,528,auto,bulletedlist-rtl,552,auto,bulletedlist,576,auto,numberedlist-rtl,600,auto,numberedlist,624,auto,maximize,648,auto,pastetext-rtl,672,auto,pastetext,696,auto,pastefromword-rtl,720,auto,pastefromword,744,auto,removeformat,768,auto,source-rtl,792,auto,source,816,auto,specialchar,840,auto,scayt,864,auto,table,888,auto,redo-rtl,912,auto,redo,936,auto,undo-rtl,960,auto,undo,984,auto,spellchecker,1008,auto','icons.png');})();CKEDITOR.lang.languages={\"en\":1,\"de\":1};}());", "label": 1, "label_name": "safe"} -{"code": " public function handleEnd(&$token)\n {\n if ($token->markForDeletion) {\n $token = false;\n }\n }", "label": 1, "label_name": "safe"} -{"code": "CKEDITOR.env.version<11?a[g].$.styleSheet.cssText=a[g].$.styleSheet.cssText+f:a[g].$.innerHTML=a[g].$.innerHTML+f}}var g={};CKEDITOR.skin={path:a,loadPart:function(c,d){CKEDITOR.skin.name!=CKEDITOR.skinName.split(\",\")[0]?CKEDITOR.scriptLoader.load(CKEDITOR.getUrl(a()+\"skin.js\"),function(){b(c,d)}):b(c,d)},getPath:function(a){return CKEDITOR.getUrl(e(a))},icons:{},addIcon:function(a,b,c,d){a=a.toLowerCase();this.icons[a]||(this.icons[a]={path:b,offset:c||0,bgsize:d||\"16px\"})},getIconStyle:function(a,", "label": 1, "label_name": "safe"} -{"code": " it 'finds ipv6' do\n shell(\"mysql -NBe \\\"SHOW GRANTS FOR 'test'@'2607:f0d0:1002:0051:0000:0000:0000:0004'\\\"\") do |r|\n expect(r.stdout).to match(/GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'2607:f0d0:1002:0051:0000:0000:0000:0004'/)\n expect(r.stderr).to be_empty\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": "!function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var u=\"function\"==typeof require&&require;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var l=new Error(\"Cannot find module '\"+o+\"'\");throw l.code=\"MODULE_NOT_FOUND\",l}var d=n[o]={exports:{}};t[o][0].call(d.exports,function(e){var n=t[o][1][e];return i(n||e)},d,d.exports,e,t,n,r)}return n[o].exports}for(var a=\"function\"==typeof require&&require,o=0;ogetTask();\n $subtask = $this->getSubtask();\n\n $this->response->html($this->template->render('subtask_restriction/show', array(\n 'status_list' => array(\n SubtaskModel::STATUS_TODO => t('Todo'),\n SubtaskModel::STATUS_DONE => t('Done'),\n ),\n 'subtask_inprogress' => $this->subtaskStatusModel->getSubtaskInProgress($this->userSession->getId()),\n 'subtask' => $subtask,\n 'task' => $task,\n )));\n }", "label": 0, "label_name": "vulnerable"} -{"code": " it 'lstrips strings' do\n pp = <<-EOS\n $a = \" blowzy night-frumps vex'd jack q \"\n $o = lstrip($a)\n notice(inline_template('lstrip is <%= @o.inspect %>'))\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/lstrip is \"blowzy night-frumps vex'd jack q \"/)\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": " def create_q_page\n Log.add_info(request, params.inspect)\n\n return unless request.post?\n\n @tmpl_folder, @tmpl_q_folder = TemplatesHelper.get_tmpl_subfolder(TemplatesHelper::TMPL_RESEARCH)\n\n unless @tmpl_q_folder.nil?\n\n @items = Folder.get_items_admin(@tmpl_q_folder.id, 'xorder ASC')\n\n if !@items.nil? and @items.length >= ResearchesHelper::MAX_PAGES\n flash[:notice] = 'ERROR:' + t('research.max_pages')\n render(:partial => 'ajax_q_page', :layout => false)\n return\n end\n\n item = Item.new_research(@tmpl_q_folder.id)\n item.title = t('research.new_page')\n item.user_id = 0\n item.save!\n\n @items << item\n\n else\n Log.add_error(request, nil, '/'+TemplatesHelper::TMPL_ROOT+'/'+TemplatesHelper::TMPL_RESEARCH+' NOT found!')\n end\n\n render(:partial => 'ajax_q_page', :layout => false)\n end", "label": 1, "label_name": "safe"} -{"code": "function(K){l=K};this.setAutoScroll=function(K){p=K};this.setOpenFill=function(K){q=K};this.setStopClickEnabled=function(K){A=K};this.setSelectInserted=function(K){B=K};this.setSmoothing=function(K){f=K};this.setPerfectFreehandMode=function(K){O=K};this.setBrushSize=function(K){I.size=K};this.getBrushSize=function(){return I.size};var t=function(K){y=K;b.getRubberband().setEnabled(!K);b.graphHandler.setSelectEnabled(!K);b.graphHandler.setMoveEnabled(!K);b.container.style.cursor=K?\"crosshair\":\"\";b.fireEvent(new mxEventObject(\"freehandStateChanged\"))};", "label": 0, "label_name": "vulnerable"} -{"code": "func (svc *Service) ListUsers(ctx context.Context, opt fleet.UserListOptions) ([]*fleet.User, error) {\n\tuser := &fleet.User{}\n\tif opt.TeamID != 0 {\n\t\tuser.Teams = []fleet.UserTeam{{Team: fleet.Team{ID: opt.TeamID}}}\n\t}\n\tif err := svc.authz.Authorize(ctx, user, fleet.ActionRead); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn svc.ds.ListUsers(ctx, opt)\n}", "label": 1, "label_name": "safe"} -{"code": "cssp_read_tsrequest(STREAM token, STREAM pubkey)\n{\n\tSTREAM s;\n\tint length;\n\tint tagval;\n\n\ts = tcp_recv(NULL, 4);\n\n\tif (s == NULL)\n\t\treturn False;\n\n\t// verify ASN.1 header\n\tif (s->p[0] != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t{\n\t\tlogger(Protocol, Error,\n\t\t \"cssp_read_tsrequest(), expected BER_TAG_SEQUENCE|BER_TAG_CONSTRUCTED, got %x\",\n\t\t s->p[0]);\n\t\treturn False;\n\t}\n\n\t// peek at first 4 bytes to get full message length\n\tif (s->p[1] < 0x80)\n\t\tlength = s->p[1] - 2;\n\telse if (s->p[1] == 0x81)\n\t\tlength = s->p[2] - 1;\n\telse if (s->p[1] == 0x82)\n\t\tlength = (s->p[2] << 8) | s->p[3];\n\telse\n\t\treturn False;\n\n\t// receive the remainings of message\n\ts = tcp_recv(s, length);\n\n\t// parse the response and into nego token\n\tif (!ber_in_header(s, &tagval, &length) ||\n\t tagval != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t\treturn False;\n\n\t// version [0]\n\tif (!ber_in_header(s, &tagval, &length) ||\n\t tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 0))\n\t\treturn False;\n\tin_uint8s(s, length);\n\n\t// negoToken [1]\n\tif (token)\n\t{\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 1))\n\t\t\treturn False;\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t\t\treturn False;\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_SEQUENCE | BER_TAG_CONSTRUCTED))\n\t\t\treturn False;\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 0))\n\t\t\treturn False;\n\n\t\tif (!ber_in_header(s, &tagval, &length) || tagval != BER_TAG_OCTET_STRING)\n\t\t\treturn False;\n\n\t\ttoken->end = token->p = token->data;\n\t\tout_uint8p(token, s->p, length);\n\t\ts_mark_end(token);\n\t}\n\n\t// pubKey [3]\n\tif (pubkey)\n\t{\n\t\tif (!ber_in_header(s, &tagval, &length)\n\t\t || tagval != (BER_TAG_CTXT_SPECIFIC | BER_TAG_CONSTRUCTED | 3))\n\t\t\treturn False;\n\n\t\tif (!ber_in_header(s, &tagval, &length) || tagval != BER_TAG_OCTET_STRING)\n\t\t\treturn False;\n\n\t\tpubkey->data = pubkey->p = s->p;\n\t\tpubkey->end = pubkey->data + length;\n\t\tpubkey->size = length;\n\t}\n\n\n\treturn True;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "static int pppol2tp_setsockopt(struct socket *sock, int level, int optname,\n\t\t\t char __user *optval, unsigned int optlen)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct l2tp_session *session;\n\tstruct l2tp_tunnel *tunnel;\n\tstruct pppol2tp_session *ps;\n\tint val;\n\tint err;\n\n\tif (level != SOL_PPPOL2TP)\n\t\treturn udp_prot.setsockopt(sk, level, optname, optval, optlen);\n\n\tif (optlen < sizeof(int))\n\t\treturn -EINVAL;\n\n\tif (get_user(val, (int __user *)optval))\n\t\treturn -EFAULT;\n\n\terr = -ENOTCONN;\n\tif (sk->sk_user_data == NULL)\n\t\tgoto end;\n\n\t/* Get session context from the socket */\n\terr = -EBADF;\n\tsession = pppol2tp_sock_to_session(sk);\n\tif (session == NULL)\n\t\tgoto end;\n\n\t/* Special case: if session_id == 0x0000, treat as operation on tunnel\n\t */\n\tps = l2tp_session_priv(session);\n\tif ((session->session_id == 0) &&\n\t (session->peer_session_id == 0)) {\n\t\terr = -EBADF;\n\t\ttunnel = l2tp_sock_to_tunnel(ps->tunnel_sock);\n\t\tif (tunnel == NULL)\n\t\t\tgoto end_put_sess;\n\n\t\terr = pppol2tp_tunnel_setsockopt(sk, tunnel, optname, val);\n\t\tsock_put(ps->tunnel_sock);\n\t} else\n\t\terr = pppol2tp_session_setsockopt(sk, session, optname, val);\n\n\terr = 0;\n\nend_put_sess:\n\tsock_put(sk);\nend:\n\treturn err;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " def warnDevDieIf(test: => Bo, errorCode: St, details: St = \"\"): U =\n warnDbgDieIf(test, errorCode, details)", "label": 1, "label_name": "safe"} -{"code": "MONGO_EXPORT bson_bool_t mongo_cmd_authenticate( mongo *conn, const char *db, const char *user, const char *pass ) {\n bson from_db;\n bson cmd;\n const char *nonce;\n int result;\n\n mongo_md5_state_t st;\n mongo_md5_byte_t digest[16];\n char hex_digest[33];\n\n if( mongo_simple_int_command( conn, db, \"getnonce\", 1, &from_db ) == MONGO_OK ) {\n bson_iterator it;\n bson_find( &it, &from_db, \"nonce\" );\n nonce = bson_iterator_string( &it );\n }\n else {\n return MONGO_ERROR;\n }\n\n mongo_pass_digest( user, pass, hex_digest );\n\n mongo_md5_init( &st );\n mongo_md5_append( &st, ( const mongo_md5_byte_t * )nonce, strlen( nonce ) );\n mongo_md5_append( &st, ( const mongo_md5_byte_t * )user, strlen( user ) );\n mongo_md5_append( &st, ( const mongo_md5_byte_t * )hex_digest, 32 );\n mongo_md5_finish( &st, digest );\n digest2hex( digest, hex_digest );\n\n bson_init( &cmd );\n bson_append_int( &cmd, \"authenticate\", 1 );\n bson_append_string( &cmd, \"user\", user );\n bson_append_string( &cmd, \"nonce\", nonce );\n bson_append_string( &cmd, \"key\", hex_digest );\n bson_finish( &cmd );\n\n bson_destroy( &from_db );\n\n result = mongo_run_command( conn, db, &cmd, NULL );\n\n bson_destroy( &cmd );\n\n return result;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " setter: function(path) {\n return (\n setCache.get(path) ||\n setCache.set(\n path,\n new Function('data, value', expr(path, 'data') + ' = value')\n )\n )\n },", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic function updateTab($id, $array)\n\t{\n\t\tif (!$id || $id == '') {\n\t\t\t$this->setAPIResponse('error', 'id was not set', 422);\n\t\t\treturn null;\n\t\t}\n\t\tif (!$array) {\n\t\t\t$this->setAPIResponse('error', 'no data was sent', 422);\n\t\t\treturn null;\n\t\t}\n\t\t$tabInfo = $this->getTabById($id);\n\t\tif ($tabInfo) {\n\t\t\t$array = $this->checkKeys($tabInfo, $array);\n\t\t} else {\n\t\t\t$this->setAPIResponse('error', 'No tab info found', 404);\n\t\t\treturn false;\n\t\t}\n\t\tif (array_key_exists('name', $array)) {\n\t\t\t$array['name'] = $this->sanitizeUserString($array['name']);\n\t\t\tif ($this->isTabNameTaken($array['name'], $id)) {\n\t\t\t\t$this->setAPIResponse('error', 'Tab name: ' . $array['name'] . ' is already taken', 409);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (!$this->qualifyLength($array['name'], 50, true)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tif (array_key_exists('default', $array)) {\n\t\t\tif ($array['default']) {\n\t\t\t\t$this->clearTabDefault();\n\t\t\t}\n\t\t}\n\t\tif (array_key_exists('group_id', $array)) {\n\t\t\t$groupCheck = (array_key_exists('group_id_min', $array)) ? $array['group_id_min'] : $tabInfo['group_id_min'];\n\t\t\tif ($array['group_id'] < $groupCheck) {\n\t\t\t\t$this->setAPIResponse('error', 'Tab name: ' . $tabInfo['name'] . ' cannot have a lower Group Id Max than Group Id Min', 409);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tif (array_key_exists('group_id_min', $array)) {\n\t\t\t$groupCheck = (array_key_exists('group_id', $array)) ? $array['group_id'] : $tabInfo['group_id'];\n\t\t\tif ($array['group_id_min'] > $groupCheck) {\n\t\t\t\t$this->setAPIResponse('error', 'Tab name: ' . $tabInfo['name'] . ' cannot have a higher Group Id Min than Group Id Max', 409);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t$response = [\n\t\t\tarray(\n\t\t\t\t'function' => 'query',\n\t\t\t\t'query' => array(\n\t\t\t\t\t'UPDATE tabs SET',\n\t\t\t\t\t$array,\n\t\t\t\t\t'WHERE id = ?',\n\t\t\t\t\t$id\n\t\t\t\t)\n\t\t\t),\n\t\t];\n\t\t$this->setAPIResponse(null, 'Tab info updated');\n\t\t$this->setLoggerChannel('Tab Management');\n\t\t$this->logger->debug('Edited Tab Info for [' . $tabInfo['name'] . ']');\n\t\treturn $this->processQueries($response);\n\t}", "label": 1, "label_name": "safe"} -{"code": " public function activate_address()\n {\n global $db, $user;\n\n $object = new stdClass();\n $object->id = $this->params['id'];\n $db->setUniqueFlag($object, 'addresses', $this->params['is_what'], \"user_id=\" . $user->id);\n flash(\"message\", gt(\"Successfully updated address.\"));\n expHistory::back(); \n }", "label": 0, "label_name": "vulnerable"} -{"code": "\t\tpublic function build() {\n\t\t\t$this->buildIncludes();\n\t\t\t$this->_view = General::sanitize($this->_view);\n\n\t\t\t$header = new XMLElement('div');\n\t\t\t$header->setAttribute('id', 'header');\n\t\t\t$jump = new XMLElement('div');\n\t\t\t$jump->setAttribute('id', 'jump');\n\t\t\t$content = new XMLElement('div');\n\t\t\t$content->setAttribute('id', 'content');\n\n\t\t\t$this->buildHeader($header);\n\t\t\t$this->buildNavigation($header);\n\n\t\t\t$this->buildJump($jump);\n\t\t\t$header->appendChild($jump);\n\n\t\t\t$this->Body->appendChild($header);\n\n\t\t\t$this->buildContent($content);\n\t\t\t$this->Body->appendChild($content);\n\n\t\t\treturn parent::generate();\n\t\t}", "label": 1, "label_name": "safe"} -{"code": "b.select()}else if(w(a)){b.moveToElementEditStart(a);b.select()}else{b=b.clone();b.moveToElementEditStart(a);y(c,e,b)}k.cancel()}}setTimeout(function(){c.selectionChange(1)})}}}))}})})();(function(){function Q(a,c,d){return m(c)&&m(d)&&d.equals(c.getNext(function(a){return!(z(a)||A(a)||p(a))}))}function u(a){this.upper=a[0];this.lower=a[1];this.set.apply(this,a.slice(2))}function J(a){var c=a.element;if(c&&m(c)&&(c=c.getAscendant(a.triggers,!0))&&a.editable.contains(c)){var d=K(c,!0);if(\"true\"==d.getAttribute(\"contenteditable\"))return c;if(d.is(a.triggers))return d}return null}function ga(a,c,d){o(a,c);o(a,d);a=c.size.bottom;d=d.size.top;return a&&d?0|(a+d)/2:a||d}function r(a,c,\nd){return c=c[d?\"getPrevious\":\"getNext\"](function(b){return b&&b.type==CKEDITOR.NODE_TEXT&&!z(b)||m(b)&&!p(b)&&!v(a,b)})}function K(a,c){if(a.data(\"cke-editable\"))return null;for(c||(a=a.getParent());a&&!a.data(\"cke-editable\");){if(a.hasAttribute(\"contenteditable\"))return a;a=a.getParent()}return null}function ha(a){var c=a.doc,d=B('',c),b=this.path+\"images/\"+(n.hidpi?\"hidpi/\":\"\")+\"icon.png\";q(d,", "label": 1, "label_name": "safe"} -{"code": " it 'understands offsets for adding rules to the middle' do\n resource = Puppet::Type.type(:firewall).new({ :name => '101 test', })\n allow(resource.provider.class).to receive(:instances).and_return(providers)\n expect(resource.provider.insert_order).to eq(2)\n end", "label": 0, "label_name": "vulnerable"} -{"code": " public function applyToImage(Image $image, $x = 0, $y = 0)\n {\n $rectangle = new \\ImagickDraw;\n\n // set background\n $bgcolor = new Color($this->background);\n $rectangle->setFillColor($bgcolor->getPixel());\n\n // set border\n if ($this->hasBorder()) {\n $border_color = new Color($this->border_color);\n $rectangle->setStrokeWidth($this->border_width);\n $rectangle->setStrokeColor($border_color->getPixel());\n }\n\n $rectangle->rectangle($this->x1, $this->y1, $this->x2, $this->y2);\n\n $image->getCore()->drawImage($rectangle);\n\n return true;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " $removed[] = $fi->getFilename();\n }\n if ($removed = implode(', ', $removed)) {\n $result .= $removed . ' ' . dgettext('tuleap-tracker', 'removed');\n }\n\n $added = $this->fetchAddedFiles(array_diff($this->files, $changeset_value->getFiles()), $format, $is_for_mail);\n if ($added && $result) {\n $result .= $format === 'html' ? '; ' : PHP_EOL;\n }\n $result .= $added;\n\n return $result;\n }\n return false;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function __construct($inline, $block) {\n $this->inline = new HTMLPurifier_ChildDef_Optional($inline);\n $this->block = new HTMLPurifier_ChildDef_Optional($block);\n $this->elements = $this->block->elements;\n }", "label": 1, "label_name": "safe"} -{"code": " public function testFilterRelativePathBase()\n {\n $this->setBase('foo/baz.html');\n $this->assertFiltering('foo.php', 'foo/foo.php');\n }", "label": 1, "label_name": "safe"} -{"code": " failureRedirect: '/login/index.html' + origin + (origin ? '&error' : '?error'),\r\n failureFlash: 'Invalid username or password.'\r\n })(req, res, next);\r\n });\r", "label": 1, "label_name": "safe"} -{"code": "le64addr_string(netdissect_options *ndo, const u_char *ep)\n{\n\tconst unsigned int len = 8;\n\tregister u_int i;\n\tregister char *cp;\n\tregister struct bsnamemem *tp;\n\tchar buf[BUFSIZE];\n\n\ttp = lookup_bytestring(ndo, ep, len);\n\tif (tp->bs_name)\n\t\treturn (tp->bs_name);\n\n\tcp = buf;\n\tfor (i = len; i > 0 ; --i) {\n\t\t*cp++ = hex[*(ep + i - 1) >> 4];\n\t\t*cp++ = hex[*(ep + i - 1) & 0xf];\n\t\t*cp++ = ':';\n\t}\n\tcp --;\n\n\t*cp = '\\0';\n\n\ttp->bs_name = strdup(buf);\n\tif (tp->bs_name == NULL)\n\t\t(*ndo->ndo_error)(ndo, \"le64addr_string: strdup(buf)\");\n\n\treturn (tp->bs_name);\n}", "label": 1, "label_name": "safe"} -{"code": "error_t ftpClientParseDirEntry(char_t *line, FtpDirEntry *dirEntry)\n{\n uint_t i;\n size_t n;\n char_t *p;\n char_t *token;\n\n //Abbreviated months\n static const char_t months[13][4] =\n {\n \" \",\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\"\n };\n\n //Read first field\n token = osStrtok_r(line, \" \\t\", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //MS-DOS listing format?\n if(osIsdigit(token[0]))\n {\n //Check modification date format\n if(osStrlen(token) == 8 && token[2] == '-' && token[5] == '-')\n {\n //The format of the date is mm-dd-yy\n dirEntry->modified.month = (uint8_t) osStrtoul(token, NULL, 10);\n dirEntry->modified.day = (uint8_t) osStrtoul(token + 3, NULL, 10);\n dirEntry->modified.year = (uint16_t) osStrtoul(token + 6, NULL, 10) + 2000;\n }\n else if(osStrlen(token) == 10 && token[2] == '/' && token[5] == '/')\n {\n //The format of the date is mm/dd/yyyy\n dirEntry->modified.month = (uint8_t) osStrtoul(token, NULL, 10);\n dirEntry->modified.day = (uint8_t) osStrtoul(token + 3, NULL, 10);\n dirEntry->modified.year = (uint16_t) osStrtoul(token + 6, NULL, 10);\n }\n else\n {\n //Invalid time format\n return ERROR_INVALID_SYNTAX;\n }\n\n //Read modification time\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Check modification time format\n if(osStrlen(token) >= 5 && token[2] == ':')\n {\n //The format of the time hh:mm\n dirEntry->modified.hours = (uint8_t) osStrtoul(token, NULL, 10);\n dirEntry->modified.minutes = (uint8_t) osStrtoul(token + 3, NULL, 10);\n\n //The PM period covers the 12 hours from noon to midnight\n if(strstr(token, \"PM\") != NULL)\n dirEntry->modified.hours += 12;\n }\n else\n {\n //Invalid time format\n return ERROR_INVALID_SYNTAX;\n }\n\n //Read next field\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Check whether the current entry is a directory\n if(!osStrcmp(token, \"\"))\n {\n //Update attributes\n dirEntry->attributes |= FTP_FILE_ATTR_DIRECTORY;\n }\n else\n {\n //Save the size of the file\n dirEntry->size = osStrtoul(token, NULL, 10);\n }\n\n //Read filename field\n token = osStrtok_r(NULL, \" \\r\\n\", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Retrieve the length of the filename\n n = osStrlen(token);\n //Limit the number of characters to copy\n n = MIN(n, FTP_CLIENT_MAX_FILENAME_LEN);\n\n //Copy the filename\n osStrncpy(dirEntry->name, token, n);\n //Properly terminate the string with a NULL character\n dirEntry->name[n] = '\\0';\n }\n //Unix listing format?\n else\n {\n //Check file permissions\n if(strchr(token, 'd') != NULL)\n dirEntry->attributes |= FTP_FILE_ATTR_DIRECTORY;\n if(strchr(token, 'w') == NULL)\n dirEntry->attributes |= FTP_FILE_ATTR_READ_ONLY;\n\n //Read next field\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Discard owner field\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Discard group field\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Read size field\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Save the size of the file\n dirEntry->size = osStrtoul(token, NULL, 10);\n\n //Read modification time (month)\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Decode the 3-letter month name\n for(i = 1; i <= 12; i++)\n {\n //Compare month name\n if(!osStrcmp(token, months[i]))\n {\n //Save month number\n dirEntry->modified.month = i;\n break;\n }\n }\n\n //Read modification time (day)\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Save day number\n dirEntry->modified.day = (uint8_t) osStrtoul(token, NULL, 10);\n\n //Read next field\n token = osStrtok_r(NULL, \" \", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Check modification time format\n if(osStrlen(token) == 4)\n {\n //The format of the year is yyyy\n dirEntry->modified.year = (uint16_t) osStrtoul(token, NULL, 10);\n\n }\n else if(osStrlen(token) == 5)\n {\n //The format of the time hh:mm\n token[2] = '\\0';\n dirEntry->modified.hours = (uint8_t) osStrtoul(token, NULL, 10);\n dirEntry->modified.minutes = (uint8_t) osStrtoul(token + 3, NULL, 10);\n }\n else\n {\n //Invalid time format\n return ERROR_INVALID_SYNTAX;\n }\n\n //Read filename field\n token = osStrtok_r(NULL, \" \\r\\n\", &p);\n //Invalid directory entry?\n if(token == NULL)\n return ERROR_INVALID_SYNTAX;\n\n //Retrieve the length of the filename\n n = osStrlen(token);\n //Limit the number of characters to copy\n n = MIN(n, FTP_CLIENT_MAX_FILENAME_LEN);\n\n //Copy the filename\n osStrncpy(dirEntry->name, token, n);\n //Properly terminate the string with a NULL character\n dirEntry->name[n] = '\\0';\n }\n\n //The directory entry is valid\n return NO_ERROR;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "func (x *UpdateAccountRequest) ProtoReflect() protoreflect.Message {\n\tmi := &file_console_proto_msgTypes[36]\n\tif protoimpl.UnsafeEnabled && x != nil {\n\t\tms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))\n\t\tif ms.LoadMessageInfo() == nil {\n\t\t\tms.StoreMessageInfo(mi)\n\t\t}\n\t\treturn ms\n\t}\n\treturn mi.MessageOf(x)\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public static function resolve(UriInterface $base, $rel)\n {\n if ($rel === null || $rel === '') {\n return $base;\n }\n\n if (!($rel instanceof UriInterface)) {\n $rel = new self($rel);\n }\n\n // Return the relative uri as-is if it has a scheme.\n if ($rel->getScheme()) {\n return $rel->withPath(static::removeDotSegments($rel->getPath()));\n }\n\n $relParts = [\n 'scheme' => $rel->getScheme(),\n 'authority' => $rel->getAuthority(),\n 'path' => $rel->getPath(),\n 'query' => $rel->getQuery(),\n 'fragment' => $rel->getFragment()\n ];\n\n $parts = [\n 'scheme' => $base->getScheme(),\n 'authority' => $base->getAuthority(),\n 'path' => $base->getPath(),\n 'query' => $base->getQuery(),\n 'fragment' => $base->getFragment()\n ];\n\n if (!empty($relParts['authority'])) {\n $parts['authority'] = $relParts['authority'];\n $parts['path'] = self::removeDotSegments($relParts['path']);\n $parts['query'] = $relParts['query'];\n $parts['fragment'] = $relParts['fragment'];\n } elseif (!empty($relParts['path'])) {\n if (substr($relParts['path'], 0, 1) == '/') {\n $parts['path'] = self::removeDotSegments($relParts['path']);\n $parts['query'] = $relParts['query'];\n $parts['fragment'] = $relParts['fragment'];\n } else {\n if (!empty($parts['authority']) && empty($parts['path'])) {\n $mergedPath = '/';\n } else {\n $mergedPath = substr($parts['path'], 0, strrpos($parts['path'], '/') + 1);\n }\n $parts['path'] = self::removeDotSegments($mergedPath . $relParts['path']);\n $parts['query'] = $relParts['query'];\n $parts['fragment'] = $relParts['fragment'];\n }\n } elseif (!empty($relParts['query'])) {\n $parts['query'] = $relParts['query'];\n } elseif ($relParts['fragment'] != null) {\n $parts['fragment'] = $relParts['fragment'];\n }\n\n return new self(static::createUriString(\n $parts['scheme'],\n $parts['authority'],\n $parts['path'],\n $parts['query'],\n $parts['fragment']\n ));\n }", "label": 0, "label_name": "vulnerable"} -{"code": " function initializeSut() {\n sut = proxyquire(sourcePath + 'vcs/git', {\n \"child_process\": {\n exec: exec\n },\n \"path\": {\n dirname: dirname,\n basename: basename\n }\n });\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function prepare($config)\n {\n $this->target = $config->get('URI.' . $this->name);\n $this->parser = new HTMLPurifier_URIParser();\n $this->doEmbed = $config->get('URI.MungeResources');\n $this->secretKey = $config->get('URI.MungeSecretKey');\n if ($this->secretKey && !function_exists('hash_hmac')) {\n throw new Exception(\"Cannot use %URI.MungeSecretKey without hash_hmac support.\");\n }\n return true;\n }", "label": 1, "label_name": "safe"} -{"code": " reply: () => Promise.resolve()\n };\n const cmdFn = require(`../../../src/commands/registration/${CMD.toLowerCase()}`).handler.bind(mockClient);\n\n beforeEach(() => {\n sandbox = sinon.sandbox.create().usingPromise(Promise);\n\n sandbox.spy(mockClient, 'reply');\n });\n afterEach(() => {\n sandbox.restore();\n });\n\n it('// unsuccessful', () => {\n return cmdFn()\n .then(() => {\n expect(mockClient.reply.args[0][0]).to.equal(501);\n });\n });\n\n it('BAD // unsuccessful', () => {\n return cmdFn({command: {arg: 'BAD', directive: CMD}})\n .then(() => {\n expect(mockClient.reply.args[0][0]).to.equal(500);\n });\n });\n\n it('UTF8 BAD // unsuccessful', () => {\n return cmdFn({command: {arg: 'UTF8 BAD', directive: CMD}})\n .then(() => {\n expect(mockClient.reply.args[0][0]).to.equal(501);\n });\n });\n\n it('UTF8 OFF // successful', () => {\n return cmdFn({command: {arg: 'UTF8 OFF', directive: CMD}})\n .then(() => {\n expect(mockClient.encoding).to.equal('ascii');\n expect(mockClient.reply.args[0][0]).to.equal(200);\n });\n });\n\n it('UTF8 ON // successful', () => {\n return cmdFn({command: {arg: 'UTF8 ON', directive: CMD}})\n .then(() => {\n expect(mockClient.encoding).to.equal('utf8');\n expect(mockClient.reply.args[0][0]).to.equal(200);\n });\n });\n});", "label": 0, "label_name": "vulnerable"} -{"code": "ticketsController.uploadImageMDE = function (req, res) {\n var Chance = require('chance')\n var chance = new Chance()\n var fs = require('fs-extra')\n var Busboy = require('busboy')\n var busboy = new Busboy({\n headers: req.headers,\n limits: {\n files: 1,\n fileSize: 5 * 1024 * 1024 // 5mb limit\n }\n })\n\n var object = {}\n var error\n\n object.ticketId = req.headers.ticketid\n if (!object.ticketId) return res.status(400).json({ success: false })\n\n busboy.on('file', function (fieldname, file, filename, encoding, mimetype) {\n if (mimetype.indexOf('image/') === -1) {\n error = {\n status: 500,\n message: 'Invalid File Type'\n }\n\n return file.resume()\n }\n\n var ext = path.extname(filename)\n var allowedExtensions = [\n '.jpg',\n '.jpeg',\n '.jpe',\n '.jif',\n '.jfif',\n '.jfi',\n '.png',\n '.gif',\n '.webp',\n '.tiff',\n '.tif',\n '.bmp',\n '.dib',\n '.heif',\n '.heic'\n ]\n\n if (!allowedExtensions.includes(ext.toLocaleLowerCase())) {\n error = {\n status: 400,\n message: 'Invalid File Type'\n }\n\n return file.resume()\n }\n\n var savePath = path.join(__dirname, '../../public/uploads/tickets', object.ticketId)\n // var sanitizedFilename = filename.replace(/[^a-z0-9.]/gi, '_').toLowerCase();\n var sanitizedFilename = chance.hash({ length: 20 }) + ext\n if (!fs.existsSync(savePath)) fs.ensureDirSync(savePath)\n\n object.filePath = path.join(savePath, 'inline_' + sanitizedFilename)\n object.filename = sanitizedFilename\n object.mimetype = mimetype\n\n if (fs.existsSync(object.filePath)) {\n error = {\n status: 500,\n message: 'File already exists'\n }\n\n return file.resume()\n }\n\n file.on('limit', function () {\n error = {\n status: 500,\n message: 'File too large'\n }\n\n // Delete the temp file\n if (fs.existsSync(object.filePath)) fs.unlinkSync(object.filePath)\n\n return file.resume()\n })\n\n file.pipe(fs.createWriteStream(object.filePath))\n })\n\n busboy.on('finish', function () {\n if (error) return res.status(error.status).send(error.message)\n\n if (_.isUndefined(object.ticketId) || _.isUndefined(object.filename) || _.isUndefined(object.filePath)) {\n return res.status(400).send('Invalid Form Data')\n }\n\n // Everything Checks out lets make sure the file exists and then add it to the attachments array\n if (!fs.existsSync(object.filePath)) return res.status(500).send('File Failed to Save to Disk')\n\n var fileUrl = '/uploads/tickets/' + object.ticketId + '/inline_' + object.filename\n\n return res.json({ filename: fileUrl, ticketId: object.ticketId })\n })\n\n req.pipe(busboy)\n}", "label": 1, "label_name": "safe"} -{"code": "parseUserInfo(DUL_USERINFO * userInfo,\n unsigned char *buf,\n unsigned long *itemLength,\n unsigned char typeRQorAC,\n unsigned long availData /* bytes left for in this PDU */)\n{\n unsigned short userLength;\n unsigned long length;\n OFCondition cond = EC_Normal;\n PRV_SCUSCPROLE *role;\n SOPClassExtendedNegotiationSubItem *extNeg = NULL;\n UserIdentityNegotiationSubItem *usrIdent = NULL;\n\n // minimum allowed size is 4 byte (case where the length of the user data is 0),\n // else we read past the buffer end\n if (availData < 4)\n return makeLengthError(\"user info\", availData, 4);\n\n // skip item type (50H) field\n userInfo->type = *buf++;\n // skip unused (\"reserved\") field\n userInfo->rsv1 = *buf++;\n // get and remember announced length of user data\n EXTRACT_SHORT_BIG(buf, userInfo->length);\n // .. and skip over the two length field bytes\n buf += 2;\n\n // userLength contains announced length of full user item structure,\n // will be used here to count down the available data later\n userLength = userInfo->length;\n // itemLength contains full length of the user item including the 4 bytes extra header (type, reserved + 2 for length)\n *itemLength = userLength + 4;\n\n // does this item claim to be larger than the available data?\n if (availData < *itemLength)\n return makeLengthError(\"user info\", availData, 0, userLength);\n\n DCMNET_TRACE(\"Parsing user info field (\"\n << STD_NAMESPACE hex << STD_NAMESPACE setfill('0') << STD_NAMESPACE setw(2) << (unsigned int)userInfo->type\n << STD_NAMESPACE dec << \"), Length: \" << (unsigned long)userInfo->length);\n // parse through different types of user items as long as we have data\n while (userLength > 0) {\n DCMNET_TRACE(\"Parsing remaining \" << (long)userLength << \" bytes of User Information\" << OFendl\n << \"Next item type: \"\n << STD_NAMESPACE hex << STD_NAMESPACE setfill('0') << STD_NAMESPACE setw(2) << (unsigned int)*buf);\n switch (*buf) {\n case DUL_TYPEMAXLENGTH:\n cond = parseMaxPDU(&userInfo->maxLength, buf, &length, userLength);\n if (cond.bad())\n return cond;\n buf += length;\n if (!OFStandard::safeSubtract(userLength, OFstatic_cast(short unsigned int, length), userLength))\n return makeLengthError(\"maximum length sub-item\", userLength, length);\n DCMNET_TRACE(\"Successfully parsed Maximum PDU Length\");\n break;\n case DUL_TYPEIMPLEMENTATIONCLASSUID:\n cond = parseSubItem(&userInfo->implementationClassUID,\n buf, &length, userLength);\n if (cond.bad())\n return cond;\n buf += length;\n if (!OFStandard::safeSubtract(userLength, OFstatic_cast(short unsigned int, length), userLength))\n return makeLengthError(\"Implementation Class UID sub-item\", userLength, length);\n break;\n\n case DUL_TYPEASYNCOPERATIONS:\n cond = parseDummy(buf, &length, userLength);\n if (cond.bad())\n return cond;\n buf += length;\n if (!OFStandard::safeSubtract(userLength, OFstatic_cast(short unsigned int, length), userLength))\n return makeLengthError(\"asynchronous operation user item type\", userLength, length);\n break;\n case DUL_TYPESCUSCPROLE:\n role = (PRV_SCUSCPROLE*)malloc(sizeof(PRV_SCUSCPROLE));\n if (role == NULL) return EC_MemoryExhausted;\n cond = parseSCUSCPRole(role, buf, &length, userLength);\n if (cond.bad()) return cond;\n LST_Enqueue(&userInfo->SCUSCPRoleList, (LST_NODE*)role);\n buf += length;\n if (!OFStandard::safeSubtract(userLength, OFstatic_cast(short unsigned int, length), userLength))\n return makeLengthError(\"SCP/SCU Role Selection sub-item\", userLength, length);\n break;\n case DUL_TYPEIMPLEMENTATIONVERSIONNAME:\n cond = parseSubItem(&userInfo->implementationVersionName,\n buf, &length, userLength);\n if (cond.bad()) return cond;\n buf += length;\n if (!OFStandard::safeSubtract(userLength, OFstatic_cast(short unsigned int, length), userLength))\n return makeLengthError(\"Implementation Version Name structure\", userLength, length);\n break;\n\n case DUL_TYPESOPCLASSEXTENDEDNEGOTIATION:\n /* parse an extended negotiation sub-item */\n extNeg = new SOPClassExtendedNegotiationSubItem;\n if (extNeg == NULL) return EC_MemoryExhausted;\n cond = parseExtNeg(extNeg, buf, &length, userLength);\n if (cond.bad()) return cond;\n if (userInfo->extNegList == NULL)\n {\n userInfo->extNegList = new SOPClassExtendedNegotiationSubItemList;\n if (userInfo->extNegList == NULL) return EC_MemoryExhausted;\n }\n userInfo->extNegList->push_back(extNeg);\n buf += length;\n if (!OFStandard::safeSubtract(userLength, OFstatic_cast(short unsigned int, length), userLength))\n return makeLengthError(\"SOP Class Extended Negotiation sub-item\", userLength, length);\n break;\n\n case DUL_TYPENEGOTIATIONOFUSERIDENTITY_REQ:\n case DUL_TYPENEGOTIATIONOFUSERIDENTITY_ACK:\n if (typeRQorAC == DUL_TYPEASSOCIATERQ)\n usrIdent = new UserIdentityNegotiationSubItemRQ();\n else // assume DUL_TYPEASSOCIATEAC\n usrIdent = new UserIdentityNegotiationSubItemAC();\n if (usrIdent == NULL) return EC_MemoryExhausted;\n cond = usrIdent->parseFromBuffer(buf, length /*return value*/, userLength);\n if (cond.bad())\n {\n delete usrIdent;\n return cond;\n }\n userInfo->usrIdent = usrIdent;\n buf += length;\n if (!OFStandard::safeSubtract(userLength, OFstatic_cast(short unsigned int, length), userLength))\n return makeLengthError(\"User Identity sub-item\", userLength, length);\n break;\n default:\n // we hit an unknown user item that is not defined in the standard\n // or still unknown to DCMTK\n cond = parseDummy(buf, &length /* returns bytes \"handled\" by parseDummy */, userLength /* data available in bytes for user item */);\n if (cond.bad())\n return cond;\n // skip the bytes read\n buf += length;\n // subtract bytes of parsed data from available data bytes\n if (OFstatic_cast(unsigned short, length) != length\n || !OFStandard::safeSubtract(userLength, OFstatic_cast(unsigned short, length), userLength))\n return makeUnderflowError(\"unknown user item\", userLength, length);\n break;\n }\n }\n\n return EC_Normal;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function setUp()\n {\n parent::setup();\n $this->factory = new HTMLPurifier_DefinitionCacheFactory();\n $this->oldFactory = HTMLPurifier_DefinitionCacheFactory::instance();\n HTMLPurifier_DefinitionCacheFactory::instance($this->factory);\n }", "label": 1, "label_name": "safe"} -{"code": " public function test_getSchemaObj_invalidDefaultScheme()\n {\n $this->setUpNoValidSchemes();\n $this->config->set('URI.DefaultScheme', 'foobar');\n\n $uri = $this->createURI('hmm');\n\n $this->expectError('Default scheme object \"foobar\" was not readable');\n $result = $uri->getSchemeObj($this->config, $this->context);\n $this->assertIdentical($result, false);\n\n $this->tearDownSchemeRegistryMock();\n }", "label": 1, "label_name": "safe"} -{"code": "process_options(argc, argv)\nint argc;\nchar *argv[];\n{\n int i, l;\n\n /*\n * Process options.\n */\n while (argc > 1 && argv[1][0] == '-') {\n argv++;\n argc--;\n l = (int) strlen(*argv);\n /* must supply at least 4 chars to match \"-XXXgraphics\" */\n if (l < 4)\n l = 4;\n\n switch (argv[0][1]) {\n case 'D':\n case 'd':\n if ((argv[0][1] == 'D' && !argv[0][2])\n || !strcmpi(*argv, \"-debug\")) {\n wizard = TRUE, discover = FALSE;\n } else if (!strncmpi(*argv, \"-DECgraphics\", l)) {\n load_symset(\"DECGraphics\", PRIMARY);\n switch_symbols(TRUE);\n } else {\n raw_printf(\"Unknown option: %s\", *argv);\n }\n break;\n case 'X':\n\n discover = TRUE, wizard = FALSE;\n break;\n#ifdef NEWS\n case 'n':\n iflags.news = FALSE;\n break;\n#endif\n case 'u':\n if (argv[0][2]) {\n (void) strncpy(plname, argv[0] + 2, sizeof plname - 1);\n } else if (argc > 1) {\n argc--;\n argv++;\n (void) strncpy(plname, argv[0], sizeof plname - 1);\n } else {\n raw_print(\"Player name expected after -u\");\n }\n break;\n case 'I':\n case 'i':\n if (!strncmpi(*argv, \"-IBMgraphics\", l)) {\n load_symset(\"IBMGraphics\", PRIMARY);\n load_symset(\"RogueIBM\", ROGUESET);\n switch_symbols(TRUE);\n } else {\n raw_printf(\"Unknown option: %s\", *argv);\n }\n break;\n case 'p': /* profession (role) */\n if (argv[0][2]) {\n if ((i = str2role(&argv[0][2])) >= 0)\n flags.initrole = i;\n } else if (argc > 1) {\n argc--;\n argv++;\n if ((i = str2role(argv[0])) >= 0)\n flags.initrole = i;\n }\n break;\n case 'r': /* race */\n if (argv[0][2]) {\n if ((i = str2race(&argv[0][2])) >= 0)\n flags.initrace = i;\n } else if (argc > 1) {\n argc--;\n argv++;\n if ((i = str2race(argv[0])) >= 0)\n flags.initrace = i;\n }\n break;\n case 'w': /* windowtype */\n config_error_init(FALSE, \"command line\", FALSE);\n choose_windows(&argv[0][2]);\n config_error_done();\n break;\n case '@':\n flags.randomall = 1;\n break;\n default:\n if ((i = str2role(&argv[0][1])) >= 0) {\n flags.initrole = i;\n break;\n }\n /* else raw_printf(\"Unknown option: %s\", *argv); */\n }\n }\n\n#ifdef SYSCF\n if (argc > 1)\n raw_printf(\"MAXPLAYERS are set in sysconf file.\\n\");\n#else\n /* XXX This is deprecated in favor of SYSCF with MAXPLAYERS */\n if (argc > 1)\n locknum = atoi(argv[1]);\n#endif\n#ifdef MAX_NR_OF_PLAYERS\n /* limit to compile-time limit */\n if (!locknum || locknum > MAX_NR_OF_PLAYERS)\n locknum = MAX_NR_OF_PLAYERS;\n#endif\n#ifdef SYSCF\n /* let syscf override compile-time limit */\n if (!locknum || (sysopt.maxplayers && locknum > sysopt.maxplayers))\n locknum = sysopt.maxplayers;\n#endif\n}", "label": 0, "label_name": "vulnerable"} -{"code": " function addDiscountToCart() {\n// global $user, $order;\n global $order;\n //lookup discount to see if it's real and valid, and not already in our cart\n //this will change once we allow more than one coupon code\n\n $discount = new discounts();\n $discount = $discount->getCouponByName(expString::escape($this->params['coupon_code']));\n\n if (empty($discount)) {\n flash('error', gt(\"This discount code you entered does not exist.\"));\n //redirect_to(array('controller'=>'cart', 'action'=>'checkout'));\n expHistory::back();\n }\n\n //check to see if it's in our cart already\n if ($this->isDiscountInCart($discount->id)) {\n flash('error', gt(\"This discount code is already in your cart.\"));\n //redirect_to(array('controller'=>'cart', 'action'=>'checkout'));\n expHistory::back();\n }\n\n //this should really be reworked, as it shoudn't redirect directly and not return\n $validateDiscountMessage = $discount->validateDiscount();\n if ($validateDiscountMessage == \"\") {\n //if all good, add to cart, otherwise it will have redirected\n $od = new order_discounts();\n $od->orders_id = $order->id;\n $od->discounts_id = $discount->id;\n $od->coupon_code = $discount->coupon_code;\n $od->title = $discount->title;\n $od->body = $discount->body;\n $od->save();\n // set this to just the discount applied via this coupon?? if so, when though? $od->discount_total = ??;\n flash('message', gt(\"The discount code has been applied to your cart.\"));\n } else {\n flash('error', $validateDiscountMessage);\n }\n //redirect_to(array('controller'=>'cart', 'action'=>'checkout'));\n expHistory::back();\n }", "label": 1, "label_name": "safe"} -{"code": " public function __construct()\n {\n $this->pngBase64 =\n 'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP'.\n 'C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA'.\n 'AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J'.\n 'REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq'.\n 'ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0'.\n 'vr4MkhoXe0rZigAAAABJRU5ErkJggg==';\n }", "label": 1, "label_name": "safe"} -{"code": "static size_t _php_mb_regex_get_option_string(char *str, size_t len, OnigOptionType option, OnigSyntaxType *syntax)\n{\n\tsize_t len_left = len;\n\tsize_t len_req = 0;\n\tchar *p = str;\n\tchar c;\n\n\tif ((option & ONIG_OPTION_IGNORECASE) != 0) {\n\t\tif (len_left > 0) {\n\t\t\t--len_left;\n\t\t\t*(p++) = 'i';\n\t\t}\n\t\t++len_req;\t\n\t}\n\n\tif ((option & ONIG_OPTION_EXTEND) != 0) {\n\t\tif (len_left > 0) {\n\t\t\t--len_left;\n\t\t\t*(p++) = 'x';\n\t\t}\n\t\t++len_req;\t\n\t}\n\n\tif ((option & (ONIG_OPTION_MULTILINE | ONIG_OPTION_SINGLELINE)) ==\n\t\t\t(ONIG_OPTION_MULTILINE | ONIG_OPTION_SINGLELINE)) {\n\t\tif (len_left > 0) {\n\t\t\t--len_left;\n\t\t\t*(p++) = 'p';\n\t\t}\n\t\t++len_req;\t\n\t} else {\n\t\tif ((option & ONIG_OPTION_MULTILINE) != 0) {\n\t\t\tif (len_left > 0) {\n\t\t\t\t--len_left;\n\t\t\t\t*(p++) = 'm';\n\t\t\t}\n\t\t\t++len_req;\t\n\t\t}\n\n\t\tif ((option & ONIG_OPTION_SINGLELINE) != 0) {\n\t\t\tif (len_left > 0) {\n\t\t\t\t--len_left;\n\t\t\t\t*(p++) = 's';\n\t\t\t}\n\t\t\t++len_req;\t\n\t\t}\n\t}\t\n\tif ((option & ONIG_OPTION_FIND_LONGEST) != 0) {\n\t\tif (len_left > 0) {\n\t\t\t--len_left;\n\t\t\t*(p++) = 'l';\n\t\t}\n\t\t++len_req;\t\n\t}\n\tif ((option & ONIG_OPTION_FIND_NOT_EMPTY) != 0) {\n\t\tif (len_left > 0) {\n\t\t\t--len_left;\n\t\t\t*(p++) = 'n';\n\t\t}\n\t\t++len_req;\t\n\t}\n\n\tc = 0;\n\n\tif (syntax == ONIG_SYNTAX_JAVA) {\n\t\tc = 'j';\n\t} else if (syntax == ONIG_SYNTAX_GNU_REGEX) {\n\t\tc = 'u';\n\t} else if (syntax == ONIG_SYNTAX_GREP) {\n\t\tc = 'g';\n\t} else if (syntax == ONIG_SYNTAX_EMACS) {\n\t\tc = 'c';\n\t} else if (syntax == ONIG_SYNTAX_RUBY) {\n\t\tc = 'r';\n\t} else if (syntax == ONIG_SYNTAX_PERL) {\n\t\tc = 'z';\n\t} else if (syntax == ONIG_SYNTAX_POSIX_BASIC) {\n\t\tc = 'b';\n\t} else if (syntax == ONIG_SYNTAX_POSIX_EXTENDED) {\n\t\tc = 'd';\n\t}\n\n\tif (c != 0) {\n\t\tif (len_left > 0) {\n\t\t\t--len_left;\n\t\t\t*(p++) = c;\n\t\t}\n\t\t++len_req;\n\t}\n\n\n\tif (len_left > 0) {\n\t\t--len_left;\n\t\t*(p++) = '\\0';\n\t}\n\t++len_req;\t\n\tif (len < len_req) {\n\t\treturn len_req;\n\t}\n\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "B)):N.isSelectionEmpty()&&N.isEnabled()?(B.addSeparator(),this.addMenuItems(B,[\"editData\"],null,G),B.addSeparator(),this.addSubmenu(\"layout\",B),this.addSubmenu(\"insert\",B),this.addMenuItems(B,[\"-\",\"exitGroup\"],null,G)):N.isEnabled()&&this.addMenuItems(B,[\"-\",\"lockUnlock\"],null,G)};var A=Menus.prototype.addPopupMenuEditItems;Menus.prototype.addPopupMenuEditItems=function(B,F,G){A.apply(this,arguments);this.editorUi.editor.graph.isSelectionEmpty()&&this.addMenuItems(B,[\"copyAsImage\"],null,G)};EditorUi.prototype.toggleFormatPanel=", "label": 0, "label_name": "vulnerable"} -{"code": " public static String getAttachedFilePath(String inputStudyOid) {\n \t// Using a standard library to validate/Sanitize user inputs which will be used in path expression to prevent from path traversal\n \tString studyOid = FilenameUtils.getName(inputStudyOid);\n String attachedFilePath = CoreResources.getField(\"attached_file_location\");\n if (attachedFilePath == null || attachedFilePath.length() <= 0) {\n attachedFilePath = CoreResources.getField(\"filePath\") + \"attached_files\" + File.separator + studyOid + File.separator;\n } else {\n attachedFilePath += studyOid + File.separator;\n }\n return attachedFilePath;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)\n{\n\tgfn_t gfn, end_gfn;\n\tpfn_t pfn;\n\tint r = 0;\n\tstruct iommu_domain *domain = kvm->arch.iommu_domain;\n\tint flags;\n\n\t/* check if iommu exists and in use */\n\tif (!domain)\n\t\treturn 0;\n\n\tgfn = slot->base_gfn;\n\tend_gfn = gfn + slot->npages;\n\n\tflags = IOMMU_READ;\n\tif (!(slot->flags & KVM_MEM_READONLY))\n\t\tflags |= IOMMU_WRITE;\n\tif (!kvm->arch.iommu_noncoherent)\n\t\tflags |= IOMMU_CACHE;\n\n\n\twhile (gfn < end_gfn) {\n\t\tunsigned long page_size;\n\n\t\t/* Check if already mapped */\n\t\tif (iommu_iova_to_phys(domain, gfn_to_gpa(gfn))) {\n\t\t\tgfn += 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* Get the page size we could use to map */\n\t\tpage_size = kvm_host_page_size(kvm, gfn);\n\n\t\t/* Make sure the page_size does not exceed the memslot */\n\t\twhile ((gfn + (page_size >> PAGE_SHIFT)) > end_gfn)\n\t\t\tpage_size >>= 1;\n\n\t\t/* Make sure gfn is aligned to the page size we want to map */\n\t\twhile ((gfn << PAGE_SHIFT) & (page_size - 1))\n\t\t\tpage_size >>= 1;\n\n\t\t/* Make sure hva is aligned to the page size we want to map */\n\t\twhile (__gfn_to_hva_memslot(slot, gfn) & (page_size - 1))\n\t\t\tpage_size >>= 1;\n\n\t\t/*\n\t\t * Pin all pages we are about to map in memory. This is\n\t\t * important because we unmap and unpin in 4kb steps later.\n\t\t */\n\t\tpfn = kvm_pin_pages(slot, gfn, page_size);\n\t\tif (is_error_noslot_pfn(pfn)) {\n\t\t\tgfn += 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* Map into IO address space */\n\t\tr = iommu_map(domain, gfn_to_gpa(gfn), pfn_to_hpa(pfn),\n\t\t\t page_size, flags);\n\t\tif (r) {\n\t\t\tprintk(KERN_ERR \"kvm_iommu_map_address:\"\n\t\t\t \"iommu failed to map pfn=%llx\\n\", pfn);\n\t\t\tgoto unmap_pages;\n\t\t}\n\n\t\tgfn += page_size >> PAGE_SHIFT;\n\n\n\t}\n\n\treturn 0;\n\nunmap_pages:\n\tkvm_iommu_put_pages(kvm, slot->base_gfn, gfn);\n\treturn r;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " protected function prepareConfig(array $config)\n {\n $config = new Config($config);\n $config->setFallback($this->getConfig());\n\n return $config;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public static function remove($token){\n $json = Options::get('tokens');\n $tokens = json_decode($json, true);\n unset($tokens[$token]);\n $tokens = json_encode($tokens);\n if(Options::update('tokens',$tokens)){\n return true;\n }else{\n return false;\n }\n }", "label": 1, "label_name": "safe"} -{"code": " void existingDocumentTerminalFromUI() throws Exception\n {\n // current document = xwiki:Main.WebHome\n DocumentReference documentReference = new DocumentReference(\"xwiki\", Arrays.asList(\"Main\"), \"WebHome\");\n XWikiDocument document = mock(XWikiDocument.class);\n when(document.getDocumentReference()).thenReturn(documentReference);\n when(document.isNew()).thenReturn(false);\n when(document.getLocalReferenceMaxLength()).thenReturn(255);\n context.setDoc(document);\n\n // Submit from the UI spaceReference=X&name=Y&tocreate=terminal\n when(mockRequest.getParameter(\"spaceReference\")).thenReturn(\"X\");\n when(mockRequest.getParameter(\"name\")).thenReturn(\"Y\");\n when(mockRequest.getParameter(\"tocreate\")).thenReturn(\"terminal\");\n\n // Run the action\n String result = action.render(context);\n\n // The tests are below this line!\n\n // Verify null is returned (this means the response has been returned)\n assertNull(result);\n\n // Note: We are creating X.Y instead of X.Y.WebHome because the tocreate parameter says \"terminal\".\n verify(mockURLFactory).createURL(\"X\", \"Y\", \"edit\", \"template=&parent=Main.WebHome&title=Y\", null, \"xwiki\",\n context);\n }", "label": 1, "label_name": "safe"} -{"code": "def _get_default_quotas():\n defaults = {\n 'instances': FLAGS.quota_instances,\n 'cores': FLAGS.quota_cores,\n 'ram': FLAGS.quota_ram,\n 'volumes': FLAGS.quota_volumes,\n 'gigabytes': FLAGS.quota_gigabytes,\n 'floating_ips': FLAGS.quota_floating_ips,\n 'metadata_items': FLAGS.quota_metadata_items,\n 'injected_files': FLAGS.quota_injected_files,\n 'injected_file_content_bytes':\n FLAGS.quota_injected_file_content_bytes,\n 'security_groups': FLAGS.quota_security_groups,\n 'security_group_rules': FLAGS.quota_security_group_rules,\n }\n # -1 in the quota flags means unlimited\n return defaults", "label": 1, "label_name": "safe"} -{"code": "ba.src=\"/images/icon-search.svg\"};b.sidebar.hideTooltip();b.sidebar.currentElt=ca;Ca=!0;ba.src=\"/images/aui-wait.gif\";fa.isExt?e(fa,oa,function(){A(mxResources.get(\"cantLoadPrev\"));Ca=!1;ba.src=\"/images/icon-search.svg\"}):ia(fa.url,oa)}}function n(fa,ca,ba){if(null!=C){for(var ja=C.className.split(\" \"),ia=0;ia=na.getStatus()?ja(na.getText(),oa):ia()})):ja(b.emptyDiagramXml,oa)},ja=function(oa,na){x||b.hideDialog(!0);f(oa,na,qa,ca)},ia=function(){A(mxResources.get(\"cannotLoad\"));ma()},ma=function(){I=qa;Ba.className=\"geTempDlgCreateBtn\";ca&&(Ka.className=\"geTempDlgOpenBtn\")},", "label": 0, "label_name": "vulnerable"} -{"code": " public function updateMemoryUsage()\n {\n $this->data['memory'] = memory_get_peak_usage(true);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "def test_datetime_parsing(value, result):\n if type(result) == type and issubclass(result, Exception):\n with pytest.raises(result):\n parse_datetime(value)\n else:\n assert parse_datetime(value) == result", "label": 1, "label_name": "safe"} -{"code": " public function save_change_password() {\n global $user;\n\n $isuser = ($this->params['uid'] == $user->id) ? 1 : 0;\n\n if (!$user->isAdmin() && !$isuser) {\n flash('error', gt('You do not have permissions to change this users password.'));\n expHistory::back();\n }\n\n if (($isuser && empty($this->params['password'])) || (!empty($this->params['password']) && $user->password != user::encryptPassword($this->params['password']))) {\n flash('error', gt('The current password you entered is not correct.'));\n expHistory::returnTo('editable');\n }\n //eDebug($user);\n $u = new user($this->params['uid']);\n\n $ret = $u->setPassword($this->params['new_password1'], $this->params['new_password2']);\n //eDebug($u, true);\n if (is_string($ret)) {\n flash('error', $ret);\n expHistory::returnTo('editable');\n } else {\n $params = array();\n $params['is_admin'] = !empty($u->is_admin);\n $params['is_acting_admin'] = !empty($u->is_acting_admin);\n $u->update($params);\n }\n\n if (!$isuser) {\n flash('message', gt('The password for') . ' ' . $u->username . ' ' . gt('has been changed.'));\n } else {\n $user->password = $u->password;\n flash('message', gt('Your password has been changed.'));\n }\n expHistory::back();\n }", "label": 0, "label_name": "vulnerable"} -{"code": "int main(int argc, char *argv[])\n{\n libettercap_init();\n ef_globals_alloc();\n select_text_interface();\n libettercap_ui_init();\n /* etterfilter copyright */\n fprintf(stdout, \"\\n\" EC_COLOR_BOLD \"%s %s\" EC_COLOR_END \" copyright %s %s\\n\\n\", \n PROGRAM, EC_VERSION, EC_COPYRIGHT, EC_AUTHORS);\n \n /* initialize the line number */\n EF_GBL->lineno = 1;\n \n /* getopt related parsing... */\n parse_options(argc, argv);\n\n /* set the input for source file */\n if (EF_GBL_OPTIONS->source_file) {\n yyin = fopen(EF_GBL_OPTIONS->source_file, \"r\");\n if (yyin == NULL)\n FATAL_ERROR(\"Input file not found !\");\n } else {\n FATAL_ERROR(\"No source file.\");\n }\n\n /* no buffering */\n setbuf(yyin, NULL);\n setbuf(stdout, NULL);\n setbuf(stderr, NULL);\n\n \n /* load the tables in etterfilter.tbl */\n load_tables();\n /* load the constants in etterfilter.cnt */\n load_constants();\n\n /* print the message */\n fprintf(stdout, \"\\n Parsing source file \\'%s\\' \", EF_GBL_OPTIONS->source_file);\n fflush(stdout);\n\n ef_debug(1, \"\\n\");\n\n /* begin the parsing */\n if (yyparse() == 0)\n fprintf(stdout, \" done.\\n\\n\");\n else\n fprintf(stdout, \"\\n\\nThe script contains errors...\\n\\n\");\n \n /* write to file */\n if (write_output() != E_SUCCESS)\n FATAL_ERROR(\"Cannot write output file (%s)\", EF_GBL_OPTIONS->output_file);\n ef_globals_free();\n return 0;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "func (cn *clusterNode) resurrect() {\n\tgRPCServer, err := comm_utils.NewGRPCServer(cn.bindAddress, cn.serverConfig)\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed starting gRPC server: %v\", err))\n\t}\n\tcn.srv = gRPCServer\n\torderer.RegisterClusterServer(gRPCServer.Server(), cn)\n\tgo cn.srv.Start()\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function testIgnoreInvalidData()\n {\n $this->assertResult(\n '',\n ''\n );\n }", "label": 1, "label_name": "safe"} -{"code": "archive_write_disk_set_acls(struct archive *a, int fd, const char *name,\n struct archive_acl *abstract_acl, __LA_MODE_T mode)\n{\n\tint\t\tret = ARCHIVE_OK;\n\n\t(void)mode;\t/* UNUSED */\n\n\tif ((archive_acl_types(abstract_acl)\n\t & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {\n\t\t/* Solaris writes POSIX.1e access and default ACLs together */\n\t\tret = set_acl(a, fd, name, abstract_acl,\n\t\t ARCHIVE_ENTRY_ACL_TYPE_POSIX1E, \"posix1e\");\n\n\t\t/* Simultaneous POSIX.1e and NFSv4 is not supported */\n\t\treturn (ret);\n\t}\n#if ARCHIVE_ACL_SUNOS_NFS4\n\telse if ((archive_acl_types(abstract_acl) &\n\t ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {\n\t\tret = set_acl(a, fd, name, abstract_acl,\n\t\t ARCHIVE_ENTRY_ACL_TYPE_NFS4, \"nfs4\");\n\t}\n#endif\n\treturn (ret);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "\tcancel: function() {\n\n\t\tif (this.dragging) {\n\n\t\t\tthis._mouseUp({ target: null });\n\n\t\t\tif (this.options.helper === \"original\") {\n\t\t\t\tthis.currentItem.css(this._storedCSS).removeClass(\"ui-sortable-helper\");\n\t\t\t} else {\n\t\t\t\tthis.currentItem.show();\n\t\t\t}\n\n\t\t\t//Post deactivating events to containers\n\t\t\tfor (var i = this.containers.length - 1; i >= 0; i--) {\n\t\t\t\tthis.containers[i]._trigger(\"deactivate\", null, this._uiHash(this));\n\t\t\t\tif (this.containers[i].containerCache.over) {\n\t\t\t\t\tthis.containers[i]._trigger(\"out\", null, this._uiHash(this));\n\t\t\t\t\tthis.containers[i].containerCache.over = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tif (this.placeholder) {\n\t\t\t//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!\n\t\t\tif (this.placeholder[0].parentNode) {\n\t\t\t\tthis.placeholder[0].parentNode.removeChild(this.placeholder[0]);\n\t\t\t}\n\t\t\tif (this.options.helper !== \"original\" && this.helper && this.helper[0].parentNode) {\n\t\t\t\tthis.helper.remove();\n\t\t\t}\n\n\t\t\t$.extend(this, {\n\t\t\t\thelper: null,\n\t\t\t\tdragging: false,\n\t\t\t\treverting: false,\n\t\t\t\t_noFinalSort: null\n\t\t\t});\n\n\t\t\tif (this.domPosition.prev) {\n\t\t\t\t$(this.domPosition.prev).after(this.currentItem);\n\t\t\t} else {\n\t\t\t\t$(this.domPosition.parent).prepend(this.currentItem);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\n\t},", "label": 1, "label_name": "safe"} -{"code": " public function confirm()\n {\n $project = $this->getProject();\n $action = $this->getAction($project);\n\n $this->response->html($this->helper->layout->project('action/remove', array(\n 'action' => $action,\n 'available_events' => $this->eventManager->getAll(),\n 'available_actions' => $this->actionManager->getAvailableActions(),\n 'project' => $project,\n 'title' => t('Remove an action')\n )));\n }", "label": 1, "label_name": "safe"} -{"code": "void lpc546xxEthDisableIrq(NetInterface *interface)\n{\n //Disable Ethernet MAC interrupts\n NVIC_DisableIRQ(ETHERNET_IRQn);\n\n //Valid Ethernet PHY or switch driver?\n if(interface->phyDriver != NULL)\n {\n //Disable Ethernet PHY interrupts\n interface->phyDriver->disableIrq(interface);\n }\n else if(interface->switchDriver != NULL)\n {\n //Disable Ethernet switch interrupts\n interface->switchDriver->disableIrq(interface);\n }\n else\n {\n //Just for sanity\n }\n}", "label": 0, "label_name": "vulnerable"} -{"code": "void test_rename(const char *path)\n{\n\tchar *d = strdupa(path), *tmpname;\n\td = dirname(d);\n\tsize_t len = strlen(path) + 30;\n\n\ttmpname = alloca(len);\n\tsnprintf(tmpname, len, \"%s/%d\", d, (int)getpid());\n\tif (rename(path, tmpname) == 0 || errno != ENOENT) {\n\t\tfprintf(stderr, \"leak at rename of %s\\n\", path);\n\t\texit(1);\n\t}\n}", "label": 1, "label_name": "safe"} -{"code": "int IniSection::setSectionProp (const YCPPath&p,const YCPValue&in, int what, int depth)\n{\n string k = ip->changeCase (p->component_str (depth));\n // Find the matching sections.\n // If we need to recurse, choose one, creating if necessary\n // Otherwise set properties of all of the leaf sections,\n // creating and deleting if the number of them does not match\n\n pair r =\n\tisections.equal_range (k);\n IniSectionIdxIterator xi = r.first, xe = r.second;\n\n if (depth + 1 < p->length())\n {\n\t// recurse\n\tIniIterator si;\n\tif (xi == xe)\n\t{\n\t // not found, need to add it;\n\t y2debug (\"Write: adding recursively %s to %s\", k.c_str (), p->toString().c_str());\n\n\t IniSection s (ip, k);\n\t container.push_back (IniContainerElement (s));\n\t isections.insert (IniSectionIndex::value_type (k, --container.end ()));\n\n\t si = --container.end ();\n\t}\n\telse\n\t{\n\t // there's something, choose last\n\t si = (--xe)->second;\n\t}\n\treturn si->s ().setSectionProp (p, in, what, depth+1);\n }\n else\n {\n\t// bottom level\n\n\t// make sure we have a list of values\n\tYCPList props;\n\tif (ip->repeatNames ())\n\t{\n\t props = as_list (in, \"property of section with repeat_names\");\n\t if (props.isNull())\n\t\treturn -1;\n\t}\n\telse\n\t{\n\t props->add (in);\n\t}\n\tint pi = 0, pe = props->size ();\n\n\t// Go simultaneously through the found sections\n\t// and the list of parameters, while _either_ lasts\n\t// Fewer sections-> add them, more sections-> delete them\n\n\twhile (pi != pe || xi != xe)\n\t{\n\t // watch out for validity of iterators!\n\n\t if (pi == pe)\n\t {\n\t\t// deleting a section\n\t\tdelSection1 (xi++);\n\t\t// no ++pi\n\t }\n\t else\n\t {\n\t\tYCPValue prop = props->value (pi);\n\t\tIniIterator si;\n\t\tif (xi == xe)\n\t\t{\n\t\t ///need to add a section ...\n\t\t y2debug (\"Adding section %s\", p->toString().c_str());\n\t\t // prepare it to have its property set\n\t\t // create it\n\t\t IniSection s (ip, k);\n\t\t s.dirty = true;\n\t\t // insert and index\n\t\t container.push_back (IniContainerElement (s));\n\t\t isections.insert (IniSectionIndex::value_type (k, --container.end ()));\n\t\t si = --container.end ();\n\t\t}\n\t\telse\n\t\t{\n\t\t si = xi->second;\n\t\t}\n\n\t\t// set a section's property\n\t\tIniSection & s = si->s ();\n\t\tif (what == 0) {\n\t\t YCPString str = as_string (prop, \"section_comment\");\n\t\t if (str.isNull())\n\t\t\treturn -1;\n\t\t s.setComment (str->value_cstr());\n\t\t}\n\t\telse if (what == 1) {\n\t\t YCPInteger i = as_integer (prop, \"section_rewrite\");\n\t\t if (i.isNull())\n\t\t\treturn -1;\n\t\t s.setRewriteBy (i->value());\n\t\t}\n\t\telse if (what == 2) {\n\t\t YCPInteger i = as_integer (prop, \"section_type\");\n\t\t if (i.isNull())\n\t\t\treturn -1;\n\t\t s.setReadBy (i->value());\n\t\t}\n\t\telse if (what == 3) {\n\t\t YCPBoolean b = as_boolean (prop, \"section_private\");\n\t\t if (b.isNull())\n\t\t\treturn -1;\n\t\t s.setPrivate (b->value());\n\t\t}\n\n\t\tif (xi != xe)\n\t\t{\n\t\t ++xi;\n\t\t}\n\t\t++pi;\n\t }\n\t // iterators have been advanced already\n\t}\n\treturn 0;\n }\n}", "label": 1, "label_name": "safe"} -{"code": " provisionCallback: (user, renew, cb) => {\n cb(null, 'zzz');\n }\n });\n\n xoauth2.getToken(false, function(err, accessToken) {\n expect(err).to.not.exist;\n expect(accessToken).to.equal('zzz');\n done();\n });\n });", "label": 0, "label_name": "vulnerable"} -{"code": "int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb)\n{\n\tint ret;\n\tint size;\n\n\tif (ud->side == USBIP_STUB) {\n\t\t/* the direction of urb must be OUT. */\n\t\tif (usb_pipein(urb->pipe))\n\t\t\treturn 0;\n\n\t\tsize = urb->transfer_buffer_length;\n\t} else {\n\t\t/* the direction of urb must be IN. */\n\t\tif (usb_pipeout(urb->pipe))\n\t\t\treturn 0;\n\n\t\tsize = urb->actual_length;\n\t}\n\n\t/* no need to recv xbuff */\n\tif (!(size > 0))\n\t\treturn 0;\n\n\tif (size > urb->transfer_buffer_length) {\n\t\t/* should not happen, probably malicious packet */\n\t\tif (ud->side == USBIP_STUB) {\n\t\t\tusbip_event_add(ud, SDEV_EVENT_ERROR_TCP);\n\t\t\treturn 0;\n\t\t} else {\n\t\t\tusbip_event_add(ud, VDEV_EVENT_ERROR_TCP);\n\t\t\treturn -EPIPE;\n\t\t}\n\t}\n\n\tret = usbip_recv(ud->tcp_socket, urb->transfer_buffer, size);\n\tif (ret != size) {\n\t\tdev_err(&urb->dev->dev, \"recv xbuf, %d\\n\", ret);\n\t\tif (ud->side == USBIP_STUB) {\n\t\t\tusbip_event_add(ud, SDEV_EVENT_ERROR_TCP);\n\t\t} else {\n\t\t\tusbip_event_add(ud, VDEV_EVENT_ERROR_TCP);\n\t\t\treturn -EPIPE;\n\t\t}\n\t}\n\n\treturn ret;\n}", "label": 1, "label_name": "safe"} -{"code": " $this->validateDirective($directive);\n }\n return true;\n }", "label": 1, "label_name": "safe"} -{"code": "RestAuthHandler::RestAuthHandler(application_features::ApplicationServer& server,\n GeneralRequest* request, GeneralResponse* response)\n : RestVocbaseBaseHandler(server, request, response),\n _validFor(60 * 60 * 24 * 30) {}", "label": 0, "label_name": "vulnerable"} -{"code": "function(){g.apply(this,arguments);mxSettings.setRecentColors(ColorDialog.recentColors);mxSettings.save()}}window.EditDataDialog&&(EditDataDialog.getDisplayIdForCell=function(u,E){var J=null;null!=u.editor.graph.getModel().getParent(E)?J=E.getId():null!=u.currentPage&&(J=u.currentPage.getId());return J});if(null!=window.StyleFormatPanel){var k=Format.prototype.init;Format.prototype.init=function(){k.apply(this,arguments);this.editorUi.editor.addListener(\"fileLoaded\",this.update)};var l=Format.prototype.refresh;", "label": 0, "label_name": "vulnerable"} -{"code": "PUBLIC cchar *httpGetParam(HttpConn *conn, cchar *var, cchar *defaultValue)\n{\n cchar *value;\n\n value = mprLookupJson(httpGetParams(conn), var);\n return (value) ? value : defaultValue;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "static CPINLINE zend_class_entry* swoole_try_get_ce(zend_string *class_name)\n{\n //user class , do not support incomplete class now\n zend_class_entry *ce = zend_lookup_class(class_name);\n if (ce)\n {\n return ce;\n }\n // try call unserialize callback and retry lookup\n zval user_func, args[1], retval;\n\n /* Check for unserialize callback */\n if ((PG(unserialize_callback_func) == NULL) || (PG(unserialize_callback_func)[0] == '\\0'))\n {\n zend_throw_exception_ex(NULL, 0, \"can not find class %s\", class_name->val TSRMLS_CC);\n return NULL;\n }\n \n zend_string *fname = swoole_string_init(ZEND_STRL(PG(unserialize_callback_func)));\n Z_STR(user_func) = fname;\n Z_TYPE_INFO(user_func) = IS_STRING_EX;\n ZVAL_STR(&args[0], class_name);\n\n call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL);\n\n swoole_string_release(fname);\n\n //user class , do not support incomplete class now\n ce = zend_lookup_class(class_name);\n if (!ce)\n {\n zend_throw_exception_ex(NULL, 0, \"can not find class %s\", class_name->val TSRMLS_CC);\n return NULL;\n }\n else\n {\n return ce;\n }\n}", "label": 0, "label_name": "vulnerable"} -{"code": "static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len)\n{\n VirtQueueElement elem;\n VirtQueue *vq;\n\n vq = vser->c_ivq;\n if (!virtio_queue_ready(vq)) {\n return 0;\n }\n if (!virtqueue_pop(vq, &elem)) {\n return 0;\n }\n\n /* TODO: detect a buffer that's too short, set NEEDS_RESET */\n iov_from_buf(elem.in_sg, elem.in_num, 0, buf, len);\n\n virtqueue_push(vq, &elem, len);\n virtio_notify(VIRTIO_DEVICE(vser), vq);\n return len;\n}", "label": 1, "label_name": "safe"} -{"code": "function(b,c){b=typeof c;\"function\"==b?c=mxStyleRegistry.getName(c):\"object\"==b&&(c=null);return c};a.decode=function(b,c,d){d=d||new this.template.constructor;var e=c.getAttribute(\"id\");null!=e&&(b.objects[e]=d);for(c=c.firstChild;null!=c;){if(!this.processInclude(b,c,d)&&\"add\"==c.nodeName&&(e=c.getAttribute(\"as\"),null!=e)){var f=c.getAttribute(\"extend\"),g=null!=f?mxUtils.clone(d.styles[f]):null;null==g&&(null!=f&&mxLog.warn(\"mxStylesheetCodec.decode: stylesheet \"+f+\" not found to extend\"),g={});\nfor(f=c.firstChild;null!=f;){if(f.nodeType==mxConstants.NODETYPE_ELEMENT){var k=f.getAttribute(\"as\");if(\"add\"==f.nodeName){var l=mxUtils.getTextContent(f);null!=l&&0mnt->mnt_sb;\n\tstruct mount *mnt = real_mount(path->mnt);\n\n\tif (!check_mnt(mnt))\n\t\treturn -EINVAL;\n\n\tif (path->dentry != path->mnt->mnt_root)\n\t\treturn -EINVAL;\n\n\t/* Don't allow changing of locked mnt flags.\n\t *\n\t * No locks need to be held here while testing the various\n\t * MNT_LOCK flags because those flags can never be cleared\n\t * once they are set.\n\t */\n\tif ((mnt->mnt.mnt_flags & MNT_LOCK_READONLY) &&\n\t !(mnt_flags & MNT_READONLY)) {\n\t\treturn -EPERM;\n\t}\n\tif ((mnt->mnt.mnt_flags & MNT_LOCK_NODEV) &&\n\t !(mnt_flags & MNT_NODEV)) {\n\t\treturn -EPERM;\n\t}\n\tif ((mnt->mnt.mnt_flags & MNT_LOCK_NOSUID) &&\n\t !(mnt_flags & MNT_NOSUID)) {\n\t\treturn -EPERM;\n\t}\n\tif ((mnt->mnt.mnt_flags & MNT_LOCK_NOEXEC) &&\n\t !(mnt_flags & MNT_NOEXEC)) {\n\t\treturn -EPERM;\n\t}\n\tif ((mnt->mnt.mnt_flags & MNT_LOCK_ATIME) &&\n\t ((mnt->mnt.mnt_flags & MNT_ATIME_MASK) != (mnt_flags & MNT_ATIME_MASK))) {\n\t\treturn -EPERM;\n\t}\n\n\terr = security_sb_remount(sb, data);\n\tif (err)\n\t\treturn err;\n\n\tdown_write(&sb->s_umount);\n\tif (flags & MS_BIND)\n\t\terr = change_mount_flags(path->mnt, flags);\n\telse if (!capable(CAP_SYS_ADMIN))\n\t\terr = -EPERM;\n\telse\n\t\terr = do_remount_sb(sb, flags, data, 0);\n\tif (!err) {\n\t\tlock_mount_hash();\n\t\tmnt_flags |= mnt->mnt.mnt_flags & ~MNT_USER_SETTABLE_MASK;\n\t\tmnt->mnt.mnt_flags = mnt_flags;\n\t\ttouch_mnt_namespace(mnt->mnt_ns);\n\t\tunlock_mount_hash();\n\t}\n\tup_write(&sb->s_umount);\n\treturn err;\n}", "label": 1, "label_name": "safe"} -{"code": "def test_adjust_timeout():\n mw = _get_mw()\n req1 = scrapy.Request(\"http://example.com\", meta={\n 'splash': {'args': {'timeout': 60, 'html': 1}},\n\n # download_timeout is always present,\n # it is set by DownloadTimeoutMiddleware\n 'download_timeout': 30,\n })\n req1 = mw.process_request(req1, None)\n assert req1.meta['download_timeout'] > 60\n\n req2 = scrapy.Request(\"http://example.com\", meta={\n 'splash': {'args': {'html': 1}},\n 'download_timeout': 30,\n })\n req2 = mw.process_request(req2, None)\n assert req2.meta['download_timeout'] == 30", "label": 1, "label_name": "safe"} -{"code": "func (m *Unrecognized) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: Unrecognized: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: Unrecognized: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tcase 1:\n\t\t\tif wireType != 2 {\n\t\t\t\treturn fmt.Errorf(\"proto: wrong wireType = %d for field Field1\", wireType)\n\t\t\t}\n\t\t\tvar stringLen uint64\n\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\tif shift >= 64 {\n\t\t\t\t\treturn ErrIntOverflowThetest\n\t\t\t\t}\n\t\t\t\tif iNdEx >= l {\n\t\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tb := dAtA[iNdEx]\n\t\t\t\tiNdEx++\n\t\t\t\tstringLen |= uint64(b&0x7F) << shift\n\t\t\t\tif b < 0x80 {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tintStringLen := int(stringLen)\n\t\t\tif intStringLen < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tpostIndex := iNdEx + intStringLen\n\t\t\tif postIndex < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif postIndex > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\ts := string(dAtA[iNdEx:postIndex])\n\t\t\tm.Field1 = &s\n\t\t\tiNdEx = postIndex\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipThetest(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif skippy < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif (iNdEx + skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthThetest\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public void complexExample() throws Exception {\n assertThat(ConstraintViolations.format(validator.validate(new ComplexExample())))\n .containsExactlyInAnyOrder(\n FAILED_RESULT + \"1\",\n FAILED_RESULT + \"2\",\n FAILED_RESULT + \"3\"\n );\n assertThat(TestLoggerFactory.getAllLoggingEvents())\n .isEmpty();\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public static string ConstructValidateUrl(string serviceTicket, bool gateway, bool renew, NameValueCollection customParameters)\n {\n if (gateway && renew)\n {\n throw new ArgumentException(\"Gateway and Renew parameters are mutually exclusive and cannot both be True\");\n }\n\n CasAuthentication.Initialize();\n\n EnhancedUriBuilder ub = new EnhancedUriBuilder(EnhancedUriBuilder.Combine(CasAuthentication.CasServerUrlPrefix, CasAuthentication.TicketValidator.UrlSuffix));\n ub.QueryItems.Add(CasAuthentication.TicketValidator.ServiceParameterName, HttpUtility.UrlEncode(ConstructServiceUrl(gateway)));\n ub.QueryItems.Add(CasAuthentication.TicketValidator.ArtifactParameterName, serviceTicket);\n\n if (renew)\n {\n ub.QueryItems.Set(\"renew\", \"true\");\n }\n\n if (customParameters != null)\n {\n for (int i = 0; i < customParameters.Count; i++)\n {\n string key = customParameters.AllKeys[i];\n string value = customParameters[i];\n\n ub.QueryItems.Add(key, value);\n }\n }\n return ub.Uri.AbsoluteUri;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\t\t\t$text = preg_replace( $skipPat, '', $text );\n\t\t}\n\n\t\tif ( self::open( $parser, $part1 ) ) {\n\n\t\t\t// Handle recursion here, so we can break cycles.\n\t\t\tif ( $recursionCheck == false ) {\n\t\t\t\t$text = $parser->preprocess( $text, $parser->getTitle(), $parser->getOptions() );\n\t\t\t\tself::close( $parser, $part1 );\n\t\t\t}\n\n\t\t\tif ( $maxLength > 0 ) {\n\t\t\t\t$text = self::limitTranscludedText( $text, $maxLength, $link );\n\t\t\t}\n\t\t\tif ( $trim ) {\n\t\t\t\treturn trim( $text );\n\t\t\t} else {\n\t\t\t\treturn $text;\n\t\t\t}\n\t\t} else {\n\t\t\treturn \"[[\" . $parser->getTitle()->getPrefixedText() . \"]]\" . \"\";\n\t\t}\n\t}", "label": 1, "label_name": "safe"} -{"code": "\tprotected function getRootStatExtra() {\n\t\t$stat = array();\n\t\tif ($this->rootName) {\n\t\t\t$stat['name'] = $this->rootName;\n\t\t}\n\t\tif (! empty($this->options['icon'])) {\n\t\t\t$stat['icon'] = $this->options['icon'];\n\t\t}\n\t\tif (! empty($this->options['rootCssClass'])) {\n\t\t\t$stat['csscls'] = $this->options['rootCssClass'];\n\t\t}\n\t\tif (! empty($this->tmbURL)) {\n\t\t\t$stat['tmbUrl'] = $this->tmbURL;\n\t\t}\n\t\t$stat['uiCmdMap'] = (isset($this->options['uiCmdMap']) && is_array($this->options['uiCmdMap']))? $this->options['uiCmdMap'] : array();\n\t\t$stat['disabled'] = $this->disabled;\n\t\tif (isset($this->options['netkey'])) {\n\t\t\t$stat['netkey'] = $this->options['netkey'];\n\t\t}\n\t\treturn $stat;\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": " public function testSendError()\n {\n $this->setMockHttpResponse('FetchTransactionFailure.txt');\n $response = $this->request->send();\n\n $this->assertFalse($response->isSuccessful());\n $this->assertFalse($response->isRedirect());\n $this->assertNull($response->getTransactionReference());\n $this->assertNull($response->getCardReference());\n $this->assertSame('No such charge: ch_29yrvk84GVDsq9fake', $response->getMessage());\n }", "label": 0, "label_name": "vulnerable"} -{"code": "func (m *MockCoreStrategy) GenerateAuthorizeCode(arg0 context.Context, arg1 fosite.Requester) (string, string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GenerateAuthorizeCode\", arg0, arg1)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(string)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "label": 1, "label_name": "safe"} -{"code": "int get_rock_ridge_filename(struct iso_directory_record *de,\n\t\t\t char *retname, struct inode *inode)\n{\n\tstruct rock_state rs;\n\tstruct rock_ridge *rr;\n\tint sig;\n\tint retnamlen = 0;\n\tint truncate = 0;\n\tint ret = 0;\n\n\tif (!ISOFS_SB(inode->i_sb)->s_rock)\n\t\treturn 0;\n\t*retname = 0;\n\n\tinit_rock_state(&rs, inode);\n\tsetup_rock_ridge(de, inode, &rs);\nrepeat:\n\n\twhile (rs.len > 2) { /* There may be one byte for padding somewhere */\n\t\trr = (struct rock_ridge *)rs.chr;\n\t\t/*\n\t\t * Ignore rock ridge info if rr->len is out of range, but\n\t\t * don't return -EIO because that would make the file\n\t\t * invisible.\n\t\t */\n\t\tif (rr->len < 3)\n\t\t\tgoto out;\t/* Something got screwed up here */\n\t\tsig = isonum_721(rs.chr);\n\t\tif (rock_check_overflow(&rs, sig))\n\t\t\tgoto eio;\n\t\trs.chr += rr->len;\n\t\trs.len -= rr->len;\n\t\t/*\n\t\t * As above, just ignore the rock ridge info if rr->len\n\t\t * is bogus.\n\t\t */\n\t\tif (rs.len < 0)\n\t\t\tgoto out;\t/* Something got screwed up here */\n\n\t\tswitch (sig) {\n\t\tcase SIG('R', 'R'):\n\t\t\tif ((rr->u.RR.flags[0] & RR_NM) == 0)\n\t\t\t\tgoto out;\n\t\t\tbreak;\n\t\tcase SIG('S', 'P'):\n\t\t\tif (check_sp(rr, inode))\n\t\t\t\tgoto out;\n\t\t\tbreak;\n\t\tcase SIG('C', 'E'):\n\t\t\trs.cont_extent = isonum_733(rr->u.CE.extent);\n\t\t\trs.cont_offset = isonum_733(rr->u.CE.offset);\n\t\t\trs.cont_size = isonum_733(rr->u.CE.size);\n\t\t\tbreak;\n\t\tcase SIG('N', 'M'):\n\t\t\tif (truncate)\n\t\t\t\tbreak;\n\t\t\tif (rr->len < 5)\n\t\t\t\tbreak;\n\t\t\t/*\n\t\t\t * If the flags are 2 or 4, this indicates '.' or '..'.\n\t\t\t * We don't want to do anything with this, because it\n\t\t\t * screws up the code that calls us. We don't really\n\t\t\t * care anyways, since we can just use the non-RR\n\t\t\t * name.\n\t\t\t */\n\t\t\tif (rr->u.NM.flags & 6)\n\t\t\t\tbreak;\n\n\t\t\tif (rr->u.NM.flags & ~1) {\n\t\t\t\tprintk(\"Unsupported NM flag settings (%d)\\n\",\n\t\t\t\t\trr->u.NM.flags);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ((strlen(retname) + rr->len - 5) >= 254) {\n\t\t\t\ttruncate = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tstrncat(retname, rr->u.NM.name, rr->len - 5);\n\t\t\tretnamlen += rr->len - 5;\n\t\t\tbreak;\n\t\tcase SIG('R', 'E'):\n\t\t\tkfree(rs.buffer);\n\t\t\treturn -1;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}\n\tret = rock_continue(&rs);\n\tif (ret == 0)\n\t\tgoto repeat;\n\tif (ret == 1)\n\t\treturn retnamlen; /* If 0, this file did not have a NM field */\nout:\n\tkfree(rs.buffer);\n\treturn ret;\neio:\n\tret = -EIO;\n\tgoto out;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " protected function getDefaultParameters()\n {\n return array(\n 'foo' => '%baz%',\n 'baz' => 'bar',\n 'bar' => 'foo is %%foo bar',\n 'escape' => '@escapeme',\n 'values' => array(\n 0 => true,\n 1 => false,\n 2 => NULL,\n 3 => 0,\n 4 => 1000.3,\n 5 => 'true',\n 6 => 'false',\n 7 => 'null',\n ),\n );\n }", "label": 0, "label_name": "vulnerable"} -{"code": "rdpdr_process(STREAM s)\n{\n\tuint32 handle;\n\tuint16 vmin;\n\tuint16 component;\n\tuint16 pakid;\n\tstruct stream packet = *s;\n\n\tlogger(Protocol, Debug, \"rdpdr_process()\");\n\t/* hexdump(s->p, s->end - s->p); */\n\n\tin_uint16(s, component);\n\tin_uint16(s, pakid);\n\n\tif (component == RDPDR_CTYP_CORE)\n\t{\n\t\tswitch (pakid)\n\t\t{\n\t\t\tcase PAKID_CORE_DEVICE_IOREQUEST:\n\t\t\t\trdpdr_process_irp(s);\n\t\t\t\tbreak;\n\n\t\t\tcase PAKID_CORE_SERVER_ANNOUNCE:\n\t\t\t\t/* DR_CORE_SERVER_ANNOUNCE_REQ */\n\t\t\t\tin_uint8s(s, 2);\t/* skip versionMajor */\n\t\t\t\tin_uint16_le(s, vmin);\t/* VersionMinor */\n\n\t\t\t\tin_uint32_le(s, g_client_id);\t/* ClientID */\n\n\t\t\t\t/* g_client_id is sent back to server,\n\t\t\t\t so lets check that we actually got\n\t\t\t\t valid data from stream to prevent\n\t\t\t\t that we leak back data to server */\n\t\t\t\tif (!s_check(s))\n\t\t\t\t{\n\t\t\t\t\trdp_protocol_error(\"rdpdr_process(), consume of g_client_id from stream did overrun\", &packet);\n\t\t\t\t}\n\n\t\t\t\t/* The RDP client is responsibility to provide a random client id\n\t\t\t\t if server version is < 12 */\n\t\t\t\tif (vmin < 0x000c)\n\t\t\t\t\tg_client_id = 0x815ed39d;\t/* IP address (use 127.0.0.1) 0x815ed39d */\n\t\t\t\tg_epoch++;\n\n#if WITH_SCARD\n\t\t\t\t/*\n\t\t\t\t * We need to release all SCARD contexts to end all\n\t\t\t\t * current transactions and pending calls\n\t\t\t\t */\n\t\t\t\tscard_release_all_contexts();\n\n\t\t\t\t/*\n\t\t\t\t * According to [MS-RDPEFS] 3.2.5.1.2:\n\t\t\t\t *\n\t\t\t\t * If this packet appears after a sequence of other packets,\n\t\t\t\t * it is a signal that the server has reconnected to a new session\n\t\t\t\t * and the whole sequence has been reset. The client MUST treat\n\t\t\t\t * this packet as the beginning of a new sequence.\n\t\t\t\t * The client MUST also cancel all outstanding requests and release\n\t\t\t\t * previous references to all devices.\n\t\t\t\t *\n\t\t\t\t * If any problem arises in the future, please, pay attention to the\n\t\t\t\t * \"If this packet appears after a sequence of other packets\" part\n\t\t\t\t *\n\t\t\t\t */\n\n#endif\n\n\t\t\t\trdpdr_send_client_announce_reply();\n\t\t\t\trdpdr_send_client_name_request();\n\t\t\t\tbreak;\n\n\t\t\tcase PAKID_CORE_CLIENTID_CONFIRM:\n\t\t\t\trdpdr_send_client_device_list_announce();\n\t\t\t\tbreak;\n\n\t\t\tcase PAKID_CORE_DEVICE_REPLY:\n\t\t\t\tin_uint32(s, handle);\n\t\t\t\tlogger(Protocol, Debug,\n\t\t\t\t \"rdpdr_process(), server connected to resource %d\", handle);\n\t\t\t\tbreak;\n\n\t\t\tcase PAKID_CORE_SERVER_CAPABILITY:\n\t\t\t\trdpdr_send_client_capability_response();\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tlogger(Protocol, Debug,\n\t\t\t\t \"rdpdr_process(), pakid 0x%x of component 0x%x\", pakid,\n\t\t\t\t component);\n\t\t\t\tbreak;\n\n\t\t}\n\t}\n\telse if (component == RDPDR_CTYP_PRN)\n\t{\n\t\tif (pakid == PAKID_PRN_CACHE_DATA)\n\t\t\tprintercache_process(s);\n\t}\n\telse\n\t\tlogger(Protocol, Warning, \"rdpdr_process(), unhandled component 0x%x\", component);\n}", "label": 1, "label_name": "safe"} +{"code": " public function __construct()\n {\n $this->defaultPlist = new HTMLPurifier_PropertyList();\n }", "label": 1, "label_name": "safe"} +{"code": "void grubfs_free (GrubFS *gf) {\n\tif (gf) {\n\t\tif (gf->file && gf->file->device) {\n\t\t\tfree (gf->file->device->disk);\n\t\t}\n\t\t//free (gf->file->device);\n\t\tfree (gf->file);\n\t\tfree (gf);\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": " public function __construct($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)\n {\n $this->id = strtolower($id);\n $this->invalidBehavior = $invalidBehavior;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "set_cs_start(char *line)\n{\n char *p, *q, *r;\n\n if ((p = strstr(line, \"string currentfile\"))) {\n /* enforce presence of `readstring' -- 5/29/99 */\n if (!strstr(line, \"readstring\"))\n return;\n /* locate the name of the charstring start command */\n *p = '\\0';\t\t\t\t\t /* damage line[] */\n q = strrchr(line, '/');\n if (q) {\n r = cs_start;\n ++q;\n while (!isspace(*q) && *q != '{')\n\t*r++ = *q++;\n *r = '\\0';\n }\n *p = 's';\t\t\t\t\t /* repair line[] */\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function __construct()\n {\n $this->phase = self::INIT_PHASE;\n $this->mode = self::BEFOR_HEAD;\n $this->dom = new DOMDocument;\n\n $this->dom->encoding = 'UTF-8';\n $this->dom->preserveWhiteSpace = true;\n $this->dom->substituteEntities = true;\n $this->dom->strictErrorChecking = false;\n }", "label": 1, "label_name": "safe"} +{"code": " protected function getFooService()\n {\n $a = new \\App\\Bar();\n\n $b = new \\App\\Baz($a);\n $b->bar = $a;\n\n $this->services['App\\Foo'] = $instance = new \\App\\Foo($b);\n\n $a->foo = $instance;\n\n return $instance;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " trigger_error(\n '%Attr.IDPrefixLocal cannot be used unless ' .\n '%Attr.IDPrefix is set',\n E_USER_WARNING\n );\n }\n\n if (!$this->selector) {\n $id_accumulator =& $context->get('IDAccumulator');\n if (isset($id_accumulator->ids[$id])) {\n return false;\n }\n }\n\n // we purposely avoid using regex, hopefully this is faster\n\n if ($config->get('Attr.ID.HTML5') === true) {\n if (preg_match('/[\\t\\n\\x0b\\x0c ]/', $id)) {\n return false;\n }\n } else {\n if (ctype_alpha($id)) {\n // OK\n } else {\n if (!ctype_alpha(@$id[0])) {\n return false;\n }\n // primitive style of regexps, I suppose\n $trim = trim(\n $id,\n 'A..Za..z0..9:-._'\n );\n if ($trim !== '') {\n return false;\n }\n }\n }\n\n $regexp = $config->get('Attr.IDBlacklistRegexp');\n if ($regexp && preg_match($regexp, $id)) {\n return false;\n }\n\n if (!$this->selector) {\n $id_accumulator->add($id);\n }\n\n // if no change was made to the ID, return the result\n // else, return the new id if stripping whitespace made it\n // valid, or return false.\n return $id;\n }", "label": 1, "label_name": "safe"} +{"code": "\t\t\t\t\tupdate : function(e, ui) {\n\t\t\t\t\t\tsave();\n\t\t\t\t\t}", "label": 0, "label_name": "vulnerable"} +{"code": "TfLiteStatus EluEval(TfLiteContext* context, TfLiteNode* node) {\n const TfLiteTensor* input = GetInput(context, node, 0);\n TfLiteTensor* output = GetOutput(context, node, 0);\n switch (input->type) {\n case kTfLiteFloat32: {\n optimized_ops::Elu(GetTensorShape(input), GetTensorData(input),\n GetTensorShape(output), GetTensorData(output));\n return kTfLiteOk;\n } break;\n case kTfLiteInt8: {\n OpData* data = reinterpret_cast(node->user_data);\n EvalUsingLookupTable(data, input, output);\n return kTfLiteOk;\n } break;\n default:\n TF_LITE_KERNEL_LOG(\n context, \"Only float32 and int8 is supported currently, got %s.\",\n TfLiteTypeGetName(input->type));\n return kTfLiteError;\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": " constructor(channel) {\n super({ highWaterMark: MAX_WINDOW });\n\n this._channel = channel;\n }", "label": 1, "label_name": "safe"} +{"code": " def destroy\n @property_hash[:ensure] = :absent\n end", "label": 0, "label_name": "vulnerable"} +{"code": "void AvahiService::resolved(int, int, const QString &name, const QString &, const QString &, const QString &h, int, const QString &, ushort p, const QList &, uint)\n{\n Q_UNUSED(name)\n port=p;\n host=h;\n stop();\n emit serviceResolved(name);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testUpdateCustomer()\n {\n $request = $this->gateway->updateCustomer(array('customerReference' => 'cus_1MZSEtqSghKx99'));\n\n $this->assertInstanceOf('Omnipay\\Stripe\\Message\\UpdateCustomerRequest', $request);\n $this->assertSame('cus_1MZSEtqSghKx99', $request->getCustomerReference());\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static void process_constructors (RBinFile *bf, RList *ret, int bits) {\n\tRList *secs = sections (bf);\n\tRListIter *iter;\n\tRBinSection *sec;\n\tint i, type;\n\tr_list_foreach (secs, iter, sec) {\n\t\ttype = -1;\n\t\tif (!strcmp (sec->name, \".fini_array\")) {\n\t\t\ttype = R_BIN_ENTRY_TYPE_FINI;\n\t\t} else if (!strcmp (sec->name, \".init_array\")) {\n\t\t\ttype = R_BIN_ENTRY_TYPE_INIT;\n\t\t} else if (!strcmp (sec->name, \".preinit_array\")) {\n\t\t\ttype = R_BIN_ENTRY_TYPE_PREINIT;\n\t\t}\n\t\tif (type != -1) {\n\t\t\tut8 *buf = calloc (sec->size, 1);\n\t\t\tif (!buf) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t(void)r_buf_read_at (bf->buf, sec->paddr, buf, sec->size);\n\t\t\tif (bits == 32) {\n\t\t\t\tfor (i = 0; (i + 3) < sec->size; i += 4) {\n\t\t\t\t\tut32 addr32 = r_read_le32 (buf + i);\n\t\t\t\t\tif (addr32) {\n\t\t\t\t\t\tRBinAddr *ba = newEntry (sec->paddr + i, (ut64)addr32, type, bits);\n\t\t\t\t\t\tr_list_append (ret, ba);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (i = 0; (i + 7) < sec->size; i += 8) {\n\t\t\t\t\tut64 addr64 = r_read_le64 (buf + i);\n\t\t\t\t\tif (addr64) {\n\t\t\t\t\t\tRBinAddr *ba = newEntry (sec->paddr + i, addr64, type, bits);\n\t\t\t\t\t\tr_list_append (ret, ba);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfree (buf);\n\t\t}\n\t}\n\tr_list_free (secs);\n}", "label": 1, "label_name": "safe"} +{"code": " public function testDestroy()\n {\n $collection = $this->createMongoCollectionMock();\n\n $this->mongo->expects($this->once())\n ->method('selectCollection')\n ->with($this->options['database'], $this->options['collection'])\n ->will($this->returnValue($collection));\n\n $methodName = phpversion('mongodb') ? 'deleteOne' : 'remove';\n\n $collection->expects($this->once())\n ->method($methodName)\n ->with(array($this->options['id_field'] => 'foo'));\n\n $this->assertTrue($this->storage->destroy('foo'));\n }", "label": 1, "label_name": "safe"} +{"code": "\tpublic static function loadFromStream($stream) {\n\t\t$buf = fread($stream, 14); //2+4+2+2+4\n\t\tif ($buf === false) {\n\t\t\treturn false;\n\t\t}\n\n\t\t//\u30b7\u30b0\u30cd\u30c1\u30e3\u30c1\u30a7\u30c3\u30af\n\t\tif ($buf[0] != 'B' || $buf[1] != 'M') {\n\t\t\treturn false;\n\t\t}\n\n\t\t$bitmap_file_header = unpack(\n\t\t\t//BITMAPFILEHEADER\u69cb\u9020\u4f53\n\t\t\t\"vtype/\".\n\t\t\t\"Vsize/\".\n\t\t\t\"vreserved1/\".\n\t\t\t\"vreserved2/\".\n\t\t\t\"Voffbits\", $buf\n\t\t);\n\n\t\treturn self::loadFromStreamAndFileHeader($stream, $bitmap_file_header);\n\t}", "label": 1, "label_name": "safe"} +{"code": "void ptrace_triggered(struct perf_event *bp, int nmi,\n\t\t struct perf_sample_data *data, struct pt_regs *regs)\n{\n\tstruct perf_event_attr attr;\n\n\t/*\n\t * Disable the breakpoint request here since ptrace has defined a\n\t * one-shot behaviour for breakpoint exceptions in PPC64.\n\t * The SIGTRAP signal is generated automatically for us in do_dabr().\n\t * We don't have to do anything about that here\n\t */\n\tattr = bp->attr;\n\tattr.disabled = true;\n\tmodify_user_hw_breakpoint(bp, &attr);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\tnext: function(elem){return jQuery.nth(elem,2,\"nextSibling\");},", "label": 0, "label_name": "vulnerable"} +{"code": "static struct ucma_multicast* ucma_alloc_multicast(struct ucma_context *ctx)\n{\n\tstruct ucma_multicast *mc;\n\n\tmc = kzalloc(sizeof(*mc), GFP_KERNEL);\n\tif (!mc)\n\t\treturn NULL;\n\n\tmutex_lock(&mut);\n\tmc->id = idr_alloc(&multicast_idr, NULL, 0, 0, GFP_KERNEL);\n\tmutex_unlock(&mut);\n\tif (mc->id < 0)\n\t\tgoto error;\n\n\tmc->ctx = ctx;\n\tlist_add_tail(&mc->list, &ctx->mc_list);\n\treturn mc;\n\nerror:\n\tkfree(mc);\n\treturn NULL;\n}", "label": 1, "label_name": "safe"} +{"code": "\"/\"+c.getSearch()+\"#_CONFIG_\"+Graph.compress(JSON.stringify(P)),F=new EmbedDialog(c,K);c.showDialog(F.container,450,240,!0);F.init()}catch(H){c.handleError(H)}else c.handleError({message:mxResources.get(\"invalidInput\")})}]);z=new TextareaDialog(c,mxResources.get(\"configuration\")+\":\",null!=L?JSON.stringify(JSON.parse(L),null,2):\"\",function(D){if(null!=D)try{if(null!=t.parentNode&&(mxSettings.setShowStartScreen(t.checked),mxSettings.save()),D==L)c.hideDialog();else{if(0 {\n event.reply = (...args: any[]) => {\n event.sender.sendToFrame(event.frameId, ...args);\n };\n};", "label": 0, "label_name": "vulnerable"} +{"code": "cJSON *cJSON_CreateFloat( double num )\n{\n\tcJSON *item = cJSON_New_Item();\n\tif ( item ) {\n\t\titem->type = cJSON_Number;\n\t\titem->valuefloat = num;\n\t\titem->valueint = num;\n\t}\n\treturn item;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " private def createSessionId(site: SiteBrief, userId: PatId): SidOk = {\n val now = globals.now()\n val useridDateRandom =\n userId +\".\"+\n now.millis +\".\"+\n (nextRandomString() take 10)\n\n // If the site id wasn't included in the hash, then an admin from site A could\n // login as admin at site B, if they have the same user id and username.\n val saltedHash = hashSha1Base64UrlSafe(\n s\"$secretSalt.${site.id}.$useridDateRandom\") take HashLength\n\n val value = s\"$saltedHash.$useridDateRandom\"\n SidOk(value, ageInMillis = 0, Some(userId))\n }\n\n\n // ----- Secure cookies\n\n def SecureCookie(name: St, value: St, maxAgeSeconds: Opt[i32] = None,", "label": 1, "label_name": "safe"} +{"code": "func (mr *MockAccessRequesterMockRecorder) SetSession(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetSession\", reflect.TypeOf((*MockAccessRequester)(nil).SetSession), arg0)\n}", "label": 1, "label_name": "safe"} +{"code": "static inline bool isMountable(const RemoteFsDevice::Details &d)\n{\n return RemoteFsDevice::constSshfsProtocol==d.url.scheme() ||\n RemoteFsDevice::constSambaProtocol==d.url.scheme() || RemoteFsDevice::constSambaAvahiProtocol==d.url.scheme();\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function getQuerySelect()\n {\n return '';\n }", "label": 0, "label_name": "vulnerable"} +{"code": "x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)\n{\n\tunsigned int first = 0;\n\tunsigned int last = ARR_SIZE(insn_regs_intel) - 1;\n\tunsigned int mid = ARR_SIZE(insn_regs_intel) / 2;\n\n\tif (!intel_regs_sorted) {\n\t\tmemcpy(insn_regs_intel_sorted, insn_regs_intel,\n\t\t\t\tsizeof(insn_regs_intel_sorted));\n\t\tqsort(insn_regs_intel_sorted,\n\t\t\t\tARR_SIZE(insn_regs_intel_sorted),\n\t\t\t\tsizeof(struct insn_reg), regs_cmp);\n\t\tintel_regs_sorted = true;\n\t}\n\n\twhile (first <= last) {\n\t\tif (insn_regs_intel_sorted[mid].insn < id) {\n\t\t\tfirst = mid + 1;\n\t\t} else if (insn_regs_intel_sorted[mid].insn == id) {\n\t\t\tif (access) {\n\t\t\t\t*access = insn_regs_intel_sorted[mid].access;\n\t\t\t}\n\t\t\treturn insn_regs_intel_sorted[mid].reg;\n\t\t} else {\n\t\t\tif (mid == 0)\n\t\t\t\tbreak;\n\t\t\tlast = mid - 1;\n\t\t}\n\t\tmid = (first + last) / 2;\n\t}\n\n\t// not found\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "function PHPMailerAutoload($classname)\n{\n //Can't use __DIR__ as it's only in PHP 5.3+\n $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';\n if (is_readable($filename)) {\n require $filename;\n }\n}", "label": 1, "label_name": "safe"} +{"code": "function step8() {\n include_once(GLPI_ROOT . \"/inc/dbmysql.class.php\");\n include_once(GLPI_CONFIG_DIR . \"/config_db.php\");\n $DB = new DB();\n\n if (isset($_POST['send_stats'])) {\n //user has accepted to send telemetry infos; activate cronjob\n $DB->update(\n 'glpi_crontasks',\n ['state' => 1],\n ['name' => 'telemetry']\n );\n }\n\n $url_base = str_replace(\"/install/install.php\", \"\", $_SERVER['HTTP_REFERER']);\n $DB->update(\n 'glpi_configs',\n ['value' => $DB->escape($url_base)], [\n 'context' => 'core',\n 'name' => 'url_base'\n ]\n );\n\n $url_base_api = \"$url_base/apirest.php/\";\n $DB->update(\n 'glpi_configs',\n ['value' => $DB->escape($url_base_api)], [\n 'context' => 'core',\n 'name' => 'url_base_api'\n ]\n );\n\n Session::destroy(); // Remove session data (debug mode for instance) set by web installation\n\n echo \"

    \".__('The installation is finished').\"

    \";\n\n echo \"

    \".__('Default logins / passwords are:').\"

    \";\n echo \"

    • \".__('glpi/glpi for the administrator account').\"
    • \";\n echo \"
    • \".__('tech/tech for the technician account').\"
    • \";\n echo \"
    • \".__('normal/normal for the normal account').\"
    • \";\n echo \"
    • \".__('post-only/postonly for the postonly account').\"

    \";\n echo \"

    \".__('You can delete or modify these accounts as well as the initial data.').\"

    \";\n echo \"

    \".__('Use GLPI');\n echo \"

    \";\n}", "label": 1, "label_name": "safe"} +{"code": "n)for(v=0;vquery('SELECT * FROM nv_orders WHERE website = '.protect($website->id), 'object');\r\n $out = $DB->result();\r\n\r\n if($type='json')\r\n $out = json_encode($out);\r\n\r\n return $out;\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": "krb5_gss_context_time(minor_status, context_handle, time_rec)\n OM_uint32 *minor_status;\n gss_ctx_id_t context_handle;\n OM_uint32 *time_rec;\n{\n krb5_error_code code;\n krb5_gss_ctx_id_rec *ctx;\n krb5_timestamp now;\n krb5_deltat lifetime;\n\n ctx = (krb5_gss_ctx_id_rec *) context_handle;\n\n if (! ctx->established) {\n *minor_status = KG_CTX_INCOMPLETE;\n return(GSS_S_NO_CONTEXT);\n }\n\n if ((code = krb5_timeofday(ctx->k5_context, &now))) {\n *minor_status = code;\n save_error_info(*minor_status, ctx->k5_context);\n return(GSS_S_FAILURE);\n }\n\n if ((lifetime = ctx->krb_times.endtime - now) <= 0) {\n *time_rec = 0;\n *minor_status = 0;\n return(GSS_S_CONTEXT_EXPIRED);\n } else {\n *time_rec = lifetime;\n *minor_status = 0;\n return(GSS_S_COMPLETE);\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function toolbar() {\n// global $user;\n\n $menu = array();\n\t\t$dirs = array(\n\t\t\tBASE.'framework/modules/administration/menus',\n\t\t\tBASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus'\n\t\t);\n\n\t\tforeach ($dirs as $dir) {\n\t\t if (is_readable($dir)) {\n\t\t\t $dh = opendir($dir);\n\t\t\t while (($file = readdir($dh)) !== false) {\n\t\t\t\t if (substr($file,-4,4) == '.php' && is_readable($dir.'/'.$file) && is_file($dir.'/'.$file)) {\n\t\t\t\t\t $menu[substr($file,0,-4)] = include($dir.'/'.$file);\n if (empty($menu[substr($file,0,-4)])) unset($menu[substr($file,0,-4)]);\n\t\t\t\t }\n\t\t\t }\n\t\t }\n\t\t}\n\n // sort the top level menus alphabetically by filename\n\t\tksort($menu);\t\t\n\t\t$sorted = array();\n\t\tforeach($menu as $m) $sorted[] = $m;\n \n // slingbar position\n if (isset($_COOKIE['slingbar-top'])){\n $top = $_COOKIE['slingbar-top'];\n } else {\n $top = SLINGBAR_TOP;\n }\n \n\t\tassign_to_template(array(\n 'menu'=>(bs3()) ? $sorted : json_encode($sorted),\n \"top\"=>$top\n ));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " it \"doesn't log in the user when not approved\" do\n SiteSetting.must_approve_users = true\n\n post \"/session/email-login/#{email_token.token}.json\"\n\n expect(response.status).to eq(200)\n\n expect(JSON.parse(response.body)[\"error\"]).to eq(I18n.t(\"login.not_approved\"))\n expect(session[:current_user_id]).to eq(nil)\n end", "label": 1, "label_name": "safe"} +{"code": "const globalLibvipsVersion = function () {\n if (process.platform !== 'win32') {\n const globalLibvipsVersion = spawnSync(`PKG_CONFIG_PATH=\"${pkgConfigPath()}\" pkg-config --modversion vips-cpp`, spawnSyncOptions).stdout;\n /* istanbul ignore next */\n return (globalLibvipsVersion || '').trim();\n } else {\n return '';\n }\n};", "label": 0, "label_name": "vulnerable"} +{"code": " function manage() {\r\n global $db, $router, $user;\r\n\r\n expHistory::set('manageable', $router->params);\r\n assign_to_template(array(\r\n 'canManageStandalones' => self::canManageStandalones(),\r\n 'sasections' => $db->selectObjects('section', 'parent=-1'),\r\n 'user' => $user,\r\n// 'canManagePagesets' => $user->isAdmin(),\r\n// 'templates' => $db->selectObjects('section_template', 'parent=0'),\r\n ));\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": " unset($this->cookies[$cookie['domain']][$cookie['path']][$cookie['name']]);\n }\n\n return true;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\tprivate function convertTimestamp( $inputDate ) {\n\t\t$timestamp = $inputDate;\n\t\tswitch ( $inputDate ) {\n\t\t\tcase 'today':\n\t\t\t\t$timestamp = date( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t\tcase 'last hour':\n\t\t\t\t$date = new \\DateTime();\n\t\t\t\t$date->sub( new \\DateInterval( 'P1H' ) );\n\t\t\t\t$timestamp = $date->format( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t\tcase 'last day':\n\t\t\t\t$date = new \\DateTime();\n\t\t\t\t$date->sub( new \\DateInterval( 'P1D' ) );\n\t\t\t\t$timestamp = $date->format( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t\tcase 'last week':\n\t\t\t\t$date = new \\DateTime();\n\t\t\t\t$date->sub( new \\DateInterval( 'P7D' ) );\n\t\t\t\t$timestamp = $date->format( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t\tcase 'last month':\n\t\t\t\t$date = new \\DateTime();\n\t\t\t\t$date->sub( new \\DateInterval( 'P1M' ) );\n\t\t\t\t$timestamp = $date->format( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t\tcase 'last year':\n\t\t\t\t$date = new \\DateTime();\n\t\t\t\t$date->sub( new \\DateInterval( 'P1Y' ) );\n\t\t\t\t$timestamp = $date->format( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( is_numeric( $timestamp ) ) {\n\t\t\treturn $this->DB->addQuotes( $timestamp );\n\t\t}\n\t\treturn 0;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " void ampersand() {\n final PathAndQuery res = PathAndQuery.parse(\"/&?a=1&a=2&b=3\");\n assertThat(res).isNotNull();\n assertThat(res.path()).isEqualTo(\"/&\");\n assertThat(res.query()).isEqualTo(\"a=1&a=2&b=3\");\n\n // '%26' in a query string should never be decoded into '&'.\n final PathAndQuery res2 = PathAndQuery.parse(\"/%26?a=1%26a=2&b=3\");\n assertThat(res2).isNotNull();\n assertThat(res2.path()).isEqualTo(\"/&\");\n assertThat(res2.query()).isEqualTo(\"a=1%26a=2&b=3\");\n }", "label": 0, "label_name": "vulnerable"} +{"code": "0;k evar\n Log.add_error(request, evar)\n end\n \n attrs = ActionController::Parameters.new({status: Workflow::STATUS_ACTIVE, issued_at: Time.now})\n @workflow.update_attributes(attrs.permit(Workflow::PERMIT_BASE))\n\n @orders = @workflow.get_orders\n\n render(:partial => 'ajax_workflow', :layout => false)\n end", "label": 0, "label_name": "vulnerable"} +{"code": " recyclebin::sendToRecycleBin($loc, $parent);\r\n //FIXME if we delete the module & sectionref the module completely disappears\r\n// if (class_exists($secref->module)) {\r\n// $modclass = $secref->module;\r\n// //FIXME: more module/controller glue code\r\n// if (expModules::controllerExists($modclass)) {\r\n// $modclass = expModules::getControllerClassName($modclass);\r\n// $mod = new $modclass($loc->src);\r\n// $mod->delete_instance();\r\n// } else {\r\n// $mod = new $modclass();\r\n// $mod->deleteIn($loc);\r\n// }\r\n// }\r\n }\r\n// $db->delete('sectionref', 'section=' . $parent);\r\n $db->delete('section', 'parent=' . $parent);\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": " public function test19176()\n {\n $foo = new Net_URL2('http://www.example.com');\n $test = $foo->resolve('test.html')->getURL();\n $this->assertEquals('http://www.example.com/test.html', $test);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testNormal()\n {\n $this->assertResult('\"\"');\n }", "label": 1, "label_name": "safe"} +{"code": "mxCellRenderer.prototype.destroy=function(u){D.apply(this,arguments);null!=u.secondLabel&&(u.secondLabel.destroy(),u.secondLabel=null)};mxCellRenderer.prototype.getShapesForState=function(u){return[u.shape,u.text,u.secondLabel,u.control]};var G=mxGraphView.prototype.resetValidationState;mxGraphView.prototype.resetValidationState=function(){G.apply(this,arguments);this.enumerationState=0};var P=mxGraphView.prototype.stateValidated;mxGraphView.prototype.stateValidated=function(u){null!=u.shape&&this.redrawEnumerationState(u);\nreturn P.apply(this,arguments)};mxGraphView.prototype.createEnumerationValue=function(u){u=decodeURIComponent(mxUtils.getValue(u.style,\"enumerateValue\",\"\"));\"\"==u&&(u=++this.enumerationState);return'
    '+mxUtils.htmlEntities(u)+\"
    \"};mxGraphView.prototype.redrawEnumerationState=function(u){var E=\"1\"==mxUtils.getValue(u.style,\"enumerate\",0);E&&null==u.secondLabel?(u.secondLabel=new mxText(\"\",new mxRectangle,mxConstants.ALIGN_LEFT,", "label": 0, "label_name": "vulnerable"} +{"code": "function get_def($DB, $table) {\n\n $def = \"### Dump table $table\\n\\n\";\n $def .= \"DROP TABLE IF EXISTS `$table`;\\n\";\n\n $query = \"SHOW CREATE TABLE `$table`\";\n $result = $DB->query($query);\n $DB->query(\"SET SESSION sql_quote_show_create = 1\");\n $row = $DB->fetch_row($result);\n\n $def .= preg_replace(\"/AUTO_INCREMENT=\\w+/i\", \"\", $row[1]);\n $def .= \";\";\n return $def.\"\\n\\n\";\n}", "label": 0, "label_name": "vulnerable"} +{"code": "openTagClose:function(b,a){var c=this._.rules[b];a?(this._.output.push(this.selfClosingEnd),c&&c.breakAfterClose&&(this._.needsSpace=c.needsSpace)):(this._.output.push(\">\"),c&&c.indent&&(this._.indentation+=this.indentationChars));c&&c.breakAfterOpen&&this.lineBreak();\"pre\"==b&&(this._.inPre=1)},attribute:function(b,a){\"string\"==typeof a&&(this.forceSimpleAmpersand&&(a=a.replace(/&/g,\"&\")),a=CKEDITOR.tools.htmlEncodeAttr(a));this._.output.push(\" \",b,'=\"',a,'\"')},closeTag:function(b){var a=this._.rules[b];\na&&a.indent&&(this._.indentation=this._.indentation.substr(this.indentationChars.length));this._.indent?this.indentation():a&&a.breakBeforeClose&&(this.lineBreak(),this.indentation());this._.output.push(\"\");\"pre\"==b&&(this._.inPre=0);a&&a.breakAfterClose&&(this.lineBreak(),this._.needsSpace=a.needsSpace);this._.afterCloser=1},text:function(b){this._.indent&&(this.indentation(),!this._.inPre&&(b=CKEDITOR.tools.ltrim(b)));this._.output.push(b)},comment:function(b){this._.indent&&this.indentation();", "label": 1, "label_name": "safe"} +{"code": " private def parseBadThing(): String = try {\n parse(\"\"\"{\"user\":\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"<}\"\"\")\n \"x\" * 1000\n } catch {\n case e: Throwable => e.getMessage\n }\n\n\n \"JSON Parser Specification\".title", "label": 1, "label_name": "safe"} +{"code": "mxCellRenderer.prototype.destroy=function(u){E.apply(this,arguments);null!=u.secondLabel&&(u.secondLabel.destroy(),u.secondLabel=null)};mxCellRenderer.prototype.getShapesForState=function(u){return[u.shape,u.text,u.secondLabel,u.control]};var G=mxGraphView.prototype.resetValidationState;mxGraphView.prototype.resetValidationState=function(){G.apply(this,arguments);this.enumerationState=0};var P=mxGraphView.prototype.stateValidated;mxGraphView.prototype.stateValidated=function(u){null!=u.shape&&this.redrawEnumerationState(u);\nreturn P.apply(this,arguments)};mxGraphView.prototype.createEnumerationValue=function(u){u=decodeURIComponent(mxUtils.getValue(u.style,\"enumerateValue\",\"\"));\"\"==u&&(u=++this.enumerationState);return'
    '+mxUtils.htmlEntities(u)+\"
    \"};mxGraphView.prototype.redrawEnumerationState=function(u){var D=\"1\"==mxUtils.getValue(u.style,\"enumerate\",0);D&&null==u.secondLabel?(u.secondLabel=new mxText(\"\",new mxRectangle,mxConstants.ALIGN_LEFT,", "label": 1, "label_name": "safe"} +{"code": "func (p *CompactProtocol) ReadFieldBegin() (name string, typeId Type, id int16, err error) {\n\tt, err := p.readByteDirect()\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// if it's a stop, then we can return immediately, as the struct is over.\n\tif (t & 0x0f) == STOP {\n\t\treturn \"\", STOP, 0, nil\n\t}\n\n\t// mask off the 4 MSB of the type header. it could contain a field id delta.\n\tmodifier := int16((t & 0xf0) >> 4)\n\tif modifier == 0 {\n\t\t// not a delta. look ahead for the zigzag varint field id.\n\t\tid, err = p.ReadI16()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t} else {\n\t\t// has a delta. add the delta to the last read field id.\n\t\tid = int16(p.lastFieldIDRead) + modifier\n\t}\n\ttypeId, e := p.getType(compactType(t & 0x0f))\n\tif e != nil {\n\t\terr = NewProtocolException(e)\n\t\treturn\n\t}\n\n\t// if this happens to be a boolean field, the value is encoded in the type\n\tif p.isBoolType(t) {\n\t\t// save the boolean value in a special instance variable.\n\t\tp.boolValue = (byte(t)&0x0f == COMPACT_BOOLEAN_TRUE)\n\t\tp.boolValueIsNotNull = true\n\t}\n\n\t// push the new field onto the field stack so we can keep the deltas going.\n\tp.lastFieldIDRead = int(id)\n\treturn\n}", "label": 0, "label_name": "vulnerable"} +{"code": "void CoreNetwork::putCmd(const QString &cmd, const QList> ¶ms, const QByteArray &prefix)\n{\n QListIterator> i(params);\n while (i.hasNext()) {\n QList msg = i.next();\n putCmd(cmd, msg, prefix);\n }\n}", "label": 1, "label_name": "safe"} +{"code": " public static void Reopen(string accountCode)\n {\n // PUT /accounts//reopen\n Client.Instance.PerformRequest(Client.HttpRequestMethod.Put,\n Account.UrlPrefix + Uri.EscapeDataString(accountCode) + \"/reopen\");\n }", "label": 1, "label_name": "safe"} +{"code": " public function checkAuthorisation($id, $user, $write)\n {\n // fetch the bare template\n $template = $this->find('first', array(\n 'conditions' => array('id' => $id),\n 'recursive' => -1,\n ));\n\n // if not found return false\n if (empty($template)) {\n return false;\n }\n\n //if the user is a site admin, return the template withoug question\n if ($user['Role']['perm_site_admin']) {\n return $template;\n }\n\n if ($write) {\n // if write access is requested, check if template belongs to user's org and whether the user is authorised to edit templates\n if ($user['Organisation']['name'] == $template['Template']['org'] && $user['Role']['perm_template']) {\n return $template;\n }\n return false;\n } else {\n\n // if read access is requested, check if the template belongs to the user's org or alternatively whether the template is shareable\n if ($user['Organisation']['name'] == $template['Template']['org'] || $template['Template']['share']) {\n return $template;\n }\n return false;\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "lspci_process(STREAM s)\n{\n\tunsigned int pkglen;\n\tstatic char *rest = NULL;\n\tchar *buf;\n\tstruct stream packet = *s;\n\n\tif (!s_check(s))\n\t{\n\t\trdp_protocol_error(\"lspci_process(), stream is in unstable state\", &packet);\n\t}\n\n\tpkglen = s->end - s->p;\n\t/* str_handle_lines requires null terminated strings */\n\tbuf = xmalloc(pkglen + 1);\n\tSTRNCPY(buf, (char *) s->p, pkglen + 1);\n\tstr_handle_lines(buf, &rest, lspci_process_line, NULL);\n\txfree(buf);\n}", "label": 1, "label_name": "safe"} +{"code": " it \"adds the credentials to the auth cache\" do\n socket.login(:admin, \"username\", \"password\")\n socket.auth.should eq(\"admin\" => [\"username\", \"password\"])\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function validateId($id)\n {\n $id_string = $id->toString();\n $this->context[] = \"id '$id_string'\";\n if (!$id instanceof HTMLPurifier_ConfigSchema_Interchange_Id) {\n // handled by InterchangeBuilder\n $this->error(false, 'is not an instance of HTMLPurifier_ConfigSchema_Interchange_Id');\n }\n // keys are now unconstrained (we might want to narrow down to A-Za-z0-9.)\n // we probably should check that it has at least one namespace\n $this->with($id, 'key')\n ->assertNotEmpty()\n ->assertIsString(); // implicit assertIsString handled by InterchangeBuilder\n array_pop($this->context);\n }", "label": 1, "label_name": "safe"} +{"code": " public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n try {\n UserFactory.init();\n } catch (Throwable e) {\n throw new ServletException(\"AddNewUserServlet: Error initialising user factory.\" + e);\n }\n UserManager userFactory = UserFactory.getInstance();\n\n String userID = request.getParameter(\"userID\");\n\n if (userID != null && userID.matches(\".*[&<>\\\"`']+.*\")) {\n throw new ServletException(\"User ID must not contain any HTML markup.\");\n }\n\n String password = request.getParameter(\"pass1\");\n\n boolean hasUser = false;\n try {\n hasUser = userFactory.hasUser(userID);\n } catch (Throwable e) {\n throw new ServletException(\"can't determine if user \" + userID + \" already exists in users.xml.\", e);\n }\n\n if (hasUser) {\n RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher(\"/admin/userGroupView/users/newUser.jsp?action=redo\");\n dispatcher.forward(request, response);\n } else {\n final Password pass = new Password();\n pass.setEncryptedPassword(UserFactory.getInstance().encryptedPassword(password, true));\n pass.setSalt(true);\n\n final User newUser = new User();\n newUser.setUserId(userID);\n newUser.setPassword(pass);\n\n final HttpSession userSession = request.getSession(false);\n userSession.setAttribute(\"user.modifyUser.jsp\", newUser);\n\n // forward the request for proper display\n RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher(\"/admin/userGroupView/users/modifyUser.jsp\");\n dispatcher.forward(request, response);\n }\n }", "label": 1, "label_name": "safe"} +{"code": "static void _perf_event_reset(struct perf_event *event)\n{\n\t(void)perf_event_read(event);\n\tlocal64_set(&event->count, 0);\n\tperf_event_update_userpage(event);\n}", "label": 1, "label_name": "safe"} +{"code": " def test_oauth_login_next(self):\n \"\"\"\n OAuth: Test login next\n \"\"\"\n client = self.app.test_client()\n\n self.appbuilder.sm.oauth_remotes = {\"google\": OAuthRemoteMock()}\n\n raw_state = {\"next\": [\"http://localhost/users/list/\"]}\n state = jwt.encode(raw_state, self.app.config[\"SECRET_KEY\"], algorithm=\"HS256\")\n\n response = client.get(f\"/oauth-authorized/google?state={state.decode('utf-8')}\")\n self.assertEqual(response.location, \"http://localhost/users/list/\")", "label": 1, "label_name": "safe"} +{"code": " public function configure() {\n $this->config['defaultbanner'] = array();\n if (!empty($this->config['defaultbanner_id'])) {\n $this->config['defaultbanner'][] = new expFile($this->config['defaultbanner_id']);\n }\n\t parent::configure();\n\t $banners = $this->banner->find('all', null, 'companies_id');\n\t assign_to_template(array(\n 'banners'=>$banners,\n 'title'=>static::displayname()\n ));\n\t}", "label": 1, "label_name": "safe"} +{"code": " foreach ($mergedPermissions as $mergedPermission => $value) {\n // Strip the '*' off the beginning of the permission.\n $checkPermission = substr($permission, 1);\n\n // We will make sure that the merged permission does not\n // exactly match our permission, but ends with it.\n if ($checkPermission != $mergedPermission && ends_with($mergedPermission, $checkPermission) && $value === 1) {\n $matched = true;\n break;\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": " eval: function (env) {\n var that = this;\n var value = this.value.replace(/`([^`]+)`/g, function (_, exp) {\n return new(tree.JavaScript)(exp, that.index, true).eval(env).value;\n }).replace(/@\\{([\\w-]+)\\}/g, function (_, name) {\n var v = new(tree.Variable)('@' + name, that.index, that.currentFileInfo).eval(env, true);\n return (v instanceof tree.Quoted) ? v.value : v.toCSS();\n });\n return new(tree.Quoted)(this.quote + value + this.quote, value, this.escaped, this.index, this.currentFileInfo);\n },", "label": 0, "label_name": "vulnerable"} +{"code": " def loadMyPageData(pageIds: St): Action[U] = GetAction2(RateLimits.ReadsFromDb,\n MinAuthnStrength.EmbeddingStorageSid12) { request =>", "label": 1, "label_name": "safe"} +{"code": "static RList *r_bin_wasm_get_global_entries (RBinWasmObj *bin, RBinWasmSection *sec) {\n\tRList *ret = NULL;\n\tRBinWasmGlobalEntry *ptr = NULL;\n\tint buflen = bin->buf->length;\n\tif (sec->payload_data + 32 > buflen) {\n\t\treturn NULL;\n\t}\n\n\tif (!(ret = r_list_newf ((RListFree)free))) {\n\t\treturn NULL;\n\t}\n\n\tut8* buf = bin->buf->buf + (ut32)sec->payload_data;\n\tut32 len = sec->payload_len;\n\tut32 count = sec->count;\n\tut32 i = 0, r = 0;\n\n\twhile (i < len && len < buflen && r < count) {\n\t\tif (!(ptr = R_NEW0 (RBinWasmGlobalEntry))) {\n\t\t\treturn ret;\n\t\t}\n\n\t\tif (len + 8 > buflen || !(consume_u8 (buf + i, buf + len, (ut8*)&ptr->content_type, &i))) {\n\t\t\tgoto beach;\n\t\t}\n\t\tif (len + 8 > buflen || !(consume_u8 (buf + i, buf + len, &ptr->mutability, &i))) {\n\t\t\tgoto beach;\n\t\t}\n\t\tif (len + 8 > buflen || !(consume_init_expr (buf + i, buf + len, R_BIN_WASM_END_OF_CODE, NULL, &i))) {\n\t\t\tgoto beach;\n\t\t}\n\t\tr_list_append (ret, ptr);\n\t\tr++;\n\t}\n\treturn ret;\nbeach:\n\tfree (ptr);\n\treturn ret;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function getMimetype()\n {\n return $this->filesystem->getMimetype($this->path);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "mxResources.get(\"ok\"),ba,fa,function(oa){var na=null!=oa&&0factory = HTMLPurifier_LanguageFactory::instance();\n parent::setUp();\n }", "label": 1, "label_name": "safe"} +{"code": "GraphViewer.processElements = function(classname)\n{\n\tmxUtils.forEach(GraphViewer.getElementsByClassName(classname || 'mxgraph'), function(div)\n\t{\n\t\ttry\n\t\t{\n\t\t\tdiv.innerText = '';\n\t\t\tGraphViewer.createViewerForElement(div);\n\t\t}\n\t\tcatch (e)\n\t\t{\n\t\t\tdiv.innerHTML = e.message;\n\t\t\t\n\t\t\tif (window.console != null)\n\t\t\t{\n\t\t\t\tconsole.error(e);\n\t\t\t}\n\t\t}\n\t});\n};", "label": 1, "label_name": "safe"} +{"code": "\tfunction notify($event) {\n\n\t\t$this->messages[] = $event;\n\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " def branches\n at_path { git_with_identity('branch', '-a') }.gsub('*', ' ').split(/\\n/).map { |line| line.strip }\n end", "label": 0, "label_name": "vulnerable"} +{"code": "!0,0,mxUtils.bind(this,function(e){this.hsplitPosition=e;this.refresh()})))};EditorUi.prototype.createStatusContainer=function(){var b=document.createElement(\"a\");b.className=\"geItem geStatus\";return b};EditorUi.prototype.setStatusText=function(b){this.statusContainer.innerHTML=b;0==this.statusContainer.getElementsByTagName(\"div\").length&&(this.statusContainer.innerHTML=\"\",b=this.createStatusDiv(b),this.statusContainer.appendChild(b))};", "label": 0, "label_name": "vulnerable"} +{"code": " it 'creates a new ongoing campaign' do\n post \"/api/v1/accounts/#{account.id}/campaigns\",\n params: { inbox_id: inbox.id, title: 'test', message: 'test message', trigger_rules: { url: 'https://test.com' } },\n headers: administrator.create_new_auth_token,\n as: :json\n\n expect(response).to have_http_status(:success)\n expect(JSON.parse(response.body, symbolize_names: true)[:title]).to eq('test')\n end", "label": 1, "label_name": "safe"} +{"code": "static void hugetlb_vm_op_close(struct vm_area_struct *vma)\n{\n\tstruct hstate *h = hstate_vma(vma);\n\tstruct resv_map *reservations = vma_resv_map(vma);\n\tstruct hugepage_subpool *spool = subpool_vma(vma);\n\tunsigned long reserve;\n\tunsigned long start;\n\tunsigned long end;\n\n\tif (reservations) {\n\t\tstart = vma_hugecache_offset(h, vma, vma->vm_start);\n\t\tend = vma_hugecache_offset(h, vma, vma->vm_end);\n\n\t\treserve = (end - start) -\n\t\t\tregion_count(&reservations->regions, start, end);\n\n\t\tkref_put(&reservations->refs, resv_map_release);\n\n\t\tif (reserve) {\n\t\t\thugetlb_acct_memory(h, -reserve);\n\t\t\thugepage_subpool_put_pages(spool, reserve);\n\t\t}\n\t}\n}", "label": 0, "label_name": "vulnerable"} +{"code": "async def account_register_post(\n request: Request,\n U: str = Form(default=str()), # Username\n E: str = Form(default=str()), # Email\n H: str = Form(default=\"off\"), # Hide Email\n BE: str = Form(default=None), # Backup Email\n R: str = Form(default=\"\"), # Real Name\n HP: str = Form(default=None), # Homepage\n I: str = Form(default=None), # IRC Nick # noqa: E741\n K: str = Form(default=None), # PGP Key\n L: str = Form(default=aurweb.config.get(\"options\", \"default_lang\")),\n TZ: str = Form(default=aurweb.config.get(\"options\", \"default_timezone\")),\n PK: str = Form(default=None), # SSH PubKey\n CN: bool = Form(default=False),\n UN: bool = Form(default=False),\n ON: bool = Form(default=False),\n captcha: str = Form(default=None),\n captcha_salt: str = Form(...),", "label": 1, "label_name": "safe"} +{"code": "TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {\n const TfLiteTensor* input = GetInput(context, node, 0);\n TfLiteTensor* output_index_tensor = GetOutput(context, node, 1);\n TF_LITE_ENSURE_EQ(context, NumElements(output_index_tensor),\n NumElements(input));\n\n switch (input->type) {\n case kTfLiteInt8:\n TF_LITE_ENSURE_STATUS(EvalImpl(context, input, node));\n break;\n case kTfLiteInt16:\n TF_LITE_ENSURE_STATUS(EvalImpl(context, input, node));\n break;\n case kTfLiteInt32:\n TF_LITE_ENSURE_STATUS(EvalImpl(context, input, node));\n break;\n case kTfLiteInt64:\n TF_LITE_ENSURE_STATUS(EvalImpl(context, input, node));\n break;\n case kTfLiteFloat32:\n TF_LITE_ENSURE_STATUS(EvalImpl(context, input, node));\n break;\n case kTfLiteUInt8:\n TF_LITE_ENSURE_STATUS(EvalImpl(context, input, node));\n break;\n default:\n context->ReportError(context, \"Currently Unique doesn't support type: %s\",\n TfLiteTypeGetName(input->type));\n return kTfLiteError;\n }\n return kTfLiteOk;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "void AnnotateIgnoreWritesBegin(const char *file, int line){}", "label": 0, "label_name": "vulnerable"} +{"code": "ka.size,ua,sa)):\"readOnly\"==wa?(sa=document.createElement(\"input\"),sa.setAttribute(\"readonly\",\"\"),sa.value=ta,sa.style.width=\"96px\",sa.style.borderWidth=\"0px\",xa.appendChild(sa)):(xa.innerHTML=mxUtils.htmlEntities(decodeURIComponent(ta)),mxEvent.addListener(xa,\"click\",mxUtils.bind(Z,function(){function da(){var la=ca.value;la=0==la.length&&\"string\"!=wa?0:la;ka.allowAuto&&(null!=la.trim&&\"auto\"==la.trim().toLowerCase()?(la=\"auto\",wa=\"string\"):(la=parseFloat(la),la=isNaN(la)?0:la));null!=ka.min&&la<\nka.min?la=ka.min:null!=ka.max&&la>ka.max&&(la=ka.max);la=encodeURIComponent((\"int\"==wa?parseInt(la):la)+\"\");T(Aa,la,ka)}var ca=document.createElement(\"input\");N(xa,ca,!0);ca.value=decodeURIComponent(ta);ca.className=\"gePropEditor\";\"int\"!=wa&&\"float\"!=wa||ka.allowAuto||(ca.type=\"number\",ca.step=\"int\"==wa?\"1\":\"any\",null!=ka.min&&(ca.min=parseFloat(ka.min)),null!=ka.max&&(ca.max=parseFloat(ka.max)));u.appendChild(ca);mxEvent.addListener(ca,\"keypress\",function(la){13==la.keyCode&&da()});ca.focus();mxEvent.addListener(ca,", "label": 0, "label_name": "vulnerable"} +{"code": "func ensureBasePath(root, base, target string) (string, error) {\n\tpath, err := filepath.Rel(base, target)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tcleanPath := filepath.ToSlash(filepath.Clean(path))\n\tif cleanPath == \"..\" || strings.HasPrefix(cleanPath, \"../\") {\n\t\treturn \"\", fmt.Errorf(\"%q is outside of %q\", target, base)\n\t}\n\n\t// No symbolic link allowed in the relative path\n\tdir := filepath.Dir(path)\n\tfor dir != \".\" {\n\t\tif info, err := os.Lstat(filepath.Join(root, dir)); err != nil {\n\t\t\tif !os.IsNotExist(err) {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t} else if info.Mode()&os.ModeSymlink != 0 {\n\t\t\treturn \"\", fmt.Errorf(\"no symbolic link allowed between %q and %q\", base, target)\n\t\t}\n\t\tdir = filepath.Dir(dir)\n\t}\n\n\treturn path, nil\n}", "label": 1, "label_name": "safe"} +{"code": "void Mounter::startTimer()\n{\n if (!timer) {\n timer=new QTimer(this);\n connect(timer, SIGNAL(timeout()), SLOT(timeout()));\n }\n timer->start(30000);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function add($def, $config)\n {\n return false;\n }", "label": 1, "label_name": "safe"} +{"code": " public function manage_messages() {\n expHistory::set('manageable', $this->params);\n\n $page = new expPaginator(array(\n\t\t\t'model'=>'order_status_messages',\n\t\t\t'where'=>1,\n 'limit'=>10,\n\t\t\t'order'=>'body',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n\t\t\t//'columns'=>array('Name'=>'title')\n ));\n\n //eDebug($page);\n\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }", "label": 1, "label_name": "safe"} +{"code": "CbrDetectorRemote::Result CbrDetectorRemote::Decrypt(cricket::MediaType media_type,\n\t\t\t\t\t\tconst std::vector& csrcs,\n\t\t\t\t\t\trtc::ArrayView additional_data,\n\t\t\t\t\t\trtc::ArrayView encrypted_frame,\n\t\t\t\t\t\trtc::ArrayView frame)\n{\n\tconst uint8_t *src = encrypted_frame.data();\n\tuint8_t *dst = frame.data();\n\tuint32_t data_len = encrypted_frame.size();\n\n\tif (media_type == cricket::MEDIA_TYPE_AUDIO) {\n\t\tif (data_len == frame_size && frame_size >= 40) {\n\t\t\tmissmatch_count = 0;\n\t\t\tframe_count++;\n\t\t\tif (frame_count > MIN_MATCH && !detected) {\n\t\t\t\tinfo(\"CBR detector: remote cbr detected\\n\");\n\t\t\t\tdetected = true;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tmissmatch_count++;\n\t\t\tif (!detected\n\t\t\t || (detected && missmatch_count > MAX_MISSMATCH)) {\n\t\t\t\tframe_count = 0;\n\t\t\t\tframe_size = data_len;\n\t\t\t\tmissmatch_count = 0;\n\t\t\t\tif (detected) {\n\t\t\t\t\tinfo(\"CBR detector: remote cbr detected disabled\\n\");\n\t\t\t\t\tdetected = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tmemcpy(dst, src, data_len);\n\nout:\n\treturn CbrDetectorRemote::Result(CbrDetectorRemote::Status::kOk, data_len);\n}", "label": 1, "label_name": "safe"} +{"code": "fn should_disallow_non_get_requests() {\n\t// given\n\tlet (server, fetch) = serve_with_fetch(\"token\", \"https://parity.io\");\n\n\t// when\n\tlet response = request(server,\n\t\t\"\\\n\t\t\tPOST / HTTP/1.1\\r\\n\\\n\t\t\tHost: EHQPPSBE5DM78X3GECX2YBVGC5S6JX3S5SMPY.web.web3.site\\r\\n\\\n\t\t\tContent-Type: application/json\\r\\n\\\n\t\t\tConnection: close\\r\\n\\\n\t\t\t\\r\\n\\\n\t\t\t123\\r\\n\\\n\t\t\t\\r\\n\\\n\t\t\"\n\t);\n\n\t// then\n\tresponse.assert_status(\"HTTP/1.1 405 Method Not Allowed\");\n\tassert_security_headers_for_embed(&response.headers);\n\n\tfetch.assert_no_more_requests();\n}", "label": 1, "label_name": "safe"} +{"code": " def test_equal_body(self):\n # check server doesnt close connection when body is equal to\n # cl header\n to_send = tobytes(\n \"GET /equal_body HTTP/1.0\\n\"\n \"Connection: Keep-Alive\\n\"\n \"Content-Length: 0\\n\"\n \"\\n\"\n )\n self.connect()\n self.sock.send(to_send)\n fp = self.sock.makefile(\"rb\", 0)\n line, headers, response_body = read_http(fp)\n content_length = int(headers.get(\"content-length\")) or None\n self.assertEqual(content_length, 9)\n self.assertline(line, \"200\", \"OK\", \"HTTP/1.0\")\n self.assertEqual(content_length, len(response_body))\n self.assertEqual(response_body, tobytes(\"abcdefghi\"))\n # remote does not close connection (keepalive header)\n self.sock.send(to_send)\n fp = self.sock.makefile(\"rb\", 0)\n line, headers, response_body = read_http(fp)\n self.assertline(line, \"200\", \"OK\", \"HTTP/1.0\")", "label": 0, "label_name": "vulnerable"} +{"code": " var doSynchronize = function(requisition, rescanExisting) {\n RequisitionsService.startTiming();\n RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then(\n function() { // success\n growl.success('The import operation has been started for ' + requisition.foreignSource + ' (rescanExisting? ' + rescanExisting + ')
    Use refresh to update the deployed statistics');\n requisition.setDeployed(true);\n },\n errorHandler\n );\n };", "label": 0, "label_name": "vulnerable"} +{"code": "init_ext2_xattr(void)\n{\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\tprotected function removeNetVolume($key) {\n\t\t$netVolumes = $this->getNetVolumes();\n\t\tif (is_string($key) && isset($netVolumes[$key])) {\n\t\t\tunset($netVolumes[$key]);\n\t\t\t$this->saveNetVolumes($netVolumes);\n\t\t}\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function getPrintAndMailLink($icmsObj) {\r\n\t\tglobal $icmsConfig, $impresscms;\r\n\r\n\t\t$ret = '';\r\n\t\t/*\t\t$printlink = $this->handler->_moduleUrl . \"print.php?\" . $this->handler->keyName . \"=\" . $icmsObj->getVar($this->handler->keyName);\r\n\t\t $js = \"javascript:openWithSelfMain('\" . $printlink . \"', 'smartpopup', 700, 519);\";\r\n\t\t $printlink = '\"\"';\r\n\r\n\t\t $icmsModule = icms_getModuleInfo($icmsObj->handler->_moduleName);\r\n\t\t $link = $impresscms->urls['full']();\r\n\t\t $mid = $icmsModule->getVar('mid');\r\n\t\t $friendlink = \"\\\"\"\";\r\n\r\n\t\t $ret = '' . $printlink . \" \" . '' . $friendlink . '';\r\n\t\t */\r\n\t\treturn $ret;\r\n\t}\r", "label": 0, "label_name": "vulnerable"} +{"code": " window._load_metadata = function(ev, viewport) {\n\n /* Image details */\n var tmp = viewport.getMetadata();\n $('#wblitz-image-name').html(tmp.imageName.escapeHTML());\n $('#wblitz-image-description-content').html(tmp.imageDescription.escapeHTML().replace(/\\n/g, '
    '));\n $('#wblitz-image-author').html(tmp.imageAuthor.escapeHTML());\n $('#wblitz-image-pub').html(tmp.projectName.escapeHTML());\n $('#wblitz-image-pubid').html(tmp.projectId);\n $('#wblitz-image-timestamp').html(tmp.imageTimestamp);\n\n $(\"#bulk-annotations\").hide();\n $(\"#bulk-annotations\").next().hide();\n if (tmp.wellId) {\n\n var wellsUrl = PLATE_WELLS_URL_999.replace('999', tmp.wellId),\n linksUrl = PLATE_LINKS_URL_999.replace('999', tmp.wellId);\n loadBulkAnnotations(wellsUrl, 'Well-' + tmp.wellId);\n loadBulkAnnotations(linksUrl, 'Well-' + tmp.wellId);\n }\n };", "label": 1, "label_name": "safe"} +{"code": "TEST_P(SslSocketTest, FailedClientAuthSanVerification) {\n const std::string client_ctx_yaml = R\"EOF(\n common_tls_context:\n tls_certificates:\n certificate_chain:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/no_san_cert.pem\"\n private_key:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/no_san_key.pem\"\n)EOF\";\n\n const std::string server_ctx_yaml = R\"EOF(\n common_tls_context:\n tls_certificates:\n certificate_chain:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_cert.pem\"\n private_key:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_key.pem\"\n validation_context:\n trusted_ca:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem\"\n match_subject_alt_names:\n exact: \"example.com\"\n)EOF\";\n\n TestUtilOptions test_options(client_ctx_yaml, server_ctx_yaml, false, GetParam());\n testUtil(test_options.setExpectedServerStats(\"ssl.fail_verify_san\"));\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function Insert()\n\t{\n\t\t$ins_stmt = Database::prepare(\"\n\t\t\tINSERT INTO `\" . TABLE_PANEL_TICKETS . \"` SET\n `customerid` = :customerid,\n `adminid` = :adminid,\n `category` = :category,\n `priority` = :priority,\n `subject` = :subject,\n `message` = :message,\n `dt` = :dt,\n `lastchange` = :lastchange,\n `ip` = :ip,\n `status` = :status,\n `lastreplier` = :lastreplier,\n `by` = :by,\n `answerto` = :answerto\");\n\t\t$ins_data = array(\n\t\t\t'customerid' => $this->Get('customer'),\n\t\t\t'adminid' => $this->Get('admin'),\n\t\t\t'category' => $this->Get('category'),\n\t\t\t'priority' => $this->Get('priority'),\n\t\t\t'subject' => $this->Get('subject'),\n\t\t\t'message' => $this->Get('message'),\n\t\t\t'dt' => time(),\n\t\t\t'lastchange' => time(),\n\t\t\t'ip' => $this->Get('ip'),\n\t\t\t'status' => $this->Get('status'),\n\t\t\t'lastreplier' => $this->Get('lastreplier'),\n\t\t\t'by' => $this->Get('by'),\n\t\t\t'answerto' => $this->Get('answerto')\n\t\t);\n\t\tDatabase::pexecute($ins_stmt, $ins_data);\n\t\t$this->tid = Database::lastInsertId();\n\t\treturn true;\n\t}", "label": 1, "label_name": "safe"} +{"code": " it 'returns a charset' do\n instance.charset.should == 'latin1'\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function testReplaceArgumentShouldCheckBounds()\n {\n $def = new Definition('stdClass');\n\n $def->addArgument('foo');\n $def->replaceArgument(1, 'bar');\n }", "label": 0, "label_name": "vulnerable"} +{"code": "AP4_AvccAtom::InspectFields(AP4_AtomInspector& inspector)\n{\n inspector.AddField(\"Configuration Version\", m_ConfigurationVersion);\n const char* profile_name = GetProfileName(m_Profile);\n if (profile_name) {\n inspector.AddField(\"Profile\", profile_name);\n } else {\n inspector.AddField(\"Profile\", m_Profile);\n }\n inspector.AddField(\"Profile Compatibility\", m_ProfileCompatibility, AP4_AtomInspector::HINT_HEX);\n inspector.AddField(\"Level\", m_Level);\n inspector.AddField(\"NALU Length Size\", m_NaluLengthSize);\n for (unsigned int i=0; inum_values + 1);\n\n int j;\n for (j = 0; j < a->num_values; j++)\n {\n\tbody[j] = XMALLOC(VarLenData, 1);\n\tbody[j]->len = a->values[j].len;\n\tbody[j]->data = CHECKED_XCALLOC(unsigned char, a->values[j].len);\n\tmemmove (body[j]->data, a->values[j].data.buf, body[j]->len);\n }\n return body;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "static int pn_recvmsg(struct kiocb *iocb, struct sock *sk,\n\t\t\tstruct msghdr *msg, size_t len, int noblock,\n\t\t\tint flags, int *addr_len)\n{\n\tstruct sk_buff *skb = NULL;\n\tstruct sockaddr_pn sa;\n\tint rval = -EOPNOTSUPP;\n\tint copylen;\n\n\tif (flags & ~(MSG_PEEK|MSG_TRUNC|MSG_DONTWAIT|MSG_NOSIGNAL|\n\t\t\tMSG_CMSG_COMPAT))\n\t\tgoto out_nofree;\n\n\tif (addr_len)\n\t\t*addr_len = sizeof(sa);\n\n\tskb = skb_recv_datagram(sk, flags, noblock, &rval);\n\tif (skb == NULL)\n\t\tgoto out_nofree;\n\n\tpn_skb_get_src_sockaddr(skb, &sa);\n\n\tcopylen = skb->len;\n\tif (len < copylen) {\n\t\tmsg->msg_flags |= MSG_TRUNC;\n\t\tcopylen = len;\n\t}\n\n\trval = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copylen);\n\tif (rval) {\n\t\trval = -EFAULT;\n\t\tgoto out;\n\t}\n\n\trval = (flags & MSG_TRUNC) ? skb->len : copylen;\n\n\tif (msg->msg_name != NULL)\n\t\tmemcpy(msg->msg_name, &sa, sizeof(struct sockaddr_pn));\n\nout:\n\tskb_free_datagram(sk, skb);\n\nout_nofree:\n\treturn rval;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " $scope.provision = function() {\n $scope.isSaving = true;\n growl.info($sanitize('The node ' + $scope.node.nodeLabel + ' is being added to requisition ' + $scope.node.foreignSource + '. Please wait...'));\n var successMessage = $sanitize('The node ' + $scope.node.nodeLabel + ' has been added to requisition ' + $scope.node.foreignSource);\n RequisitionsService.quickAddNode($scope.node).then(\n function() { // success\n $scope.reset();\n bootbox.dialog({\n message: successMessage,\n title: 'Success',\n buttons: {\n main: {\n label: 'Ok',\n className: 'btn-secondary'\n }\n }\n });\n },\n $scope.errorHandler\n );\n };", "label": 0, "label_name": "vulnerable"} +{"code": " public function testRegisteredEvent()\n {\n $this->assertEquals(\n array(KernelEvents::REQUEST => 'onKernelRequest'),\n AddRequestFormatsListener::getSubscribedEvents()\n );\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testMagicSetGet()\n {\n $url = new Net_URL2('');\n\n $property = 'authority';\n $url->$property = $value = 'value';\n $this->assertEquals($value, $url->$property);\n\n $property = 'unsetProperty';\n $url->$property = $value;\n $this->assertEquals(false, $url->$property);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " it \"sets the request id\" do\n reply.request_id.should eq 1\n end", "label": 0, "label_name": "vulnerable"} +{"code": " it 'should have loopback network (127.0.0.0)' do\n expect(subject.call(['127.0.0.1'])).to be_truthy\n end", "label": 0, "label_name": "vulnerable"} +{"code": " value = value.replace(/href=\" *javascript\\:(.*?)\"/gi, function(m, $1) {\n return 'removed=\"\"';\n });", "label": 1, "label_name": "safe"} +{"code": " this.disableChatSoundAdmin = function(inst)\n {\n if (inst.prop('tagName') != 'I') {\n inst = inst.find('> i.material-icons');\n }\n\n \tif (inst.text() == 'volume_off'){\n \t\t$.get(this.wwwDir+ 'user/setsettingajax/chat_message/1');\n \t\tconfLH.new_message_sound_admin_enabled = 1;\n \t\tinst.text('volume_up');\n \t} else {\n \t\t$.get(this.wwwDir+ 'user/setsettingajax/chat_message/0');\n \t\tconfLH.new_message_sound_admin_enabled = 0;\n \t\tinst.text('volume_off');\n \t}\n \treturn false;\n };", "label": 0, "label_name": "vulnerable"} +{"code": " public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, \\Exception $e)\n {\n parent::__construct($kernel, $request, $requestType);\n\n $this->setException($e);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " it \"can sort documents\" do\n session[:people].insert([{name: \"John\"}, {name: \"Mary\"}])\n session[:people].find.sort(_id: -1).first[\"name\"].should eq \"Mary\"\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public RecurlyList GetNotes()\n {\n return new NoteList(UrlPrefix + Uri.EscapeUriString(AccountCode) + \"/notes/\");\n }", "label": 0, "label_name": "vulnerable"} +{"code": "this.$.appendChild(a.$);return a},appendHtml:function(a){if(this.$.childNodes.length){var b=new CKEDITOR.dom.element(\"div\",this.getDocument());b.setHtml(a);b.moveChildren(this)}else this.setHtml(a)},appendText:function(a){this.$.text!=void 0?this.$.text=this.$.text+a:this.append(new CKEDITOR.dom.text(a))},appendBogus:function(a){if(a||CKEDITOR.env.needsBrFiller||CKEDITOR.env.opera){for(a=this.getLast();a&&a.type==CKEDITOR.NODE_TEXT&&!CKEDITOR.tools.rtrim(a.getText());)a=a.getPrevious();if(!a||!a.is||", "label": 1, "label_name": "safe"} +{"code": " public static function navtojson() {\n return json_encode(self::navhierarchy());\n }", "label": 1, "label_name": "safe"} +{"code": "\tpublic Map> getCustomConfig(CourseEnvironment courseEnvironment){\n\t\tMap> defaultConf = new HashMap<>();\n\t\tVFSContainer base = (VFSContainer) courseEnvironment.getCourseBaseContainer().resolve(CourseLayoutHelper.LAYOUT_COURSE_SUBFOLDER);\n\t\tif (base == null) {\n\t\t\treturn defaultConf;\n\t\t}\n\t\tVFSContainer themeBase = (VFSContainer) base.resolve(\"/\" + CourseLayoutHelper.CONFIG_KEY_CUSTOM);\n\t\tif (themeBase == null) {\n\t\t\treturn defaultConf;\n\t\t}\n\t\tVFSLeaf configTarget = (VFSLeaf) themeBase.resolve(CUSTOM_CONFIG_XML);\n\t\tif (configTarget == null) {\n\t\t\treturn defaultConf;\n\t\t}\n\t\ttry(InputStream in=configTarget.getInputStream()) {\n\t\t\treturn (Map>) xstream.fromXML(in);\n\t\t} catch(IOException e) {\n\t\t\tlog.error(\"\", e);\n\t\t\treturn defaultConf;\n\t\t}\n\t}", "label": 1, "label_name": "safe"} +{"code": "\tpublic function ls($hash, $intersect = null) {\n\t\tif (($dir = $this->dir($hash)) == false || !$dir['read']) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t$list = array();\n\t\t$path = $this->decode($hash);\n\t\t\n\t\t$check = array();\n\t\tif ($intersect) {\n\t\t\t$check = array_flip($intersect);\n\t\t}\n\t\t\n\t\tforeach ($this->getScandir($path) as $stat) {\n\t\t\tif (empty($stat['hidden']) && (!$check || isset($check[$stat['name']])) && $this->mimeAccepted($stat['mime'])) {\n\t\t\t\t$list[$stat['hash']] = $stat['name'];\n\t\t\t}\n\t\t}\n\n\t\treturn $list;\n\t}", "label": 1, "label_name": "safe"} +{"code": "!1;null!=H&&(S=\"1\"==y.getCurrentCellStyle(H).treeMoving);return S}function t(H){var S=!1;null!=H&&(H=A.getParent(H),S=y.view.getState(H),S=\"tree\"==(null!=S?S.style:y.getCellStyle(H)).containerType);return S}function D(H){var S=!1;null!=H&&(H=A.getParent(H),S=y.view.getState(H),y.view.getState(H),S=null!=(null!=S?S.style:y.getCellStyle(H)).childLayout);return S}function c(H){H=y.view.getState(H);if(null!=H){var S=y.getIncomingTreeEdges(H.cell);if(0data[$name] = $value;\n }", "label": 1, "label_name": "safe"} +{"code": " get: function(name, del){\r\n // #ifdef debug\r\n this._trace(\"retrieving function \" + name);\r\n // #endif\r\n if (!_map.hasOwnProperty(name)) {\r\n return;\r\n }\r\n var fn = _map[name];\r\n // #ifdef debug\r\n if (!fn) {\r\n this._trace(name + \" not found\");\r\n }\r\n // #endif\r\n \r\n if (del) {\r\n delete _map[name];\r\n }\r\n return fn;\r\n }\r", "label": 1, "label_name": "safe"} +{"code": "\t\tformat: function (element, content) {\n\t\t\tvar author = '',\n\t\t\t\t$elm = $(element),\n\t\t\t\t$cite = $elm.children('cite').first();\n\t\t\t$cite.html($cite.text());\n\n\t\t\tif ($cite.length === 1 || $elm.data('author')) {\n\t\t\t\tauthor = $cite.text() || $elm.data('author');\n\n\t\t\t\t$elm.data('author', author);\n\t\t\t\t$cite.remove();\n\n\t\t\t\tcontent = this.elementToBbcode(element);\n\t\t\t\tauthor = '=' + author.replace(/(^\\s+|\\s+$)/g, '');\n\n\t\t\t\t$elm.prepend($cite);\n\t\t\t}\n\n\t\t\tif ($elm.data('pid'))\n\t\t\t\tauthor += \" pid='\" + $elm.data('pid') + \"'\";\n\n\t\t\tif ($elm.data('dateline'))\n\t\t\t\tauthor += \" dateline='\" + $elm.data('dateline') + \"'\";\n\n\t\t\treturn '[quote' + author + ']' + content + '[/quote]';\n\t\t},", "label": 0, "label_name": "vulnerable"} +{"code": "check_lnums_both(int do_curwin, int nested)\n{\n win_T\t*wp;\n tabpage_T\t*tp;\n\n FOR_ALL_TAB_WINDOWS(tp, wp)\n\tif ((do_curwin || wp != curwin) && wp->w_buffer == curbuf)\n\t{\n\t if (!nested)\n\t {\n\t\t// save the original cursor position and topline\n\t\twp->w_save_cursor.w_cursor_save = wp->w_cursor;\n\t\twp->w_save_cursor.w_topline_save = wp->w_topline;\n\t }\n\n\t if (wp->w_cursor.lnum > curbuf->b_ml.ml_line_count)\n\t\twp->w_cursor.lnum = curbuf->b_ml.ml_line_count;\n\t if (wp->w_topline > curbuf->b_ml.ml_line_count)\n\t\twp->w_topline = curbuf->b_ml.ml_line_count;\n\n\t // save the (corrected) cursor position and topline\n\t wp->w_save_cursor.w_cursor_corr = wp->w_cursor;\n\t wp->w_save_cursor.w_topline_corr = wp->w_topline;\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": "\tthis.getstate = function(sel) {\n\t\tvar sel = this.files(sel),\n\t\t\tcnt = sel.length;\n\t\t\t\n\t\treturn this.callback && cnt && filter(sel).length == cnt ? 0 : -1;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "K&&D(Editor.svgBrokenImage.src)});else{var N=new Image;this.crossOriginImages&&(N.crossOrigin=\"anonymous\");N.onload=function(){window.clearTimeout(T);if(K)try{var Q=document.createElement(\"canvas\"),R=Q.getContext(\"2d\");Q.height=N.height;Q.width=N.width;R.drawImage(N,0,0);D(Q.toDataURL())}catch(Y){D(Editor.svgBrokenImage.src)}};N.onerror=function(){window.clearTimeout(T);K&&D(Editor.svgBrokenImage.src)};N.src=u}}catch(Q){D(Editor.svgBrokenImage.src)}};Editor.prototype.convertImages=function(u,D,K,", "label": 1, "label_name": "safe"} +{"code": " protected function connectionWarningsHandler($errno, $errstr)\n {\n if ($errno & E_WARNING) {\n array_unshift($this->connectionWarnings, $errstr);\n }\n return true;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " Returns the block size of the algorithm */\nPHP_FUNCTION(mcrypt_module_get_algo_block_size)\n{\n\tMCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)\n\t\n\tRETURN_LONG(mcrypt_module_get_algo_block_size(module, dir));", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function validateEmail($email)\n\t{\n\t\treturn filter_var(trim($email), FILTER_VALIDATE_EMAIL);\n\t}", "label": 1, "label_name": "safe"} +{"code": " def secure_reaction_users!(reaction_users)\n if !guardian.can_see_private_messages?(current_user.id) || !guardian.user\n reaction_users = reaction_users.where(\"topics.archetype <> :private_message\", private_message: archetype::private_message)\n else\n unless guardian.is_admin?\n sql = <<~SQL\n topics.archetype <> :private_message OR\n EXISTS (\n SELECT 1 FROM topic_allowed_users tu WHERE tu.topic_id = topics.id AND tu.user_id = :current_user_id\n ) OR\n EXISTS (\n SELECT 1 FROM topic_allowed_groups tg WHERE tg.topic_id = topics.id AND tg.group_id IN (\n SELECT group_id FROM group_users gu WHERE gu.user_id = :current_user_id\n )\n )\n SQL\n\n reaction_users = reaction_users.where(sql, private_message: Archetype::private_message, current_user_id: guardian.user.id)\n end\n end\n\n unless guardian.is_admin?\n allowed = guardian.secure_category_ids\n if allowed.present?\n reaction_users = reaction_users.where(\"(categories.read_restricted IS NULL OR\n NOT categories.read_restricted OR\n (categories.read_restricted and categories.id in (:categories)) )\", categories: guardian.secure_category_ids)\n else\n reaction_users = reaction_users.where(\"(categories.read_restricted IS NULL OR NOT categories.read_restricted)\")\n end\n end\n\n reaction_users\n end", "label": 1, "label_name": "safe"} +{"code": " it 'returns the right response' do\n get \"/session/email-login/adasdad\"\n\n expect(response.status).to eq(200)\n\n expect(CGI.unescapeHTML(response.body)).to match(\n I18n.t('email_login.invalid_token')\n )\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function destroy(Request $request, TransactionCurrency $currency)\n {\n /** @var User $user */\n $user = auth()->user();\n if (!$this->userRepository->hasRole($user, 'owner')) {\n\n $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));\n Log::channel('audit')->info(sprintf('Tried to delete currency %s but is not site owner.', $currency->code));\n\n return redirect(route('currencies.index'));\n\n }\n\n if ($this->repository->currencyInUse($currency)) {\n $request->session()->flash('error', (string)trans('firefly.cannot_delete_currency', ['name' => e($currency->name)]));\n Log::channel('audit')->info(sprintf('Tried to delete currency %s but is in use.', $currency->code));\n\n return redirect(route('currencies.index'));\n }\n\n if ($this->repository->isFallbackCurrency($currency)) {\n $request->session()->flash('error', (string)trans('firefly.cannot_delete_fallback_currency', ['name' => e($currency->name)]));\n Log::channel('audit')->info(sprintf('Tried to delete currency %s but is FALLBACK.', $currency->code));\n\n return redirect(route('currencies.index'));\n }\n\n Log::channel('audit')->info(sprintf('Deleted currency %s.', $currency->code));\n $this->repository->destroy($currency);\n\n $request->session()->flash('success', (string)trans('firefly.deleted_currency', ['name' => $currency->name]));\n\n return redirect($this->getPreviousUri('currencies.delete.uri'));\n }", "label": 1, "label_name": "safe"} {"code": "this.graph.getTooltip(c,d,e,f);this.show(k,e,f);this.state=c;this.node=d;this.stateSource=g}}),this.delay)}};mxTooltipHandler.prototype.hide=function(){this.resetTimer();this.hideTooltip()};mxTooltipHandler.prototype.hideTooltip=function(){null!=this.div&&(this.div.style.visibility=\"hidden\",this.div.innerHTML=\"\")};", "label": 0, "label_name": "vulnerable"} -{"code": " it \"stores the session\" do\n cursor.session.should eq session\n end", "label": 0, "label_name": "vulnerable"} -{"code": " private def checkSillySessionId(site: SiteBrief, anyOldSid: Opt[St],\n dao: SessionSiteDaoMixin, now: When,\n expireIdleAfterMillis: i64): CheckSidResult = {\n\n val value = anyOldSid getOrElse {\n return CheckSidResult.noSession(SidAbsent)\n }\n\n // Example value: 88-F7sAzB0yaaX.1312629782081.1c3n0fgykm - no, obsolete\n if (value.length <= HashLength)\n return CheckSidResult.noSession(SidBadFormat)\n\n val (hash, dotUseridDateRandom) = value splitAt HashLength\n val realHash = hashSha1Base64UrlSafe(\n s\"$secretSalt.${site.id}$dotUseridDateRandom\") take HashLength\n\n if (hash != realHash)\n return CheckSidResult.noSession(SidBadHash)\n\n val oldOkSid = dotUseridDateRandom.drop(1).split('.') match {\n case Array(userIdString, dateStr, randVal) =>\n val userId: Option[UserId] =\n if (userIdString.isEmpty) None\n else Try(userIdString.toInt).toOption orElse {\n return CheckSidResult.noSession(SidBadFormat)\n }\n val ageMillis = now.millis - dateStr.toLong\n UX; BUG; COULD; // [EXPIREIDLE] this also expires *active* sessions. Instead,\n // lookup the user, and consider only time elapsed, since hens last visit.\n // ... Need to have a SiteDao here then. And pass the Participant back to the\n // caller, so it won't have to look it up again.\n // Not urgent though \u2014 no one will notice: by default, one stays logged in 1 year [7AKR04].\n if (ageMillis > expireIdleAfterMillis) {\n val expiredSid = SidExpired(\n minutesOld = ageMillis / MillisPerMinute,\n maxAgeMins = expireIdleAfterMillis / MillisPerMinute,\n wasForPatId = userId)\n return CheckSidResult.noSession(expiredSid)\n }\n SidOk(\n value = value,\n ageInMillis = ageMillis,\n userId = userId)\n case _ => SidBadFormat\n }\n\n var newSidCookies: List[Cookie] = Nil\n\n // Upgrade old sid to new style sid: [btr_sid]\n // ----------------------------------------\n\n /* Maybe skip this. Hard to test?\n if ((tryFancySid || useFancySid) && oldOkSid.userId.isDefined) {\n val dao = anyDao getOrDie \"TyE50FREN68\"\n val patId = oldOkSid.userId getOrDie \"TyE602MTEGPH\"\n val settings = dao.getWholeSiteSettings()\n val expireIdleAfterSecs = settings.expireIdleAfterMins * 60\n val (newCookies, sidPart1, sidPart2) =\n genAndSaveFancySid(patId = patId, expireIdleAfterSecs, dao.redisCache,\n isOldUpgraded = true)\n // cookies = newSidPart1Cookie::newSidPart2Cookie::cookies\n result = SidOk(sidPart1,\n expireIdleAfterSecs * 1000, Some(patId))\n newSidCookies = newCookies\n }\n */\n\n CheckSidResult(anyTySession = None, oldOkSid, createCookies = newSidCookies)\n }\n\n\n @deprecated(\"Now\", \"Use the fancy session id instead.\")", "label": 1, "label_name": "safe"} -{"code": "Runner.prototype.uncaught = function(err){\n debug('uncaught exception %s', err.message);\n var runnable = this.currentRunnable;\n if (!runnable || 'failed' == runnable.state) return;\n runnable.clearTimeout();\n err.uncaught = true;\n this.fail(runnable, err);\n\n // recover from test\n if ('test' == runnable.type) {\n this.emit('test end', runnable);\n this.hookUp('afterEach', this.next);\n return;\n }\n\n // bail on hooks\n this.emit('end');\n};", "label": 0, "label_name": "vulnerable"} -{"code": "void trustedBlsSignMessageAES(int *errStatus, char *errString, uint8_t *encryptedPrivateKey,\n uint64_t enc_len, char *_hashX,\n char *_hashY, char *signature) {\n LOG_DEBUG(__FUNCTION__);\n INIT_ERROR_STATE\n\n CHECK_STATE(encryptedPrivateKey);\n CHECK_STATE(_hashX);\n CHECK_STATE(_hashY);\n CHECK_STATE(signature);\n\n SAFE_CHAR_BUF(key, BUF_LEN);SAFE_CHAR_BUF(sig, BUF_LEN);\n\n int status = AES_decrypt(encryptedPrivateKey, enc_len, key, BUF_LEN);\n\n CHECK_STATUS(\"AES decrypt failed\")\n\n if (!enclave_sign(key, _hashX, _hashY, sig)) {\n strncpy(errString, \"Enclave failed to create bls signature\", BUF_LEN);\n LOG_ERROR(errString);\n *errStatus = -1;\n goto clean;\n }\n\n strncpy(signature, sig, BUF_LEN);\n\n if (strnlen(signature, BUF_LEN) < 10) {\n strncpy(errString, \"Signature too short\", BUF_LEN);\n LOG_ERROR(errString);\n *errStatus = -1;\n goto clean;\n }\n\n SET_SUCCESS\n\n LOG_DEBUG(\"SGX call completed\");\n\n clean:\n ;\n LOG_DEBUG(\"SGX call completed\");\n}", "label": 1, "label_name": "safe"} -{"code": "process_secondary_order(STREAM s)\n{\n\t/* The length isn't calculated correctly by the server.\n\t * For very compact orders the length becomes negative\n\t * so a signed integer must be used. */\n\tuint16 length;\n\tuint16 flags;\n\tuint8 type;\n\tuint8 *next_order;\n\tstruct stream packet = *s;\n\n\tin_uint16_le(s, length);\n\tin_uint16_le(s, flags);\t/* used by bmpcache2 */\n\tin_uint8(s, type);\n\n\tif (!s_check_rem(s, length + 7))\n\t{\n\t\trdp_protocol_error(\"process_secondary_order(), next order pointer would overrun stream\", &packet);\n\t}\n\n\tnext_order = s->p + (sint16) length + 7;\n\n\tswitch (type)\n\t{\n\t\tcase RDP_ORDER_RAW_BMPCACHE:\n\t\t\tprocess_raw_bmpcache(s);\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_COLCACHE:\n\t\t\tprocess_colcache(s);\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_BMPCACHE:\n\t\t\tprocess_bmpcache(s);\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_FONTCACHE:\n\t\t\tprocess_fontcache(s);\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_RAW_BMPCACHE2:\n\t\t\tprocess_bmpcache2(s, flags, False);\t/* uncompressed */\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_BMPCACHE2:\n\t\t\tprocess_bmpcache2(s, flags, True);\t/* compressed */\n\t\t\tbreak;\n\n\t\tcase RDP_ORDER_BRUSHCACHE:\n\t\t\tprocess_brushcache(s, flags);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tlogger(Graphics, Warning,\n\t\t\t \"process_secondary_order(), unhandled secondary order %d\", type);\n\t}\n\n\ts->p = next_order;\n}", "label": 1, "label_name": "safe"} -{"code": "\tthis.getstate = function() {\n\t\treturn 0;\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": "L&&P.replAllPos>=z)break;C[I.id]={replAllMrk:L,replAllPos:z};k.isCellEditable(I)&&(k.model.setValue(I,H(T,A,K.value,z-A.length,k.getCurrentCellStyle(I))),p++)}V!=b.currentPage&&b.editor.graph.model.execute(new SelectPage(b,V));mxUtils.write(E,mxResources.get(\"matchesRepl\",[p]))}catch(O){b.handleError(O)}finally{k.getModel().endUpdate(),b.editor.graph.setSelectionCells(X),b.editor.graph.rendering=!0}L++}});Q.setAttribute(\"title\",mxResources.get(\"replaceAll\"));Q.style.float=\"none\";Q.style.width=\"120px\";\nQ.style.marginTop=\"6px\";Q.style.marginLeft=\"8px\";Q.style.overflow=\"hidden\";Q.style.textOverflow=\"ellipsis\";Q.className=\"geBtn gePrimaryBtn\";Q.setAttribute(\"disabled\",\"disabled\");n.appendChild(Q);mxUtils.br(n);n.appendChild(N);N=mxUtils.button(mxResources.get(\"close\"),mxUtils.bind(this,function(){this.window.setVisible(!1)}));N.setAttribute(\"title\",mxResources.get(\"close\"));N.style.float=\"none\";N.style.width=\"120px\";N.style.marginTop=\"6px\";N.style.marginLeft=\"8px\";N.style.overflow=\"hidden\";N.style.textOverflow=\n\"ellipsis\";N.className=\"geBtn\";n.appendChild(N);mxUtils.br(n);n.appendChild(E)}else N.style.width=\"90px\",J.style.width=\"90px\";mxEvent.addListener(y,\"keyup\",function(V){if(91==V.keyCode||93==V.keyCode||17==V.keyCode)mxEvent.consume(V);else if(27==V.keyCode)g.funct();else if(m!=y.value.toLowerCase()||13==V.keyCode)try{y.style.backgroundColor=e()?\"\":Editor.isDarkMode()?\"#ff0000\":\"#ffcfcf\"}catch(X){y.style.backgroundColor=Editor.isDarkMode()?\"#ff0000\":\"#ffcfcf\"}});mxEvent.addListener(M,\"keydown\",function(V){70==\nV.keyCode&&b.keyHandler.isControlDown(V)&&!mxEvent.isShiftDown(V)&&(g.funct(),mxEvent.consume(V))});this.window=new mxWindow(mxResources.get(\"find\")+(t?\"/\"+mxResources.get(\"replace\"):\"\"),M,f,l,d,u,!0,!0);this.window.destroyOnClose=!1;this.window.setMaximizable(!1);this.window.setResizable(!1);this.window.setClosable(!0);this.window.addListener(\"show\",mxUtils.bind(this,function(){this.window.fit();this.window.isVisible()?(y.focus(),mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode?y.select():\ndocument.execCommand(\"selectAll\",!1,null),null!=b.pages&&1 true\n }\n\n csv = file.read\n begin\n csv.encode!(Encoding::UTF_8, enc, {:invalid => :replace, :undef => :replace, :replace => ' '})\n rescue => evar\n Log.add_error(request, evar)\n end\n\n found_update = false\n err_col_names = nil\n col_idxs = []\n\n CSV.parse(csv, opt) do |row|\n unless row.first.nil?\n next if row.first.lstrip.index('#') == 0\n end\n next if row.compact.empty?\n\n count += 1\n if count == 0 # for Header Line\n err_col_names = Address.check_csv_header(row, book)\n if err_col_names.nil? or err_col_names.empty?\n header_cols = Address.csv_header_cols(book)\n col_idxs = header_cols.collect{|col_name| row.index(col_name)}\n next\n else\n logger.fatal('@@@ ' + err_col_names.inspect)\n @imp_errs[0] = []\n err_col_names.each do |err_col_name|\n @imp_errs[0] << t('address.invalid_column_names') + err_col_name\n end\n break\n end\n end\n\n address = Address.parse_csv_row(row, book, col_idxs, @login_user)\n\n check = address.check_import(mode, address_names)\n\n @imp_errs[count] = check unless check.empty?\n\n addresses << address\n\n if (mode == 'update')\n update_address = all_addresses.find do |rec|\n rec.id == address.id\n end\n unless update_address.nil?\n all_addresses.delete(update_address)\n found_update = true\n end\n end\n end\n\n if err_col_names.nil? or err_col_names.empty?\n if addresses.empty?\n @imp_errs[0] = [t('address.nothing_to_import')]\n else\n if (mode == 'update') and !found_update\n @imp_errs[0] = [t('address.nothing_to_update')]\n end\n end\n end\n\n # Create or Update\n count = 0\n @imp_cnt = 0\n if @imp_errs.empty?\n addresses.each do |address|\n count += 1\n begin\n address_id = address.id\n\n address.save!\n\n @imp_cnt += 1\n\n rescue => evar\n @imp_errs[count] = [t('address.save_failed') + evar.to_s]\n end\n end\n end\n\n # Delete\n # Actually, the correct order of the process is Delete -> Create,\n # not to duplicate a Address Name.\n # 3: morita <- Delete\n # : morita <- Create\n # But such a case is most likely to be considered as a \n # user's miss-operation. We can avoid this case with\n # 'opposite' process.\n del_cnt = 0\n if (@imp_errs.empty? and mode == 'update')\n all_addresses.each do |address|\n address.destroy\n del_cnt += 1\n end\n end\n\n if @imp_errs.empty?\n flash[:notice] = t('address.imported', :count => addresses.length)\n if (del_cnt > 0)\n flash[:notice] << '
    ' + t('address.deleted', :count => del_cnt)\n end\n end\n\n list\n render(:action => 'list')\n end", "label": 1, "label_name": "safe"} -{"code": " public static function flag($vars)\n {\n switch (SMART_URL) {\n case true:\n $lang = '?lang='.$vars;\n if (isset($_GET['lang'])) {\n $uri = explode('?', $_SERVER['REQUEST_URI']);\n $uri = $uri[0];\n } else {\n $uri = $_SERVER['REQUEST_URI'];\n }\n $url = $uri.$lang;\n\n break;\n\n default:\n // print_r($_GET);\n if (!empty($_GET)) {\n $val = '';\n foreach ($_GET as $key => $value) {\n if ($key == 'lang') {\n $val .= '&lang='.$vars;\n } else {\n $val .= $key.'='.$value;\n }\n }\n } else {\n $val = 'lang='.$vars;\n }\n $lang = !isset($_GET['lang']) ? '&lang='.$vars : $val;\n $url = Site::$url.'/?'.$lang;\n break;\n }\n\n return $url;\n }", "label": 1, "label_name": "safe"} -{"code": "if(\"function\"!=typeof a)throw new TypeError(\"parseInputDate() sholud be as function\");return d.parseInputDate=a,l},l.disabledTimeIntervals=function(b){if(0===arguments.length)return d.disabledTimeIntervals?a.extend({},d.disabledTimeIntervals):d.disabledTimeIntervals;if(!b)return d.disabledTimeIntervals=!1,$(),l;if(!(b instanceof Array))throw new TypeError(\"disabledTimeIntervals() expects an array parameter\");return d.disabledTimeIntervals=b,$(),l},l.disabledHours=function(b){if(0===arguments.length)return d.disabledHours?a.extend({},d.disabledHours):d.disabledHours;if(!b)return d.disabledHours=!1,$(),l;if(!(b instanceof Array))throw new TypeError(\"disabledHours() expects an array parameter\");if(d.disabledHours=na(b),d.enabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!Q(e,\"h\");){if(e.add(1,\"h\"),24===c)throw\"Tried 24 times to find a valid date\";c++}_(e)}return $(),l},l.enabledHours=function(b){if(0===arguments.length)return d.enabledHours?a.extend({},d.enabledHours):d.enabledHours;if(!b)return d.enabledHours=!1,$(),l;if(!(b instanceof Array))throw new TypeError(\"enabledHours() expects an array parameter\");if(d.enabledHours=na(b),d.disabledHours=!1,d.useCurrent&&!d.keepInvalid){for(var c=0;!Q(e,\"h\");){if(e.add(1,\"h\"),24===c)throw\"Tried 24 times to find a valid date\";c++}_(e)}return $(),l},l.viewDate=function(a){if(0===arguments.length)return f.clone();if(!a)return f=e.clone(),l;if(!(\"string\"==typeof a||b.isMoment(a)||a instanceof Date))throw new TypeError(\"viewDate() parameter must be one of [string, moment or Date]\");return f=ga(a),J(),l},c.is(\"input\"))g=c;else if(g=c.find(d.datepickerInput),0===g.size())g=c.find(\"input\");else if(!g.is(\"input\"))throw new Error('CSS class \"'+d.datepickerInput+'\" cannot be applied to non input element');if(c.hasClass(\"input-group\")&&(n=0===c.find(\".datepickerbutton\").size()?c.find(\".input-group-addon\"):c.find(\".datepickerbutton\")),!d.inline&&!g.is(\"input\"))throw new Error(\"Could not initialize DateTimePicker without an input element\");return e=x(),f=e.clone(),a.extend(!0,d,G()),l.options(d),oa(),ka(),g.prop(\"disabled\")&&l.disable(),g.is(\"input\")&&0!==g.val().trim().length?_(ga(g.val().trim())):d.defaultDate&&void 0===g.attr(\"placeholder\")&&_(d.defaultDate),d.inline&&ea(),l};a.fn.datetimepicker=function(b){return this.each(function(){var d=a(this);d.data(\"DateTimePicker\")||(b=a.extend(!0,{},a.fn.datetimepicker.defaults,b),d.data(\"DateTimePicker\",c(d,b)))})},a.fn.datetimepicker.defaults={timeZone:\"Etc/UTC\",format:!1,dayViewHeaderFormat:\"MMMM YYYY\",extraFormats:!1,stepping:1,minDate:!1,maxDate:!1,useCurrent:!0,collapse:!0,locale:b.locale(),defaultDate:!1,disabledDates:!1,enabledDates:!1,icons:{time:\"glyphicon glyphicon-time\",date:\"glyphicon glyphicon-calendar\",up:\"glyphicon glyphicon-chevron-up\",down:\"glyphicon glyphicon-chevron-down\",previous:\"glyphicon glyphicon-chevron-left\",next:\"glyphicon glyphicon-chevron-right\",today:\"glyphicon glyphicon-screenshot\",clear:\"glyphicon glyphicon-trash\",close:\"glyphicon glyphicon-remove\"},tooltips:{today:\"Go to today\",clear:\"Clear selection\",close:\"Close the picker\",selectMonth:\"Select Month\",prevMonth:\"Previous Month\",nextMonth:\"Next Month\",selectYear:\"Select Year\",prevYear:\"Previous Year\",nextYear:\"Next Year\",selectDecade:\"Select Decade\",prevDecade:\"Previous Decade\",nextDecade:\"Next Decade\",prevCentury:\"Previous Century\",nextCentury:\"Next Century\",pickHour:\"Pick Hour\",incrementHour:\"Increment Hour\",decrementHour:\"Decrement Hour\",pickMinute:\"Pick Minute\",incrementMinute:\"Increment Minute\",decrementMinute:\"Decrement Minute\",pickSecond:\"Pick Second\",incrementSecond:\"Increment Second\",decrementSecond:\"Decrement Second\",togglePeriod:\"Toggle Period\",selectTime:\"Select Time\"},useStrict:!1,sideBySide:!1,daysOfWeekDisabled:!1,calendarWeeks:!1,viewMode:\"days\",toolbarPlacement:\"default\",showTodayButton:!1,showClear:!1,showClose:!1,widgetPositioning:{horizontal:\"auto\",vertical:\"auto\"},widgetParent:null,ignoreReadonly:!1,keepOpen:!1,focusOnShow:!0,inline:!1,keepInvalid:!1,datepickerInput:\".datepickerinput\",keyBinds:{up:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().subtract(7,\"d\")):this.date(b.clone().add(this.stepping(),\"m\"))}},down:function(a){if(!a)return void this.show();var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().add(7,\"d\")):this.date(b.clone().subtract(this.stepping(),\"m\"))},\"control up\":function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().subtract(1,\"y\")):this.date(b.clone().add(1,\"h\"))}},\"control down\":function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")?this.date(b.clone().add(1,\"y\")):this.date(b.clone().subtract(1,\"h\"))}},left:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().subtract(1,\"d\"))}},right:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().add(1,\"d\"))}},pageUp:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().subtract(1,\"M\"))}},pageDown:function(a){if(a){var b=this.date()||this.getMoment();a.find(\".datepicker\").is(\":visible\")&&this.date(b.clone().add(1,\"M\"))}},enter:function(){this.hide()},escape:function(){this.hide()},\"control space\":function(a){a.find(\".timepicker\").is(\":visible\")&&a.find('.btn[data-action=\"togglePeriod\"]').click()},t:function(){this.date(this.getMoment())},\"delete\":function(){this.clear()}},debug:!1,allowInputToggle:!1,disabledTimeIntervals:!1,disabledHours:!1,enabledHours:!1,viewDate:!1}});", "label": 0, "label_name": "vulnerable"} -{"code": " def begin(name)\n stack(name).push true\n end", "label": 1, "label_name": "safe"} -{"code": "COMPAT_SYSCALL_DEFINE3(set_mempolicy, int, mode, compat_ulong_t __user *, nmask,\n\t\t compat_ulong_t, maxnode)\n{\n\tlong err = 0;\n\tunsigned long __user *nm = NULL;\n\tunsigned long nr_bits, alloc_size;\n\tDECLARE_BITMAP(bm, MAX_NUMNODES);\n\n\tnr_bits = min_t(unsigned long, maxnode-1, MAX_NUMNODES);\n\talloc_size = ALIGN(nr_bits, BITS_PER_LONG) / 8;\n\n\tif (nmask) {\n\t\terr = compat_get_bitmap(bm, nmask, nr_bits);\n\t\tnm = compat_alloc_user_space(alloc_size);\n\t\terr |= copy_to_user(nm, bm, alloc_size);\n\t}\n\n\tif (err)\n\t\treturn -EFAULT;\n\n\treturn sys_set_mempolicy(mode, nm, nr_bits+1);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "\t protected function curl_get_contents( &$url, $timeout, $redirect_max, $ua, $outfp ){\n\t\t$ch = curl_init();\n\t\tcurl_setopt( $ch, CURLOPT_URL, $url );\n\t\tcurl_setopt( $ch, CURLOPT_HEADER, false );\n\t\tif ($outfp) {\n\t\t\tcurl_setopt( $ch, CURLOPT_FILE, $outfp );\n\t\t} else {\n\t\t\tcurl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );\n\t\t\tcurl_setopt( $ch, CURLOPT_BINARYTRANSFER, true );\n\t\t}\n\t\tcurl_setopt( $ch, CURLOPT_LOW_SPEED_LIMIT, 1 );\n\t\tcurl_setopt( $ch, CURLOPT_LOW_SPEED_TIME, $timeout );\n\t\tcurl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );\n\t\tcurl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);\n\t\tcurl_setopt( $ch, CURLOPT_MAXREDIRS, $redirect_max);\n\t\tcurl_setopt( $ch, CURLOPT_USERAGENT, $ua);\n\t\t$result = curl_exec( $ch );\n\t\t$url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);\n\t\tcurl_close( $ch );\n\t\treturn $outfp? $outfp : $result;\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": " void resize (std::size_t new_size_) { _buf_size = new_size_; }", "label": 0, "label_name": "vulnerable"} -{"code": " public static function getCSS()\n {\n return file_get_contents(HTMLPURIFIER_PREFIX . '/HTMLPurifier/Printer/ConfigForm.css');\n }", "label": 1, "label_name": "safe"} -{"code": " public function test_filter()\n {\n $def = new HTMLPurifier_URIDefinition();\n $def->addFilter($this->createFilterMock(), $this->config);\n $def->addFilter($this->createFilterMock(), $this->config);\n $uri = $this->createURI('test');\n $this->assertTrue($def->filter($uri, $this->config, $this->context));\n }", "label": 1, "label_name": "safe"} -{"code": "GraphViewer.processElements=function(b){mxUtils.forEach(GraphViewer.getElementsByClassName(b||\"mxgraph\"),function(e){try{e.innerHTML=\"\",GraphViewer.createViewerForElement(e)}catch(k){e.innerHTML=k.message,null!=window.console&&console.error(k)}})};", "label": 0, "label_name": "vulnerable"} -{"code": " public function execute($image)\n {\n $size = $this->argument(0)->type('digit')->value(10);\n\n $width = $image->getWidth();\n $height = $image->getHeight();\n\n $image->getCore()->scaleImage(max(1, ($width / $size)), max(1, ($height / $size)));\n $image->getCore()->scaleImage($width, $height);\n\n return true;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\t\t\t} elseif (isset($graph['data_query_name'])) {\n\t\t\t\tif (isset($prev_data_query_name)) {\n\t\t\t\t\tif ($prev_data_query_name != $graph['data_query_name']) {\n\t\t\t\t\t\t$print = true;\n\t\t\t\t\t\t$prev_data_query_name = $graph['data_query_name'];\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$print = false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$print = true;\n\t\t\t\t\t$prev_data_query_name = $graph['data_query_name'];\n\t\t\t\t}\n\n\t\t\t\tif ($print) {\n\t\t\t\t\tif (!$start) {\n\t\t\t\t\t\twhile(($i % $columns) != 0) {\n\t\t\t\t\t\t\tprint \"\";\n\t\t\t\t\t\t\t$i++;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tprint \"\\n\";\n\t\t\t\t\t}\n\n\t\t\t\t\tprint \"\n\t\t\t\t\t\t\t\" . __('Data Query:') . ' ' . $graph['data_query_name'] . \"\n\t\t\t\t\t\t\\n\";\n\t\t\t\t\t$i = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ($i == 0) {\n\t\t\t\tprint \"\\n\";\n\t\t\t\t$start = false;\n\t\t\t}\n\n\t\t\t?>\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t\t\t\t\t
    ' graph_width='' graph_height=''>
    \n\t\t\t\t\t\t\t\" . html_escape($graph['title_cache']) . '' : '');?>\n\t\t\t\t\t\t
    ' class='noprint graphDrillDown'>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
    \n\t\t\t\n\t\t\t\\n\";\n\t\t\t\t$start = true;\n\t\t\t}\n\t\t}\n\n\t\tif (!$start) {\n\t\t\twhile(($i % $columns) != 0) {\n\t\t\t\tprint \"\";\n\t\t\t\t$i++;\n\t\t\t}\n\n\t\t\tprint \"\\n\";\n\t\t}\n\t} else {", "label": 1, "label_name": "safe"} -{"code": "\t\t\tadd = function(files) {\n\t\t\t\tvar place = list ? cwd.find('tbody') : cwd,\n\t\t\t\t\tl = files.length, \n\t\t\t\t\tltmb = [],\n\t\t\t\t\tatmb = {},\n\t\t\t\t\tdirs = false,\n\t\t\t\t\tfindNode = function(file) {\n\t\t\t\t\t\tvar pointer = cwd.find('[id]:first'), file2;\n\n\t\t\t\t\t\twhile (pointer.length) {\n\t\t\t\t\t\t\tfile2 = fm.file(pointer.attr('id'));\n\t\t\t\t\t\t\tif (!pointer.is('.elfinder-cwd-parent') && file2 && fm.compare(file, file2) < 0) {\n\t\t\t\t\t\t\t\treturn pointer;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tpointer = pointer.next('[id]');\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tfindIndex = function(file) {\n\t\t\t\t\t\tvar l = buffer.length, i;\n\t\t\t\t\t\t\n\t\t\t\t\t\tfor (i =0; i < l; i++) {\n\t\t\t\t\t\t\tif (fm.compare(file, buffer[i]) < 0) {\n\t\t\t\t\t\t\t\treturn i;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn l || -1;\n\t\t\t\t\t},\n\t\t\t\t\tfile, hash, node, ndx;\n\n\t\t\t\t\n\t\t\t\twhile (l--) {\n\t\t\t\t\tfile = files[l];\n\t\t\t\t\thash = file.hash;\n\t\t\t\t\t\n\t\t\t\t\tif (cwd.find('#'+hash).length) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif ((node = findNode(file)) && node.length) {\n\t\t\t\t\t\tnode.before(itemhtml(file)); \n\t\t\t\t\t} else if ((ndx = findIndex(file)) >= 0) {\n\t\t\t\t\t\tbuffer.splice(ndx, 0, file);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tplace.append(itemhtml(file));\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (cwd.find('#'+hash).length) {\n\t\t\t\t\t\tif (file.mime == 'directory') {\n\t\t\t\t\t\t\tdirs = true;\n\t\t\t\t\t\t} else if (file.tmb) {\n\t\t\t\t\t\t\tfile.tmb === 1 ? ltmb.push(hash) : (atmb[hash] = file.tmb);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tattachThumbnails(atmb);\n\t\t\t\tltmb.length && loadThumbnails(ltmb);\n\t\t\t\tdirs && makeDroppable();\n\t\t\t},", "label": 0, "label_name": "vulnerable"} -{"code": " $h1 = floor($dec % 16);\n $c = $escape . $hex[\"$h2\"] . $hex[\"$h1\"];\n $length += 2;\n $addtl_chars += 2;\n }\n\n // length for wordwrap exceeded, get a newline into the text\n if ($length >= $line_max) {\n $cur_conv_line .= $c;\n\n // read only up to the whitespace for the current line\n $whitesp_diff = $i - $whitespace_pos + $addtl_chars;\n\n /* the text after the whitespace will have to be read\n * again ( + any additional characters that came into\n * existence as a result of the encoding process after the whitespace)\n *\n * Also, do not start at 0, if there was *no* whitespace in\n * the whole line */\n if (($i + $addtl_chars) > $whitesp_diff) {\n $output .= substr($cur_conv_line, 0, (strlen($cur_conv_line) -\n $whitesp_diff)) . $linebreak;\n $i = $i - $whitesp_diff + $addtl_chars;\n } else {\n $output .= $cur_conv_line . $linebreak;\n }\n\n $cur_conv_line = \"\";\n $length = 0;\n $whitespace_pos = 0;\n } else {\n // length for wordwrap not reached, continue reading\n $cur_conv_line .= $c;\n }\n } // end of for\n\n $length = 0;\n $whitespace_pos = 0;\n $output .= $cur_conv_line;\n $cur_conv_line = \"\";\n\n if ($j <= count($lines) - 1) {\n $output .= $linebreak;\n }\n } // end for\n\n return trim($output);\n } // end quoted_printable_encode", "label": 1, "label_name": "safe"} -{"code": "func (m *MockAuthorizeRequester) GetClient() fosite.Client {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetClient\")\n\tret0, _ := ret[0].(fosite.Client)\n\treturn ret0\n}", "label": 1, "label_name": "safe"} -{"code": " def AsyncGetActionAllowAnyone(f: GetRequest => Future[Result]): mvc.Action[Unit] =\n PlainApiAction(cc.parsers.empty, NoRateLimits, allowAnyone = true).async(f)", "label": 0, "label_name": "vulnerable"} -{"code": "int CLua::loadfile(lua_State *ls, const char *filename, bool trusted,\n bool die_on_fail)\n{\n if (!ls)\n return -1;\n\n if (!is_path_safe(filename, trusted))\n {\n lua_pushstring(\n ls,\n make_stringf(\"invalid filename: %s\", filename).c_str());\n return -1;\n }\n\n string file = datafile_path(filename, die_on_fail);\n if (file.empty())\n {\n lua_pushstring(ls,\n make_stringf(\"Can't find \\\"%s\\\"\", filename).c_str());\n return -1;\n }\n\n FileLineInput f(file.c_str());\n string script;\n while (!f.eof())\n script += f.get_line() + \"\\n\";\n\n if (script[0] == 0x1b)\n abort();\n\n // prefixing with @ stops lua from adding [string \"%s\"]\n return luaL_loadbuffer(ls, &script[0], script.length(),\n (\"@\" + file).c_str());\n}", "label": 1, "label_name": "safe"} -{"code": " text: this.text.slice(start, this.index),\n identifier: true\n });\n },", "label": 0, "label_name": "vulnerable"} -{"code": " public function getFallbackFor($code) {\n $this->loadLanguage($code);\n return $this->cache[$code]['fallback'];\n }", "label": 1, "label_name": "safe"} -{"code": "this.buttonContainer.style.top=\"6px\";this.editor.fireEvent(new mxEventObject(\"statusChanged\"))}};var E=Sidebar.prototype.getTooltipOffset;Sidebar.prototype.getTooltipOffset=function(O,X){if(null==this.editorUi.sidebarWindow||mxUtils.isAncestorNode(this.editorUi.picker,O)){var ea=mxUtils.getOffset(this.editorUi.picker);ea.x+=this.editorUi.picker.offsetWidth+4;ea.y+=O.offsetTop-X.height/2+16;return ea}var ka=E.apply(this,arguments);ea=mxUtils.getOffset(this.editorUi.sidebarWindow.window.div);ka.x+=\nea.x-16;ka.y+=ea.y;return ka};var C=Menus.prototype.createPopupMenu;Menus.prototype.createPopupMenu=function(O,X,ea){var ka=this.editorUi.editor.graph;O.smartSeparators=!0;C.apply(this,arguments);\"1\"==urlParams.sketch?ka.isEnabled()&&(O.addSeparator(),1==ka.getSelectionCount()&&this.addMenuItems(O,[\"-\",\"lockUnlock\"],null,ea)):1==ka.getSelectionCount()?(ka.isCellFoldable(ka.getSelectionCell())&&this.addMenuItems(O,ka.isCellCollapsed(X)?[\"expand\"]:[\"collapse\"],null,ea),this.addMenuItems(O,[\"collapsible\",", "label": 0, "label_name": "vulnerable"} -{"code": " public function getVisibility($path)\n {\n return false;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "mrb_proc_init_copy(mrb_state *mrb, mrb_value self)\n{\n mrb_value proc = mrb_get_arg1(mrb);\n\n if (!mrb_proc_p(proc)) {\n mrb_raise(mrb, E_ARGUMENT_ERROR, \"not a proc\");\n }\n mrb_proc_copy(mrb, mrb_proc_ptr(self), mrb_proc_ptr(proc));\n return self;\n}", "label": 1, "label_name": "safe"} -{"code": " header($name.': '.$value, false);\n }\n header('Content-Type: text/html; charset='.$this->charset);\n }\n\n echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));\n }", "label": 0, "label_name": "vulnerable"} -{"code": " private function add($s1, $s2, $scale) {\n if ($this->bcmath) return bcadd($s1, $s2, $scale);\n else return $this->scale($s1 + $s2, $scale);\n }", "label": 1, "label_name": "safe"} -{"code": " def _parse(self, err):\n\n all_hosts = {}\n self.raw = utils.parse_json(self.data)\n all = Group('all')\n groups = dict(all=all)\n group = None\n\n\n if 'failed' in self.raw:\n sys.stderr.write(err + \"\\n\")\n raise errors.AnsibleError(\"failed to parse executable inventory script results: %s\" % self.raw)\n\n for (group_name, data) in self.raw.items():\n \n # in Ansible 1.3 and later, a \"_meta\" subelement may contain\n # a variable \"hostvars\" which contains a hash for each host\n # if this \"hostvars\" exists at all then do not call --host for each\n # host. This is for efficiency and scripts should still return data\n # if called with --host for backwards compat with 1.2 and earlier.\n\n if group_name == '_meta':\n if 'hostvars' in data:\n self.host_vars_from_top = data['hostvars']\n continue\n\n if group_name != all.name:\n group = groups[group_name] = Group(group_name)\n else:\n group = all\n host = None\n\n if not isinstance(data, dict):\n data = {'hosts': data}\n elif not any(k in data for k in ('hosts','vars')):\n data = {'hosts': [group_name], 'vars': data}\n\n if 'hosts' in data:\n\n for hostname in data['hosts']:\n if not hostname in all_hosts:\n all_hosts[hostname] = Host(hostname)\n host = all_hosts[hostname]\n group.add_host(host)\n\n if 'vars' in data:\n for k, v in data['vars'].iteritems():\n if group.name == all.name:\n all.set_variable(k, v)\n else:\n group.set_variable(k, v)\n if group.name != all.name:\n all.add_child_group(group)\n\n # Separate loop to ensure all groups are defined\n for (group_name, data) in self.raw.items():\n if group_name == '_meta':\n continue\n if isinstance(data, dict) and 'children' in data:\n for child_name in data['children']:\n if child_name in groups:\n groups[group_name].add_child_group(groups[child_name])\n return groups", "label": 0, "label_name": "vulnerable"} -{"code": " public function update()\n {\n $project = $this->getProject();\n\n $values = $this->request->getValues();\n list($valid, $errors) = $this->swimlaneValidator->validateModification($values);\n\n if ($valid) {\n if ($this->swimlaneModel->update($values['id'], $values)) {\n $this->flash->success(t('Swimlane updated successfully.'));\n return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));\n } else {\n $errors = array('name' => array(t('Another swimlane with the same name exists in the project')));\n }\n }\n\n return $this->edit($values, $errors);\n }", "label": 0, "label_name": "vulnerable"} -{"code": " id: f.id === false ? false : (f.id || true),\n classes: w.classes\n };\n if (isMultiple) {\n attrs.multiple = true;\n }\n return tag('select', [attrs, userAttrs, w.attrs || {}], optionsHTML);\n };", "label": 0, "label_name": "vulnerable"} -{"code": "function item_edit() {\n\tglobal $cdef_item_types, $cdef_functions, $cdef_operators, $custom_data_source_types;\n\n\t/* ================= input validation ================= */\n\tget_filter_request_var('id');\n\tget_filter_request_var('cdef_id');\n\t/* ==================================================== */\n\n\tif (!isempty_request_var('id')) {\n\t\t$cdef = db_fetch_row_prepared('SELECT *\n\t\t\tFROM cdef_items\n\t\t\tWHERE id = ?',\n\t\t\tarray(get_request_var('id')));\n\n\t\tif (cacti_sizeof($cdef)) {\n\t\t\t$current_type = $cdef['type'];\n\t\t\t$values[$current_type] = $cdef['value'];\n\t\t}\n\t} else {\n\t\t$cdef = array();\n\t}\n\n\thtml_start_box(__('CDEF Preview'), '100%', '', '3', 'center', '');\n\tdraw_cdef_preview(get_request_var('cdef_id'));\n\thtml_end_box();\n\n\tform_start('cdef.php', 'form_cdef');\n\n\t$cdef_name = db_fetch_cell_prepared('SELECT name\n\t\tFROM cdef\n\t\tWHERE id = ?',\n\t\tarray(get_request_var('cdef_id')));\n\n\thtml_start_box(__('CDEF Items [edit: %s]', html_escape($cdef_name)), '100%', '', '3', 'center', '');\n\n\tif (isset_request_var('type_select')) {\n\t\t$current_type = get_request_var('type_select');\n\t} elseif (isset($cdef['type'])) {\n\t\t$current_type = $cdef['type'];\n\t} else {\n\t\t$current_type = '1';\n\t}\n\n\t$form_cdef = array(\n\t\t'type_select' => array(\n\t\t\t'method' => 'drop_array',\n\t\t\t'friendly_name' => __('CDEF Item Type'),\n\t\t\t'description' => __('Choose what type of CDEF item this is.'),\n\t\t\t'value' => $current_type,\n\t\t\t'array' => $cdef_item_types\n\t\t),\n\t\t'value' => array(\n\t\t\t'method' => 'drop_array',\n\t\t\t'friendly_name' => __('CDEF Item Value'),\n\t\t\t'description' => __('Enter a value for this CDEF item.'),\n\t\t\t'value' => (isset($cdef['value']) ? $cdef['value']:'')\n\t\t),\n\t\t'id' => array(\n\t\t\t'method' => 'hidden',\n\t\t\t'value' => isset_request_var('id') ? get_request_var('id') : '0',\n\t\t),\n\t\t'type' => array(\n\t\t\t'method' => 'hidden',\n\t\t\t'value' => $current_type\n\t\t),\n\t\t'cdef_id' => array(\n\t\t\t'method' => 'hidden',\n\t\t\t'value' => get_request_var('cdef_id')\n\t\t),\n\t\t'save_component_item' => array(\n\t\t\t'method' => 'hidden',\n\t\t\t'value' => '1'\n\t\t)\n\t);\n\n\tswitch ($current_type) {\n\tcase '1':\n\t\t$form_cdef['value']['array'] = $cdef_functions;\n\n\t\tbreak;\n\tcase '2':\n\t\t$form_cdef['value']['array'] = $cdef_operators;\n\n\t\tbreak;\n\tcase '4':\n\t\t$form_cdef['value']['array'] = $custom_data_source_types;\n\n\t\tbreak;\n\tcase '5':\n\t\t$form_cdef['value']['method'] = 'drop_sql';\n\t\t$form_cdef['value']['sql'] = 'SELECT name, id FROM cdef WHERE `system`=0 ORDER BY name';\n\n\t\tbreak;\n\tcase '6':\n\t\t$form_cdef['value']['method'] = 'textbox';\n\t\t$form_cdef['value']['max_length'] = '255';\n\t\t$form_cdef['value']['size'] = '30';\n\n\t\tbreak;\n\t}\n\n\tdraw_edit_form(\n\t\tarray(\n\t\t\t'config' => array('no_form_tag' => true),\n\t\t\t'fields' => inject_form_variables($form_cdef, $cdef)\n\t\t)\n\t);\n\n\t?>\n\t\n\t 32)\n\t\tlen = 32;\n\n\tdown_read(&uts_sem);\n\tfor (i = 0; i < len; ++i) {\n\t\t__put_user(utsname()->domainname[i], name + i);\n\t\tif (utsname()->domainname[i] == '\\0')\n\t\t\tbreak;\n\t}\n\tup_read(&uts_sem);\n\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "options_dic_send:function(){var b={osp:e.cookie.get(\"osp\"),udn:e.cookie.get(\"udn\"),cust_dic_ids:a.cust_dic_ids,id:\"options_dic_send\",udnCmd:e.cookie.get(\"udnCmd\")};e.postMessage.send({message:b,target:a.targetFromFrame[a.iframeNumber+\"_\"+a.dialog._.currentTabId]})},data:function(a){delete a.id},giveOptions:function(){},setOptionsConfirmF:function(){},setOptionsConfirmT:function(){j.setValue(\"\")},clickBusy:function(){a.div_overlay.setEnable()},suggestAllCame:function(){a.div_overlay.setDisable();a.div_overlay_no_check.setDisable()},", "label": 1, "label_name": "safe"} -{"code": "export function setValueAtPath(\n target: unknown,\n val: unknown,\n path: PathSegments,\n force = false,\n): unknown {\n if (path.length === 0) {\n throw new Error('Cannot set the root object; assign it directly.');\n }\n if (typeof target === 'undefined') {\n throw new TypeError('Cannot set values on undefined');\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let it: any = target;\n const len = path.length;\n const end = path.length - 1;\n let step: PathSegment;\n let cursor = -1;\n let rem: unknown;\n let p: number;\n while (++cursor < len) {\n step = path[cursor];\n if (typeof step !== 'string' && typeof step !== 'number') {\n throw new TypeError('PathSegments must be a string or a number.');\n }\n if (\n step === '__proto__' ||\n step === 'constructor' ||\n step === 'prototype'\n ) {\n throw new Error('Attempted prototype pollution disallowed.');\n }\n if (Array.isArray(it)) {\n if (step === '-' && cursor === end) {\n it.push(val);\n return undefined;\n }\n p = toArrayIndexReference(it, step);\n if (it.length > p) {\n if (cursor === end) {\n rem = it[p];\n it[p] = val;\n break;\n }\n it = it[p];\n } else if (cursor === end && p === it.length) {\n if (force) {\n it.push(val);\n return undefined;\n }\n } else if (force) {\n it = it[p] = cursor === end ? val : {};\n }\n } else {\n if (typeof it[step] === 'undefined') {\n if (force) {\n if (cursor === end) {\n it[step] = val;\n return undefined;\n }\n // if the next step is an array index, this step should be an array.\n if (toArrayIndexReference(it[step], path[cursor + 1]) !== -1) {\n it = it[step] = [];\n continue;\n }\n it = it[step] = {};\n continue;\n }\n return undefined;\n }\n if (cursor === end) {\n rem = it[step];\n it[step] = val;\n break;\n }\n it = it[step];\n }\n }\n return rem;\n}", "label": 1, "label_name": "safe"} -{"code": " $contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_SAVE, 'fas fa-save', null, 'primary', null, 'btn-success xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('orders_status.php', 'page=' . (int)$_GET['page']), null, null, 'btn-light')];", "label": 1, "label_name": "safe"} -{"code": " public function setupMockForFailure($op)\n {\n $this->mock->expectOnce($op, array($this->def, $this->config));\n $this->mock->returns($op, false, array($this->def, $this->config));\n $this->mock->expectOnce('get', array($this->config));\n }", "label": 1, "label_name": "safe"} -{"code": " protected function parseUrl($url)\n {\n // The regular expression is copied verbatim from RFC 3986, appendix B.\n // The expression does not validate the URL but matches any string.\n preg_match(\n '(^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?)',\n $url, $matches\n );\n\n // \"path\" is always present (possibly as an empty string); the rest\n // are optional.\n $this->_scheme = !empty($matches[1]) ? $matches[2] : false;\n $this->setAuthority(!empty($matches[3]) ? $matches[4] : false);\n $this->_path = $this->_encodeData($matches[5]);\n $this->_query = !empty($matches[6])\n ? $this->_encodeData($matches[7])\n : false\n ;\n $this->_fragment = !empty($matches[8]) ? $matches[9] : false;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\t_mouseDrag: function(event) {\n\t\tvar i, item, itemElement, intersection,\n\t\t\to = this.options,\n\t\t\tscrolled = false;\n\n\t\t//Compute the helpers position\n\t\tthis.position = this._generatePosition(event);\n\t\tthis.positionAbs = this._convertPositionTo(\"absolute\");\n\n\t\tif (!this.lastPositionAbs) {\n\t\t\tthis.lastPositionAbs = this.positionAbs;\n\t\t}\n\n\t\t//Do scrolling\n\t\tif(this.options.scroll) {\n\t\t\tif(this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== \"HTML\") {\n\n\t\t\t\tif((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {\n\t\t\t\t\tthis.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;\n\t\t\t\t} else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {\n\t\t\t\t\tthis.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;\n\t\t\t\t}\n\n\t\t\t\tif((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {\n\t\t\t\t\tthis.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;\n\t\t\t\t} else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {\n\t\t\t\t\tthis.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;\n\t\t\t\t}\n\n\t\t\t} else {\n\n\t\t\t\tif(event.pageY - this.document.scrollTop() < o.scrollSensitivity) {\n\t\t\t\t\tscrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);\n\t\t\t\t} else if(this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) {\n\t\t\t\t\tscrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);\n\t\t\t\t}\n\n\t\t\t\tif(event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {\n\t\t\t\t\tscrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed);\n\t\t\t\t} else if(this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) {\n\t\t\t\t\tscrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed);\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {\n\t\t\t\t$.ui.ddmanager.prepareOffsets(this, event);\n\t\t\t}\n\t\t}\n\n\t\t//Regenerate the absolute position used for position checks\n\t\tthis.positionAbs = this._convertPositionTo(\"absolute\");\n\n\t\t//Set the helper position\n\t\tif(!this.options.axis || this.options.axis !== \"y\") {\n\t\t\tthis.helper[0].style.left = this.position.left+\"px\";\n\t\t}\n\t\tif(!this.options.axis || this.options.axis !== \"x\") {\n\t\t\tthis.helper[0].style.top = this.position.top+\"px\";\n\t\t}\n\n\t\t//Rearrange\n\t\tfor (i = this.items.length - 1; i >= 0; i--) {\n\n\t\t\t//Cache variables and intersection, continue if no intersection\n\t\t\titem = this.items[i];\n\t\t\titemElement = item.item[0];\n\t\t\tintersection = this._intersectsWithPointer(item);\n\t\t\tif (!intersection) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Only put the placeholder inside the current Container, skip all\n\t\t\t// items from other containers. This works because when moving\n\t\t\t// an item from one container to another the\n\t\t\t// currentContainer is switched before the placeholder is moved.\n\t\t\t//\n\t\t\t// Without this, moving items in \"sub-sortables\" can cause\n\t\t\t// the placeholder to jitter between the outer and inner container.\n\t\t\tif (item.instance !== this.currentContainer) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// cannot intersect with itself\n\t\t\t// no useless actions that have been done before\n\t\t\t// no action if the item moved is the parent of the item checked\n\t\t\tif (itemElement !== this.currentItem[0] &&\n\t\t\t\tthis.placeholder[intersection === 1 ? \"next\" : \"prev\"]()[0] !== itemElement &&\n\t\t\t\t!$.contains(this.placeholder[0], itemElement) &&\n\t\t\t\t(this.options.type === \"semi-dynamic\" ? !$.contains(this.element[0], itemElement) : true)\n\t\t\t) {\n\n\t\t\t\tthis.direction = intersection === 1 ? \"down\" : \"up\";\n\n\t\t\t\tif (this.options.tolerance === \"pointer\" || this._intersectsWithSides(item)) {\n\t\t\t\t\tthis._rearrange(event, item);\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tthis._trigger(\"change\", event, this._uiHash());\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t//Post events to containers\n\t\tthis._contactContainers(event);\n\n\t\t//Interconnect with droppables\n\t\tif($.ui.ddmanager) {\n\t\t\t$.ui.ddmanager.drag(this, event);\n\t\t}\n\n\t\t//Call callbacks\n\t\tthis._trigger(\"sort\", event, this._uiHash());\n\n\t\tthis.lastPositionAbs = this.positionAbs;\n\t\treturn false;\n\n\t},", "label": 0, "label_name": "vulnerable"} -{"code": "function twig_array_filter(Environment $env, $array, $arrow)\n{\n if (!twig_test_iterable($array)) {\n throw new RuntimeError(sprintf('The \"filter\" filter expects an array or \"Traversable\", got \"%s\".', \\is_object($array) ? \\get_class($array) : \\gettype($array)));\n }\n\n if (!$arrow instanceof Closure && $env->hasExtension('\\Twig\\Extension\\SandboxExtension') && $env->getExtension('\\Twig\\Extension\\SandboxExtension')->isSandboxed()) {\n throw new RuntimeError('The callable passed to \"filter\" filter must be a Closure in sandbox mode.');\n }\n\n if (\\is_array($array)) {\n return array_filter($array, $arrow, \\ARRAY_FILTER_USE_BOTH);\n }\n\n // the IteratorIterator wrapping is needed as some internal PHP classes are \\Traversable but do not implement \\Iterator\n return new \\CallbackFilterIterator(new \\IteratorIterator($array), $arrow);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "static int MqttClient_WaitType(MqttClient *client, void *packet_obj,\n byte wait_type, word16 wait_packet_id, int timeout_ms)\n{\n int rc;\n word16 packet_id;\n MqttPacketType packet_type;\n#ifdef WOLFMQTT_MULTITHREAD\n MqttPendResp *pendResp;\n int readLocked;\n#endif\n MqttMsgStat* mms_stat;\n int waitMatchFound;\n\n if (client == NULL || packet_obj == NULL) {\n return MQTT_CODE_ERROR_BAD_ARG;\n }\n\n /* all packet type structures must have MqttMsgStat at top */\n mms_stat = (MqttMsgStat*)packet_obj;\n\nwait_again:\n\n /* initialize variables */\n packet_id = 0;\n packet_type = MQTT_PACKET_TYPE_RESERVED;\n#ifdef WOLFMQTT_MULTITHREAD\n pendResp = NULL;\n readLocked = 0;\n#endif\n waitMatchFound = 0;\n\n#ifdef WOLFMQTT_DEBUG_CLIENT\n PRINTF(\"MqttClient_WaitType: Type %s (%d), ID %d\",\n MqttPacket_TypeDesc((MqttPacketType)wait_type),\n wait_type, wait_packet_id);\n#endif\n\n switch ((int)*mms_stat)\n {\n case MQTT_MSG_BEGIN:\n {\n #ifdef WOLFMQTT_MULTITHREAD\n /* Lock recv socket mutex */\n rc = wm_SemLock(&client->lockRecv);\n if (rc != 0) {\n PRINTF(\"MqttClient_WaitType: recv lock error!\");\n return rc;\n }\n readLocked = 1;\n #endif\n\n /* reset the packet state */\n client->packet.stat = MQTT_PK_BEGIN;\n }\n FALL_THROUGH;\n\n #ifdef WOLFMQTT_V5\n case MQTT_MSG_AUTH:\n #endif\n case MQTT_MSG_WAIT:\n {\n #ifdef WOLFMQTT_MULTITHREAD\n /* Check to see if packet type and id have already completed */\n pendResp = NULL;\n rc = wm_SemLock(&client->lockClient);\n if (rc == 0) {\n if (MqttClient_RespList_Find(client, (MqttPacketType)wait_type, \n wait_packet_id, &pendResp)) {\n if (pendResp->packetDone) {\n /* pending response is already done, so return */\n rc = pendResp->packet_ret;\n #ifdef WOLFMQTT_DEBUG_CLIENT\n PRINTF(\"PendResp already Done %p: Rc %d\", pendResp, rc);\n #endif\n MqttClient_RespList_Remove(client, pendResp);\n wm_SemUnlock(&client->lockClient);\n wm_SemUnlock(&client->lockRecv);\n return rc;\n }\n }\n wm_SemUnlock(&client->lockClient);\n }\n else {\n break; /* error */\n }\n #endif /* WOLFMQTT_MULTITHREAD */\n\n *mms_stat = MQTT_MSG_WAIT;\n\n /* Wait for packet */\n rc = MqttPacket_Read(client, client->rx_buf, client->rx_buf_len,\n timeout_ms);\n /* handle failure */\n if (rc <= 0) {\n break;\n }\n\n /* capture length read */\n client->packet.buf_len = rc;\n\n /* Decode Packet - get type and id */\n rc = MqttClient_DecodePacket(client, client->rx_buf,\n client->packet.buf_len, NULL, &packet_type, NULL, &packet_id);\n if (rc < 0) {\n break;\n }\n\n #ifdef WOLFMQTT_DEBUG_CLIENT\n PRINTF(\"Read Packet: Len %d, Type %d, ID %d\",\n client->packet.buf_len, packet_type, packet_id);\n #endif\n\n *mms_stat = MQTT_MSG_READ;\n }\n FALL_THROUGH;\n\n case MQTT_MSG_READ:\n case MQTT_MSG_READ_PAYLOAD:\n {\n MqttPacketType use_packet_type;\n void* use_packet_obj;\n\n #ifdef WOLFMQTT_MULTITHREAD\n readLocked = 1; /* if in this state read is locked */\n #endif\n\n /* read payload state only happens for publish messages */\n if (*mms_stat == MQTT_MSG_READ_PAYLOAD) {\n packet_type = MQTT_PACKET_TYPE_PUBLISH;\n }\n\n /* Determine if we received data for this request */\n if ((wait_type == MQTT_PACKET_TYPE_ANY ||\n wait_type == packet_type ||\n (MqttIsPubRespPacket(packet_type) &&\n MqttIsPubRespPacket(wait_type))) &&\n (wait_packet_id == 0 || wait_packet_id == packet_id))\n {\n use_packet_obj = packet_obj;\n waitMatchFound = 1;\n }\n else {\n /* use generic packet object */\n use_packet_obj = &client->msg;\n }\n use_packet_type = packet_type;\n\n #ifdef WOLFMQTT_MULTITHREAD\n /* Check to see if we have a pending response for this packet */\n pendResp = NULL;\n rc = wm_SemLock(&client->lockClient);\n if (rc == 0) {\n if (MqttClient_RespList_Find(client, packet_type, packet_id,\n &pendResp)) {\n /* we found packet match this incoming read packet */\n pendResp->packetProcessing = 1;\n use_packet_obj = pendResp->packet_obj;\n use_packet_type = pendResp->packet_type;\n /* req from another thread... not a match */\n waitMatchFound = 0;\n }\n wm_SemUnlock(&client->lockClient);\n }\n else {\n break; /* error */\n }\n #endif /* WOLFMQTT_MULTITHREAD */\n\n /* Perform packet handling for publish callback and QoS */\n rc = MqttClient_HandlePacket(client, use_packet_type,\n use_packet_obj, timeout_ms);\n\n #ifdef WOLFMQTT_NONBLOCK\n if (rc == MQTT_CODE_CONTINUE) {\n /* we have received some data, so keep the recv\n mutex lock active and return */\n return rc;\n }\n #endif\n\n /* handle success case */\n if (rc >= 0) {\n rc = MQTT_CODE_SUCCESS;\n }\n\n #ifdef WOLFMQTT_MULTITHREAD\n if (pendResp) {\n /* Mark pending response entry done */\n if (wm_SemLock(&client->lockClient) == 0) {\n pendResp->packetDone = 1;\n pendResp->packet_ret = rc;\n #ifdef WOLFMQTT_DEBUG_CLIENT\n PRINTF(\"PendResp Done %p\", pendResp);\n #endif\n pendResp = NULL;\n wm_SemUnlock(&client->lockClient);\n }\n }\n #endif /* WOLFMQTT_MULTITHREAD */\n break;\n }\n\n case MQTT_MSG_WRITE:\n case MQTT_MSG_WRITE_PAYLOAD:\n default:\n {\n #ifdef WOLFMQTT_DEBUG_CLIENT\n PRINTF(\"MqttClient_WaitType: Invalid state %d!\", *mms_stat);\n #endif\n rc = MQTT_CODE_ERROR_STAT;\n break;\n }\n } /* switch (*mms_stat) */\n\n#ifdef WOLFMQTT_NONBLOCK\n if (rc != MQTT_CODE_CONTINUE)\n#endif\n {\n /* reset state */\n *mms_stat = MQTT_MSG_BEGIN;\n }\n\n#ifdef WOLFMQTT_MULTITHREAD\n if (readLocked) {\n wm_SemUnlock(&client->lockRecv);\n }\n#endif\n if (rc < 0) {\n #ifdef WOLFMQTT_DEBUG_CLIENT\n PRINTF(\"MqttClient_WaitType: Failure: %s (%d)\",\n MqttClient_ReturnCodeToString(rc), rc);\n #endif\n return rc;\n }\n\n if (!waitMatchFound) {\n /* if we get here, then the we are still waiting for a packet */\n goto wait_again;\n }\n\n return rc;\n}", "label": 1, "label_name": "safe"} -{"code": "\tpublic function testPages () {\n $this->visitPages ( $this->allPages );\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": " it 'should require a name' do\n expect {\n Puppet::Type.type(:rabbitmq_user).new({})\n }.to raise_error(Puppet::Error, 'Title or name must be provided')\n end", "label": 0, "label_name": "vulnerable"} -{"code": "void CoreUserInputHandler::handleMsg(const BufferInfo &bufferInfo, const QString &msg)\n{\n Q_UNUSED(bufferInfo);\n if (!msg.contains(' '))\n return;\n\n QString target = msg.section(' ', 0, 0);\n QByteArray encMsg = userEncode(target, msg.section(' ', 1));\n\n#ifdef HAVE_QCA2\n putPrivmsg(serverEncode(target), encMsg, network()->cipher(target));\n#else\n putPrivmsg(serverEncode(target), encMsg);\n#endif\n}", "label": 0, "label_name": "vulnerable"} -{"code": "nautilus_file_mark_desktop_file_executable (GFile *file,\n GtkWindow *parent_window,\n gboolean interactive,\n NautilusOpCallback done_callback,\n gpointer done_callback_data)\n{\n GTask *task;\n MarkTrustedJob *job;\n\n job = op_job_new (MarkTrustedJob, parent_window);\n job->file = g_object_ref (file);\n job->interactive = interactive;\n job->done_callback = done_callback;\n job->done_callback_data = done_callback_data;\n\n task = g_task_new (NULL, NULL, mark_desktop_file_executable_task_done, job);\n g_task_set_task_data (task, job, NULL);\n g_task_run_in_thread (task, mark_desktop_file_executable_task_thread_func);\n g_object_unref (task);\n}", "label": 1, "label_name": "safe"} -{"code": " public function display_sdm_stats_meta_box($post) { //Stats metabox\n\t$old_count = get_post_meta($post->ID, 'sdm_count_offset', true);\n\t$value = isset($old_count) && $old_count != '' ? $old_count : '0';\n\n\t// Get checkbox for \"disable download logging\"\n\t$no_logs = get_post_meta($post->ID, 'sdm_item_no_log', true);\n\t$checked = isset($no_logs) && $no_logs === 'on' ? 'checked=\"checked\"' : '';\n\n\t_e('These are the statistics for this download item.', 'simple-download-monitor');\n\techo '

    ';\n\n\tglobal $wpdb;\n\t$wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'sdm_downloads WHERE post_id=%s', $post->ID));\n\n\techo '
    ';\n\t_e('Number of Downloads:', 'simple-download-monitor');\n\techo ' ' . $wpdb->num_rows . '';\n\techo '
    ';\n\n\techo '
    ';\n\t_e('Offset Count: ', 'simple-download-monitor');\n\techo '
    ';\n\techo ' ';\n\techo '

    ' . __('Enter any positive or negative numerical value; to offset the download count shown to the visitors (when using the download counter shortcode).', 'simple-download-monitor') . '

    ';\n\techo '
    ';\n\n\techo '
    ';\n\techo '
    ';\n\techo '';\n\techo '';\n\t_e('Disable download logging for this item.', 'simple-download-monitor');\n\techo '
    ';\n\n\twp_nonce_field('sdm_count_offset_nonce', 'sdm_count_offset_nonce_check');\n }", "label": 0, "label_name": "vulnerable"} -{"code": "void jas_matrix_asr(jas_matrix_t *matrix, int n)\n{\n\tjas_matind_t i;\n\tjas_matind_t j;\n\tjas_seqent_t *rowstart;\n\tjas_matind_t rowstep;\n\tjas_seqent_t *data;\n\n\tassert(n >= 0);\n\tif (jas_matrix_numrows(matrix) > 0 && jas_matrix_numcols(matrix) > 0) {\n\t\tassert(matrix->rows_);\n\t\trowstep = jas_matrix_rowstep(matrix);\n\t\tfor (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i,\n\t\t rowstart += rowstep) {\n\t\t\tfor (j = matrix->numcols_, data = rowstart; j > 0; --j,\n\t\t\t ++data) {\n\t\t\t\t//*data >>= n;\n\t\t\t\t*data = jas_seqent_asr(*data, n);\n\t\t\t}\n\t\t}\n\t}\n}", "label": 1, "label_name": "safe"} -{"code": " public function AddCC($address, $name = '') {\n return $this->AddAnAddress('cc', $address, $name);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "static int asn1_decode_entry(sc_context_t *ctx,struct sc_asn1_entry *entry,\n\t\t\t const u8 *obj, size_t objlen, int depth)\n{\n\tvoid *parm = entry->parm;\n\tint (*callback_func)(sc_context_t *nctx, void *arg, const u8 *nobj,\n\t\t\t size_t nobjlen, int ndepth);\n\tsize_t *len = (size_t *) entry->arg;\n\tint r = 0;\n\n\tcallback_func = parm;\n\n\tsc_debug(ctx, SC_LOG_DEBUG_ASN1, \"%*.*sdecoding '%s', raw data:%s%s\\n\",\n\t\tdepth, depth, \"\", entry->name,\n\t\tsc_dump_hex(obj, objlen > 16 ? 16 : objlen),\n\t\tobjlen > 16 ? \"...\" : \"\");\n\n\tswitch (entry->type) {\n\tcase SC_ASN1_STRUCT:\n\t\tif (parm != NULL)\n\t\t\tr = asn1_decode(ctx, (struct sc_asn1_entry *) parm, obj,\n\t\t\t\t objlen, NULL, NULL, 0, depth + 1);\n\t\tbreak;\n\tcase SC_ASN1_NULL:\n\t\tbreak;\n\tcase SC_ASN1_BOOLEAN:\n\t\tif (parm != NULL) {\n\t\t\tif (objlen != 1) {\n\t\t\t\tsc_debug(ctx, SC_LOG_DEBUG_ASN1,\n\t\t\t\t\t \"invalid ASN.1 object length: %\"SC_FORMAT_LEN_SIZE_T\"u\\n\",\n\t\t\t\t\t objlen);\n\t\t\t\tr = SC_ERROR_INVALID_ASN1_OBJECT;\n\t\t\t} else\n\t\t\t\t*((int *) parm) = obj[0] ? 1 : 0;\n\t\t}\n\t\tbreak;\n\tcase SC_ASN1_INTEGER:\n\tcase SC_ASN1_ENUMERATED:\n\t\tif (parm != NULL) {\n\t\t\tr = sc_asn1_decode_integer(obj, objlen, (int *) entry->parm);\n\t\t\tsc_debug(ctx, SC_LOG_DEBUG_ASN1, \"%*.*sdecoding '%s' returned %d\\n\", depth, depth, \"\",\n\t\t\t\t\tentry->name, *((int *) entry->parm));\n\t\t}\n\t\tbreak;\n\tcase SC_ASN1_BIT_STRING_NI:\n\tcase SC_ASN1_BIT_STRING:\n\t\tif (parm != NULL) {\n\t\t\tint invert = entry->type == SC_ASN1_BIT_STRING ? 1 : 0;\n\t\t\tassert(len != NULL);\n\t\t\tif (objlen < 1) {\n\t\t\t\tr = SC_ERROR_INVALID_ASN1_OBJECT;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (entry->flags & SC_ASN1_ALLOC) {\n\t\t\t\tu8 **buf = (u8 **) parm;\n\t\t\t\t*buf = malloc(objlen-1);\n\t\t\t\tif (*buf == NULL) {\n\t\t\t\t\tr = SC_ERROR_OUT_OF_MEMORY;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t*len = objlen-1;\n\t\t\t\tparm = *buf;\n\t\t\t}\n\t\t\tr = decode_bit_string(obj, objlen, (u8 *) parm, *len, invert);\n\t\t\tif (r >= 0) {\n\t\t\t\t*len = r;\n\t\t\t\tr = 0;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase SC_ASN1_BIT_FIELD:\n\t\tif (parm != NULL)\n\t\t\tr = decode_bit_field(obj, objlen, (u8 *) parm, *len);\n\t\tbreak;\n\tcase SC_ASN1_OCTET_STRING:\n\t\tif (parm != NULL) {\n\t\t\tsize_t c;\n\t\t\tassert(len != NULL);\n\n\t\t\t/* Strip off padding zero */\n\t\t\tif ((entry->flags & SC_ASN1_UNSIGNED)\n\t\t\t\t\t&& objlen > 1 && obj[0] == 0x00) {\n\t\t\t\tobjlen--;\n\t\t\t\tobj++;\n\t\t\t}\n\n\t\t\t/* Allocate buffer if needed */\n\t\t\tif (entry->flags & SC_ASN1_ALLOC) {\n\t\t\t\tu8 **buf = (u8 **) parm;\n\t\t\t\t*buf = malloc(objlen);\n\t\t\t\tif (*buf == NULL) {\n\t\t\t\t\tr = SC_ERROR_OUT_OF_MEMORY;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tc = *len = objlen;\n\t\t\t\tparm = *buf;\n\t\t\t} else\n\t\t\t\tc = objlen > *len ? *len : objlen;\n\n\t\t\tmemcpy(parm, obj, c);\n\t\t\t*len = c;\n\t\t}\n\t\tbreak;\n\tcase SC_ASN1_GENERALIZEDTIME:\n\t\tif (parm != NULL) {\n\t\t\tsize_t c;\n\t\t\tassert(len != NULL);\n\t\t\tif (entry->flags & SC_ASN1_ALLOC) {\n\t\t\t\tu8 **buf = (u8 **) parm;\n\t\t\t\t*buf = malloc(objlen);\n\t\t\t\tif (*buf == NULL) {\n\t\t\t\t\tr = SC_ERROR_OUT_OF_MEMORY;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tc = *len = objlen;\n\t\t\t\tparm = *buf;\n\t\t\t} else\n\t\t\t\tc = objlen > *len ? *len : objlen;\n\n\t\t\tmemcpy(parm, obj, c);\n\t\t\t*len = c;\n\t\t}\n\t\tbreak;\n\tcase SC_ASN1_OBJECT:\n\t\tif (parm != NULL)\n\t\t\tr = sc_asn1_decode_object_id(obj, objlen, (struct sc_object_id *) parm);\n\t\tbreak;\n\tcase SC_ASN1_PRINTABLESTRING:\n\tcase SC_ASN1_UTF8STRING:\n\t\tif (parm != NULL) {\n\t\t\tassert(len != NULL);\n\t\t\tif (entry->flags & SC_ASN1_ALLOC) {\n\t\t\t\tu8 **buf = (u8 **) parm;\n\t\t\t\t*buf = malloc(objlen+1);\n\t\t\t\tif (*buf == NULL) {\n\t\t\t\t\tr = SC_ERROR_OUT_OF_MEMORY;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t*len = objlen+1;\n\t\t\t\tparm = *buf;\n\t\t\t}\n\t\t\tr = sc_asn1_decode_utf8string(obj, objlen, (u8 *) parm, len);\n\t\t\tif (entry->flags & SC_ASN1_ALLOC) {\n\t\t\t\t*len -= 1;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase SC_ASN1_PATH:\n\t\tif (entry->parm != NULL)\n\t\t\tr = asn1_decode_path(ctx, obj, objlen, (sc_path_t *) parm, depth);\n\t\tbreak;\n\tcase SC_ASN1_PKCS15_ID:\n\t\tif (entry->parm != NULL) {\n\t\t\tstruct sc_pkcs15_id *id = (struct sc_pkcs15_id *) parm;\n\t\t\tsize_t c = objlen > sizeof(id->value) ? sizeof(id->value) : objlen;\n\n\t\t\tmemcpy(id->value, obj, c);\n\t\t\tid->len = c;\n\t\t}\n\t\tbreak;\n\tcase SC_ASN1_PKCS15_OBJECT:\n\t\tif (entry->parm != NULL)\n\t\t\tr = asn1_decode_p15_object(ctx, obj, objlen, (struct sc_asn1_pkcs15_object *) parm, depth);\n\t\tbreak;\n\tcase SC_ASN1_ALGORITHM_ID:\n\t\tif (entry->parm != NULL)\n\t\t\tr = sc_asn1_decode_algorithm_id(ctx, obj, objlen, (struct sc_algorithm_id *) parm, depth);\n\t\tbreak;\n\tcase SC_ASN1_SE_INFO:\n\t\tif (entry->parm != NULL)\n\t\t\tr = asn1_decode_se_info(ctx, obj, objlen, (sc_pkcs15_sec_env_info_t ***)entry->parm, len, depth);\n\t\tbreak;\n\tcase SC_ASN1_CALLBACK:\n\t\tif (entry->parm != NULL)\n\t\t\tr = callback_func(ctx, entry->arg, obj, objlen, depth);\n\t\tbreak;\n\tdefault:\n\t\tsc_debug(ctx, SC_LOG_DEBUG_ASN1, \"invalid ASN.1 type: %d\\n\", entry->type);\n\t\treturn SC_ERROR_INVALID_ASN1_OBJECT;\n\t}\n\tif (r) {\n\t\tsc_debug(ctx, SC_LOG_DEBUG_ASN1, \"decoding of ASN.1 object '%s' failed: %s\\n\", entry->name,\n\t\t sc_strerror(r));\n\t\treturn r;\n\t}\n\tentry->flags |= SC_ASN1_PRESENT;\n\treturn 0;\n}", "label": 1, "label_name": "safe"} -{"code": "void *hashtable_get(hashtable_t *hashtable, const char *key)\n{\n pair_t *pair;\n size_t hash;\n bucket_t *bucket;\n\n hash = hash_str(key);\n bucket = &hashtable->buckets[hash & hashmask(hashtable->order)];\n\n pair = hashtable_find_pair(hashtable, bucket, key, hash);\n if(!pair)\n return NULL;\n\n return pair->value;\n}", "label": 1, "label_name": "safe"} -{"code": "void CtcpParser::query(CoreNetwork *net, const QString &bufname, const QString &ctcpTag, const QString &message)\n{\n QList params;\n params << net->serverEncode(bufname) << lowLevelQuote(pack(net->serverEncode(ctcpTag), net->userEncode(bufname, message)));\n\n static const char *splitter = \" .,-!?\";\n int maxSplitPos = message.count();\n int splitPos = maxSplitPos;\n\n int overrun = net->userInputHandler()->lastParamOverrun(\"PRIVMSG\", params);\n if (overrun) {\n maxSplitPos = message.count() - overrun -2;\n splitPos = -1;\n for (const char *splitChar = splitter; *splitChar != 0; splitChar++) {\n splitPos = qMax(splitPos, message.lastIndexOf(*splitChar, maxSplitPos) + 1); // keep split char on old line\n }\n if (splitPos <= 0 || splitPos > maxSplitPos)\n splitPos = maxSplitPos;\n\n params = params.mid(0, 1) << lowLevelQuote(pack(net->serverEncode(ctcpTag), net->userEncode(bufname, message.left(splitPos))));\n }\n net->putCmd(\"PRIVMSG\", params);\n\n if (splitPos < message.count())\n query(net, bufname, ctcpTag, message.mid(splitPos));\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function testConstruct()\n {\n $handler = new NativeSessionHandler();\n\n // note for PHPUnit optimisers - the use of assertTrue/False\n // here is deliberate since the tests do not require the classes to exist - drak\n if (PHP_VERSION_ID < 50400) {\n $this->assertFalse($handler instanceof \\SessionHandler);\n $this->assertTrue($handler instanceof NativeSessionHandler);\n } else {\n $this->assertTrue($handler instanceof \\SessionHandler);\n $this->assertTrue($handler instanceof NativeSessionHandler);\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function testCamelize($id, $expected)\n {\n $this->assertEquals($expected, Container::camelize($id), sprintf('Container::camelize(\"%s\")', $id));\n }", "label": 0, "label_name": "vulnerable"} -{"code": " static function author() {\n return \"Dave Leffler\";\n }", "label": 1, "label_name": "safe"} -{"code": "(window.webpackJsonpLHCReactAPP=window.webpackJsonpLHCReactAPP||[]).push([[2],{513:function(e,t,a){\"use strict\";a.r(t);var n=a(6),l=a.n(n),c=a(7),o=a.n(c),s=a(9),i=a.n(s),r=a(10),m=a.n(r),d=a(3),u=a.n(d),p=a(11),h=a.n(p),b=a(12),f=a.n(b),g=a(0),E=a.n(g),v=(a(20),a(25)),N=function(e){function t(e){var a;return l()(this,t),a=i()(this,m()(t).call(this,e)),f()(u()(a),\"state\",{mail:null,success:\"\",errors:null,sending:!1}),f()(u()(a),\"dismissModal\",(function(){a.props.toggle()})),a.changeFont=a.changeFont.bind(u()(a)),a.emailRef=E.a.createRef(),a}return h()(t,e),o()(t,[{key:\"changeFont\",value:function(e){this.props.changeFont(e)}},{key:\"componentDidMount\",value:function(){}},{key:\"render\",value:function(){var e=this;this.props.t;return E.a.createElement(E.a.Fragment,null,E.a.createElement(\"div\",{role:\"dialog\",id:\"dialog-content\",\"aria-modal\":\"true\",className:\"fade modal show d-block p-1 pt-0 pb-0\",tabIndex:\"-1\",style:{top:\"auto\",bottom:\"0\",height:\"auto\"}},E.a.createElement(\"div\",{className:\"modal-content radius-0 border-0\"},E.a.createElement(\"div\",{className:\"modal-body pl-2 pr-2 pt-0 pb-0\"},E.a.createElement(\"div\",{className:\"mb-0\"},E.a.createElement(\"div\",{className:\"row\"},E.a.createElement(\"div\",{className:\"col-5 mr-0 pr-1 text-center\"},E.a.createElement(\"a\",{href:\"#\",onClick:function(){return e.changeFont(!1)},className:\"d-block font-weight-bold font-button\"},\"-\",E.a.createElement(\"i\",{className:\"material-icons chat-setting-item\"},\"\uf11d\"))),E.a.createElement(\"div\",{className:\"col-5 ml-0 pl-1 pr-1 text-center\"},E.a.createElement(\"a\",{href:\"#\",onClick:function(){return e.changeFont(!0)},className:\"d-block font-weight-bold font-button\"},\"+\",E.a.createElement(\"i\",{className:\"material-icons chat-setting-item\"},\"\uf11d\"))),E.a.createElement(\"div\",{className:\"col-2 pl-1\"},E.a.createElement(\"button\",{type:\"button\",className:\"close w-100 text-success\",\"data-dismiss\":\"modal\",onClick:this.dismissModal,\"aria-label\":\"Close\"},E.a.createElement(\"span\",{\"aria-hidden\":\"true\"},\"\u2713\")))))))))}}]),t}(g.PureComponent);t.default=Object(v.b)()(N)}}]);", "label": 0, "label_name": "vulnerable"} -{"code": "\tfunction setParameter($a_name, $a_value)\n\t{\n\t\tif ($this->checkParameter($a_name, $a_value))\n\t\t{\n\t\t\t$this->parameters[$a_name] = $a_value;\n\t\t}\n\t}", "label": 1, "label_name": "safe"} -{"code": " public function setUp()\n {\n $this->request = new CaptureRequest($this->getHttpClient(), $this->getHttpRequest());\n $this->request->setTransactionReference('foo');\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\"geTempDlgCreateBtn geTempDlgBtnDisabled\")}function y(fa,ca){if(null!=I){var ba=function(oa){qa.isExternal?e(qa,function(na){ja(na,oa)},ia):qa.url?mxUtils.get(TEMPLATE_PATH+\"/\"+qa.url,mxUtils.bind(this,function(na){200<=na.getStatus()&&299>=na.getStatus()?ja(na.getText(),oa):ia()})):ja(b.emptyDiagramXml,oa)},ja=function(oa,na){x||b.hideDialog(!0);f(oa,na,qa,ca)},ia=function(){A(mxResources.get(\"cannotLoad\"));ma()},ma=function(){I=qa;Ba.className=\"geTempDlgCreateBtn\";ca&&(Ka.className=\"geTempDlgOpenBtn\")},", "label": 0, "label_name": "vulnerable"} -{"code": "{type:\"vbox\",padding:0,children:[{type:\"hbox\",widths:[\"5em\"],children:[{type:\"text\",id:\"txtWidth\",requiredContent:\"table{width}\",controlStyle:\"width:5em\",label:a.lang.common.width,title:a.lang.common.cssLengthTooltip,\"default\":a.filter.check(\"table{width}\")?500>n.getSize(\"width\")?\"100%\":500:0,getValue:q,validate:CKEDITOR.dialog.validate.cssLength(a.lang.common.invalidCssLength.replace(\"%1\",a.lang.common.width)),onChange:function(){var a=this.getDialog().getContentElement(\"advanced\",\"advStyles\");a&&\na.updateStyle(\"width\",this.getValue())},setup:function(a){this.setValue(a.getStyle(\"width\"))},commit:k}]},{type:\"hbox\",widths:[\"5em\"],children:[{type:\"text\",id:\"txtHeight\",requiredContent:\"table{height}\",controlStyle:\"width:5em\",label:a.lang.common.height,title:a.lang.common.cssLengthTooltip,\"default\":\"\",getValue:q,validate:CKEDITOR.dialog.validate.cssLength(a.lang.common.invalidCssLength.replace(\"%1\",a.lang.common.height)),onChange:function(){var a=this.getDialog().getContentElement(\"advanced\",\"advStyles\");", "label": 1, "label_name": "safe"} -{"code": " public function testFilterDoesNothingForSubRequests()\n {\n $dispatcher = new EventDispatcher();\n $kernel = $this->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface');\n $response = new Response('foo ');\n $listener = new SurrogateListener(new Esi());\n\n $dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse'));\n $event = new FilterResponseEvent($kernel, new Request(), HttpKernelInterface::SUB_REQUEST, $response);\n $dispatcher->dispatch(KernelEvents::RESPONSE, $event);\n\n $this->assertEquals('', $event->getResponse()->headers->get('Surrogate-Control'));\n }", "label": 0, "label_name": "vulnerable"} -{"code": "func (voteSet *VoteSet) MakeCommit() *Commit {\n\tif voteSet.signedMsgType != tmproto.PrecommitType {\n\t\tpanic(\"Cannot MakeCommit() unless VoteSet.Type is PrecommitType\")\n\t}\n\tvoteSet.mtx.Lock()\n\tdefer voteSet.mtx.Unlock()\n\n\t// Make sure we have a 2/3 majority\n\tif voteSet.maj23 == nil {\n\t\tpanic(\"Cannot MakeCommit() unless a blockhash has +2/3\")\n\t}\n\n\t// For every validator, get the precommit\n\tcommitSigs := make([]CommitSig, len(voteSet.votes))\n\tfor i, v := range voteSet.votes {\n\t\tcommitSigs[i] = v.CommitSig()\n\t}\n\n\treturn NewCommit(voteSet.GetHeight(), voteSet.GetRound(), *voteSet.maj23, commitSigs)\n}", "label": 0, "label_name": "vulnerable"} -{"code": "Ka(a,e,d,d===k?k:e._aData).data;else{var j=e.anCells;if(j)if(d!==k)g(j[d],d);else{c=0;for(f=j.length;cignorePassiveAddress) && defined('FTP_USEPASVADDRESS')) {\n ftp_set_option($this->connection, FTP_USEPASVADDRESS, ! $this->ignorePassiveAddress);\n }\n\n if ( ! ftp_pasv($this->connection, $this->passive)) {\n throw new RuntimeException(\n 'Could not set passive mode for connection: ' . $this->getHost() . '::' . $this->getPort()\n );\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\"\"),mxUtils.bind(this,function(y){window.clearTimeout(v);q&&(200<=y.getStatus()&&299>=y.getStatus()?null!=l&&l():d({code:y.getStatus(),message:y.getStatus()}))}));EditorUi.debug(\"DrawioFileSync.fileSaved\",[this],\"diff\",g,m.length,\"bytes\",\"from\",c,\"to\",e,\"etag\",this.file.getCurrentEtag(),\"checksum\",k)}}this.file.setShadowPages(b);this.scheduleCleanup()};", "label": 1, "label_name": "safe"} -{"code": " public function toString()\n {\n // reconstruct authority\n $authority = null;\n // there is a rendering difference between a null authority\n // (http:foo-bar) and an empty string authority\n // (http:///foo-bar).\n if (!is_null($this->host)) {\n $authority = '';\n if (!is_null($this->userinfo)) {\n $authority .= $this->userinfo . '@';\n }\n $authority .= $this->host;\n if (!is_null($this->port)) {\n $authority .= ':' . $this->port;\n }\n }\n\n // Reconstruct the result\n // One might wonder about parsing quirks from browsers after\n // this reconstruction. Unfortunately, parsing behavior depends\n // on what *scheme* was employed (file:///foo is handled *very*\n // differently than http:///foo), so unfortunately we have to\n // defer to the schemes to do the right thing.\n $result = '';\n if (!is_null($this->scheme)) {\n $result .= $this->scheme . ':';\n }\n if (!is_null($authority)) {\n $result .= '//' . $authority;\n }\n $result .= $this->path;\n if (!is_null($this->query)) {\n $result .= '?' . $this->query;\n }\n if (!is_null($this->fragment)) {\n $result .= '#' . $this->fragment;\n }\n\n return $result;\n }", "label": 1, "label_name": "safe"} -{"code": " def __eq__(self, other):\n return (argparse.Namespace.__eq__(self, other) and\n self.uname == other.uname and self.lang_code == other.lang_code and\n self.timestamp == other.timestamp and self.font_config_cache == other.font_config_cache and\n self.fonts_dir == other.fonts_dir and self.max_pages == other.max_pages and\n self.save_box_tiff == other.save_box_tiff and self.overwrite == other.overwrite and\n self.linedata == other.linedata and self.run_shape_clustering == other.run_shape_clustering and\n self.extract_font_properties == other.extract_font_properties and\n self.distort_image == other.distort_image)", "label": 0, "label_name": "vulnerable"} -{"code": " public static function delete($id){\r\n $vars = array(\r\n 'table' => 'user',\r\n 'where' => array(\r\n 'id' => $id\r\n )\r\n );\r\n Db::delete($vars);\r\n\r\n $vars = array(\r\n 'table' => 'user_detail',\r\n 'where' => array(\r\n 'id' => $id\r\n )\r\n );\r\n Db::delete($vars);\r\n Hooks::run('user_sqldel_action', $vars);\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": "elFinder.prototype.commands.forward = function() {\n\tthis.alwaysEnabled = true;\n\tthis.updateOnSelect = true;\n\tthis.shortcuts = [{\n\t\tpattern : 'ctrl+right'\n\t}];\n\t\n\tthis.getstate = function() {\n\t\treturn this.fm.history.canForward() ? 0 : -1;\n\t}\n\t\n\tthis.exec = function() {\n\t\treturn this.fm.history.forward();\n\t}\n\t\n}", "label": 0, "label_name": "vulnerable"} +{"code": "bool createBLSShare(const string &blsKeyName, const char *s_shares, const char *encryptedKeyHex) {\n\n CHECK_STATE(s_shares);\n CHECK_STATE(encryptedKeyHex);\n\n vector errMsg(BUF_LEN,0);\n int errStatus = 0;\n\n uint64_t decKeyLen;\n SAFE_UINT8_BUF(encr_bls_key,BUF_LEN);\n SAFE_UINT8_BUF(encr_key,BUF_LEN);\n if (!hex2carray(encryptedKeyHex, &decKeyLen, encr_key, BUF_LEN)) {\n throw SGXException(INVALID_HEX, \"Invalid encryptedKeyHex\");\n }\n\n uint64_t enc_bls_len = 0;\n\n sgx_status_t status = trustedCreateBlsKeyAES(eid, &errStatus, errMsg.data(), s_shares, encr_key, decKeyLen, encr_bls_key,\n &enc_bls_len);\n\n HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus, errMsg.data());\n\n SAFE_CHAR_BUF(hexBLSKey,2 * BUF_LEN)\n\n carray2Hex(encr_bls_key, enc_bls_len, hexBLSKey, 2 * BUF_LEN);\n\n SGXWalletServer::writeDataToDB(blsKeyName, hexBLSKey);\n\n return true;\n\n}", "label": 1, "label_name": "safe"} +{"code": "void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt)\n{\n\tstatic atomic_t ipv6_fragmentation_id;\n\tint old, new;\n\n\tif (rt) {\n\t\tstruct inet_peer *peer;\n\n\t\tif (!rt->rt6i_peer)\n\t\t\trt6_bind_peer(rt, 1);\n\t\tpeer = rt->rt6i_peer;\n\t\tif (peer) {\n\t\t\tfhdr->identification = htonl(inet_getid(peer, 0));\n\t\t\treturn;\n\t\t}\n\t}\n\tdo {\n\t\told = atomic_read(&ipv6_fragmentation_id);\n\t\tnew = old + 1;\n\t\tif (!new)\n\t\t\tnew = 1;\n\t} while (atomic_cmpxchg(&ipv6_fragmentation_id, old, new) != old);\n\tfhdr->identification = htonl(new);\n}", "label": 1, "label_name": "safe"} +{"code": "ber_parse_header(STREAM s, int tagval, uint32 *length)\n{\n\tint tag, len;\n\n\tif (tagval > 0xff)\n\t{\n\t\tin_uint16_be(s, tag);\n\t}\n\telse\n\t{\n\t\tin_uint8(s, tag);\n\t}\n\n\tif (tag != tagval)\n\t{\n\t\tlogger(Core, Error, \"ber_parse_header(), expected tag %d, got %d\", tagval, tag);\n\t\treturn False;\n\t}\n\n\tin_uint8(s, len);\n\n\tif (len & 0x80)\n\t{\n\t\tlen &= ~0x80;\n\t\t*length = 0;\n\t\twhile (len--)\n\t\t\tnext_be(s, *length);\n\t}\n\telse\n\t\t*length = len;\n\n\treturn s_check(s);\n}", "label": 1, "label_name": "safe"} +{"code": " function build_daterange_sql($timestamp, $endtimestamp=null, $field='date', $multiday=false) {\n if (empty($endtimestamp)) {\n $date_sql = \"((\".$field.\" >= \" . expDateTime::startOfDayTimestamp($timestamp) . \" AND \".$field.\" <= \" . expDateTime::endOfDayTimestamp($timestamp) . \")\";\n } else {\n $date_sql = \"((\".$field.\" >= \" . expDateTime::startOfDayTimestamp($timestamp) . \" AND \".$field.\" <= \" . expDateTime::endOfDayTimestamp($endtimestamp) . \")\";\n }\n if ($multiday)\n $date_sql .= \" OR (\" . expDateTime::startOfDayTimestamp($timestamp) . \" BETWEEN \".$field.\" AND dateFinished)\";\n $date_sql .= \")\";\n return $date_sql;\n }", "label": 1, "label_name": "safe"} +{"code": " private void Setup()\n {\n \n\n\n Console.WriteLine(\"Creating settings\");\n \n var settings = Config.Load();\n\n \n \n Console.WriteLine(\"Configuring up server\");\n Tools.ConfigureServer();\n \n \n \n Console.WriteLine(Assembly.GetExecutingAssembly().GetName().Version);\n var useTerminal = settings.Terminal.AllowTerminal;\n var useWebServer = settings.WebServer.ToggleWebServer;\n var useWebCams = settings.Webcams.UseWebcams;\n if (useWebCams)\n {\n Console.WriteLine(\"Loading Webcams\");\n WebCamManager.LoadCameras();\n }\n if (useWebServer)\n {\n Console.WriteLine(\"Setting up HTTP Server\");\n HttpServer.Setup();\n }\n systemService = new SystemService();\n Console.WriteLine(\"Creating system service\");\n systemService.Start();\n UlteriusApiServer.RunningAsService = Tools.RunningAsService();\n Console.Write($\"Service: {UlteriusApiServer.RunningAsService}\");\n UlteriusApiServer.Start();\n \n if (useTerminal)\n {\n Console.WriteLine(\"Starting Terminal API\");\n TerminalManagerServer.Start();\n }\n try\n {\n var useUpnp = settings.Network.UpnpEnabled;\n if (useUpnp)\n {\n Console.WriteLine(\"Trying to forward ports\");\n Tools.ForwardPorts();\n }\n }\n catch (Exception)\n {\n Console.WriteLine(\"Failed to forward ports\");\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "function action_wireless(iface)\n\tluci.http.prepare_content(\"application/json\")\n\n\tlocal bwc = io.popen(\"luci-bwc -r '%s' 2>/dev/null\" % iface:gsub(\"'\", \"\"))\n\tif bwc then\n\t\tluci.http.write(\"[\")\n\n\t\twhile true do\n\t\t\tlocal ln = bwc:read(\"*l\")\n\t\t\tif not ln then break end\n\t\t\tluci.http.write(ln)\n\t\tend\n\n\t\tluci.http.write(\"]\")\n\t\tbwc:close()\n\tend\nend", "label": 1, "label_name": "safe"} +{"code": "func evalAndCollect(ev *eval.Evaler, code string) (\n\toutBytes []byte, outValues []interface{}, errBytes []byte, err error) {", "label": 0, "label_name": "vulnerable"} +{"code": "func NewConcatKDF(hash crypto.Hash, z, algID, ptyUInfo, ptyVInfo, supPubInfo, supPrivInfo []byte) io.Reader {\n\tbuffer := make([]byte, uint64(len(algID))+uint64(len(ptyUInfo))+uint64(len(ptyVInfo))+uint64(len(supPubInfo))+uint64(len(supPrivInfo)))\n\tn := 0\n\tn += copy(buffer, algID)\n\tn += copy(buffer[n:], ptyUInfo)\n\tn += copy(buffer[n:], ptyVInfo)\n\tn += copy(buffer[n:], supPubInfo)\n\tcopy(buffer[n:], supPrivInfo)\n\n\thasher := hash.New()\n\n\treturn &concatKDF{\n\t\tz: z,\n\t\tinfo: buffer,\n\t\thasher: hasher,\n\t\tcache: []byte{},\n\t\ti: 1,\n\t}\n}", "label": 1, "label_name": "safe"} +{"code": " function query($query)\n {\n $this->log('Auth_Container_MDB::query() called.', AUTH_LOG_DEBUG);\n $err = $this->_prepare();\n if ($err !== true) {\n return $err;\n }\n return $this->db->query($query);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " it 'should return a second factor prompt' do\n get \"/session/email-login/#{email_token.token}\"\n\n expect(response.status).to eq(200)\n\n response_body = CGI.unescapeHTML(response.body)\n\n expect(response_body).to include(I18n.t(\n \"login.second_factor_title\"\n ))\n\n expect(response_body).to_not include(I18n.t(\n \"login.invalid_second_factor_code\"\n ))\n end", "label": 0, "label_name": "vulnerable"} +{"code": " public function testOverNesting()\n {\n $parser = new JBBCode\\Parser();\n $parser->addCodeDefinitionSet(new JBBCode\\DefaultCodeDefinitionSet());\n $parser->addBBCode('quote', '
    {param}
    ', false, true, 2);\n $bbcode = '[quote][quote][quote]wut[/quote] huh?[/quote] i don\\'t know[/quote]';\n $parser->parse($bbcode);\n $expectedBbcode = '[quote][quote] huh?[/quote] i don\\'t know[/quote]';\n $expectedHtml = '
    huh?
    i don\\'t know
    ';\n $this->assertEquals($expectedBbcode, $parser->getAsBBCode());\n $this->assertEquals($expectedHtml, $parser->getAsHtml());\n }", "label": 1, "label_name": "safe"} +{"code": "void * CAPSTONE_API cs_winkernel_malloc(size_t size)\n{\n\t// Disallow zero length allocation because they waste pool header space and,\n\t// in many cases, indicate a potential validation issue in the calling code.\n\tNT_ASSERT(size);\n\n\t// FP; a use of NonPagedPool is required for Windows 7 support\n#pragma prefast(suppress : 30030)\t\t// Allocating executable POOL_TYPE memory\n\tCS_WINKERNEL_MEMBLOCK *block = (CS_WINKERNEL_MEMBLOCK *)ExAllocatePoolWithTag(\n\t\t\tNonPagedPool, size + sizeof(CS_WINKERNEL_MEMBLOCK), CS_WINKERNEL_POOL_TAG);\n\tif (!block) {\n\t\treturn NULL;\n\t}\n\tblock->size = size;\n\n\treturn block->data;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "mcs_parse_domain_params(STREAM s)\n{\n\tuint32 length;\n\tstruct stream packet = *s;\n\n\tber_parse_header(s, MCS_TAG_DOMAIN_PARAMS, &length);\n\n\tif (!s_check_rem(s, length))\n\t{\n\t\trdp_protocol_error(\"mcs_parse_domain_params(), consume domain params from stream would overrun\", &packet);\n\t}\n\n\tin_uint8s(s, length);\n\n\treturn s_check(s);\n}", "label": 1, "label_name": "safe"} +{"code": " message: new MockBuilder(\n {\n from: 'test@valid.sender',\n to: 'test+timeout@valid.recipient'\n },\n message\n )\n },\n function (err) {\n expect(err).to.exist;\n pool.close();\n done();\n }\n );\n });", "label": 1, "label_name": "safe"} +{"code": "Editor.commonVertexProperties=[{name:\"colspan\",dispName:\"Colspan\",type:\"int\",min:1,defVal:1,isVisible:function(u,E){E=E.editorUi.editor.graph;return 1==u.vertices.length&&0==u.edges.length&&E.isTableCell(u.vertices[0])}},{name:\"rowspan\",dispName:\"Rowspan\",type:\"int\",min:1,defVal:1,isVisible:function(u,E){E=E.editorUi.editor.graph;return 1==u.vertices.length&&0==u.edges.length&&E.isTableCell(u.vertices[0])}},{type:\"separator\"},{name:\"resizeLastRow\",dispName:\"Resize Last Row\",type:\"bool\",getDefaultValue:function(u,\nE){u=E.editorUi.editor.graph.getCellStyle(1==u.vertices.length&&0==u.edges.length?u.vertices[0]:null);return\"1\"==mxUtils.getValue(u,\"resizeLastRow\",\"0\")},isVisible:function(u,E){E=E.editorUi.editor.graph;return 1==u.vertices.length&&0==u.edges.length&&E.isTable(u.vertices[0])}},{name:\"resizeLast\",dispName:\"Resize Last Column\",type:\"bool\",getDefaultValue:function(u,E){u=E.editorUi.editor.graph.getCellStyle(1==u.vertices.length&&0==u.edges.length?u.vertices[0]:null);return\"1\"==mxUtils.getValue(u,\"resizeLast\",", "label": 0, "label_name": "vulnerable"} +{"code": " public function api() {\n if (empty($this->params['apikey'])) {\n $_REQUEST['apikey'] = true; // set this to force an ajax reply\n $ar = new expAjaxReply(550, 'Permission Denied', 'You need an API key in order to access Exponent as a Service', null);\n $ar->send(); //FIXME this doesn't seem to work correctly in this scenario\n } else {\n $key = expUnserialize(base64_decode(urldecode($this->params['apikey'])));\n preg_match('/[^a-zA-Z_][^a-zA-Z0-9_]*/', $key, $matches);\n $key = $matches[0];\n $cfg = new expConfig($key);\n $this->config = $cfg->config;\n if(empty($cfg->id)) {\n $ar = new expAjaxReply(550, 'Permission Denied', 'Incorrect API key or Exponent as a Service module configuration missing', null);\n $ar->send();\n } else {\n if (!empty($this->params['get'])) {\n $this->handleRequest();\n } else {\n $ar = new expAjaxReply(200, 'ok', 'Your API key is working, no data requested', null);\n $ar->send();\n }\n }\n }\n }", "label": 1, "label_name": "safe"} +{"code": " size_t operator()(const ArrayOrObject data) const {\n return data.toOpaque();\n }", "label": 1, "label_name": "safe"} +{"code": "PyMem_RawRealloc(void *ptr, size_t new_size)\n{\n /* see PyMem_RawMalloc() */\n if (new_size > (size_t)PY_SSIZE_T_MAX)\n return NULL;\n return _PyMem_Raw.realloc(_PyMem_Raw.ctx, ptr, new_size);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\twp.updates.updatePluginSuccess = function( response ) {\n\t\tvar $pluginRow, $updateMessage, newText;\n\n\t\tif ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {\n\t\t\t$pluginRow = $( 'tr[data-plugin=\"' + response.plugin + '\"]' )\n\t\t\t\t.removeClass( 'update' )\n\t\t\t\t.addClass( 'updated' );\n\t\t\t$updateMessage = $pluginRow.find( '.update-message' )\n\t\t\t\t.removeClass( 'updating-message notice-warning' )\n\t\t\t\t.addClass( 'updated-message notice-success' ).find( 'p' );\n\n\t\t\t// Update the version number in the row.\n\t\t\tnewText = $pluginRow.find( '.plugin-version-author-uri' ).html().replace( response.oldVersion, response.newVersion );\n\t\t\t$pluginRow.find( '.plugin-version-author-uri' ).html( newText );\n\t\t} else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {\n\t\t\t$updateMessage = $( '.plugin-card-' + response.slug ).find( '.update-now' )\n\t\t\t\t.removeClass( 'updating-message' )\n\t\t\t\t.addClass( 'button-disabled updated-message' );\n\t\t}\n\n\t\t$updateMessage\n\t\t\t.attr( 'aria-label', wp.updates.l10n.updatedLabel.replace( '%s', response.pluginName ) )\n\t\t\t.text( wp.updates.l10n.updated );\n\n\t\twp.a11y.speak( wp.updates.l10n.updatedMsg, 'polite' );\n\n\t\twp.updates.decrementCount( 'plugin' );\n\n\t\t$document.trigger( 'wp-plugin-update-success', response );\n\t};", "label": 1, "label_name": "safe"} +{"code": "$.fn.elfindermkdirbutton = function(cmd) {\n\treturn this.each(function() {\n\t\tvar button = $(this).elfinderbutton(cmd);\n\n\t\tcmd.change(function() {\n\t\t\tbutton.attr('title', cmd.value);\n\t\t});\n\t});\n};", "label": 1, "label_name": "safe"} {"code": " public static function getHelpVersion($version_id) {\n global $db;\n\n return $db->selectValue('help_version', 'version', 'id=\"'.$version_id.'\"');\n }", "label": 0, "label_name": "vulnerable"} -{"code": "function(){return this.graph.connectionHandler.isEnabled()})};var ab=mxVertexHandler.prototype.redrawHandles;mxVertexHandler.prototype.redrawHandles=function(){if(null!=this.moveHandles)for(var z=0;z 0 ) {\n\t\t\t\t\t\t$template1 = preg_replace( '/\\|.*/', '', $template1 );\n\t\t\t\t\t\t$template2 = preg_replace( '/^.+\\|/', '', $template2 );\n\t\t\t\t\t}\n\t\t\t\t\t//Why the hell was defaultTemplateSuffix be passed all over the place for just fucking here? --Alexia\n\t\t\t\t\t$secPieces = LST::includeTemplate( $this->parser, $this, $s, $article, $template1, $template2, $template2 . $this->getTemplateSuffix(), $mustMatch, $mustNotMatch, $this->includePageParsed, implode( ', ', $article->mCategoryLinks ) );\n\t\t\t\t\t$secPiece[$s] = implode( isset( $this->multiSectionSeparators[$s] ) ? $this->replaceTagCount( $this->multiSectionSeparators[$s], $filteredCount ) : '', $secPieces );\n\t\t\t\t\tif ( $this->getDominantSectionCount() >= 0 && $s == $this->getDominantSectionCount() && count( $secPieces ) > 1 ) {\n\t\t\t\t\t\t$dominantPieces = $secPieces;\n\t\t\t\t\t}\n\t\t\t\t\tif ( ( $mustMatch != '' || $mustNotMatch != '' ) && count( $secPieces ) <= 1 && $secPieces[0] == '' ) {\n\t\t\t\t\t\t$matchFailed = true; // NOTHING MATCHED\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {", "label": 0, "label_name": "vulnerable"} -{"code": " public function __construct()\n {\n $this->options['alias'] = ''; // alias to replace root dir name\n $this->options['dirMode'] = 0755; // new dirs mode\n $this->options['fileMode'] = 0644; // new files mode\n $this->options['quarantine'] = '.quarantine'; // quarantine folder name - required to check archive (must be hidden)\n $this->options['rootCssClass'] = 'elfinder-navbar-root-local';\n $this->options['followSymLinks'] = true;\n $this->options['detectDirIcon'] = ''; // file name that is detected as a folder icon e.g. '.diricon.png'\n $this->options['keepTimestamp'] = array('copy', 'move'); // keep timestamp at inner filesystem allowed 'copy', 'move' and 'upload'\n $this->options['substituteImg'] = true; // support substitute image with dim command\n $this->options['statCorrector'] = null; // callable to correct stat data `function(&$stat, $path, $statOwner, $volumeDriveInstance){}`\n }", "label": 0, "label_name": "vulnerable"} -{"code": "ta.style.width=\"40px\";ta.style.height=\"12px\";ta.style.marginBottom=\"-2px\";ta.style.backgroundImage=\"url(\"+mxWindow.prototype.normalizeImage+\")\";ta.style.backgroundPosition=\"top center\";ta.style.backgroundRepeat=\"no-repeat\";ta.setAttribute(\"title\",\"Minimize\");var Na=!1,Ca=mxUtils.bind(this,function(){S.innerHTML=\"\";if(!Na){var za=function(Da,La,Ya){Da=X(\"\",Da.funct,null,La,Da,Ya);Da.style.width=\"40px\";Da.style.opacity=\"0.7\";return wa(Da,null,\"pointer\")},wa=function(Da,La,Ya){null!=La&&Da.setAttribute(\"title\",\nLa);Da.style.cursor=null!=Ya?Ya:\"default\";Da.style.margin=\"2px 0px\";S.appendChild(Da);mxUtils.br(S);return Da};wa(U.sidebar.createVertexTemplate(\"text;strokeColor=none;fillColor=none;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;\",60,30,\"Text\",mxResources.get(\"text\"),!0,!1,null,!0,!0),mxResources.get(\"text\")+\" (\"+Editor.ctrlKey+\"+Shift+X)\");wa(U.sidebar.createVertexTemplate(\"shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;fontColor=#000000;darkOpacity=0.05;fillColor=#FFF9B2;strokeColor=none;fillStyle=solid;direction=west;gradientDirection=north;gradientColor=#FFF2A1;shadow=1;size=20;pointerEvents=1;\",", "label": 0, "label_name": "vulnerable"} -{"code": "\tfunction manage_vendors () {\n\t expHistory::set('viewable', $this->params);\n\t\t$vendor = new vendor();\n\t\t\n\t\t$vendors = $vendor->find('all');\n\t\tassign_to_template(array(\n 'vendors'=>$vendors\n ));\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": "parseAssociate(unsigned char *buf, unsigned long pduLength,\n PRV_ASSOCIATEPDU * assoc)\n{\n OFCondition cond = EC_Normal;\n unsigned char\n type;\n unsigned long\n itemLength;\n PRV_PRESENTATIONCONTEXTITEM\n * context;\n\n (void) memset(assoc, 0, sizeof(*assoc));\n if ((assoc->presentationContextList = LST_Create()) == NULL) return EC_MemoryExhausted;\n if ((assoc->userInfo.SCUSCPRoleList = LST_Create()) == NULL) return EC_MemoryExhausted;\n\n // Check if the PDU actually is long enough for the fields we read\n if (pduLength < 2 + 2 + 16 + 16 + 32)\n return makeLengthError(\"associate PDU\", pduLength, 2 + 2 + 16 + 16 + 32);\n\n assoc->type = *buf++;\n assoc->rsv1 = *buf++;\n EXTRACT_LONG_BIG(buf, assoc->length);\n buf += 4;\n\n EXTRACT_SHORT_BIG(buf, assoc->protocol);\n buf += 2;\n pduLength -= 2;\n if ((assoc->protocol & DUL_PROTOCOL) == 0)\n {\n char buffer[256];\n sprintf(buffer, \"DUL Unsupported peer protocol %04x; expected %04x in %s\", assoc->protocol, DUL_PROTOCOL, \"parseAssociate\");\n return makeDcmnetCondition(DULC_UNSUPPORTEDPEERPROTOCOL, OF_error, buffer);\n }\n assoc->rsv2[0] = *buf++;\n pduLength--;\n assoc->rsv2[1] = *buf++;\n pduLength--;\n (void) strncpy(assoc->calledAPTitle, (char *) buf, 16);\n assoc->calledAPTitle[16] = '\\0';\n trim_trailing_spaces(assoc->calledAPTitle);\n\n buf += 16;\n pduLength -= 16;\n (void) strncpy(assoc->callingAPTitle, (char *) buf, 16);\n assoc->callingAPTitle[16] = '\\0';\n trim_trailing_spaces(assoc->callingAPTitle);\n buf += 16;\n pduLength -= 16;\n (void) memcpy(assoc->rsv3, buf, 32);\n buf += 32;\n pduLength -= 32;\n\n if (DCM_dcmnetLogger.isEnabledFor(OFLogger::DEBUG_LOG_LEVEL)) {\n const char *s;\n DCMNET_DEBUG(\"Parsing an A-ASSOCIATE PDU\");\n if (assoc->type == DUL_TYPEASSOCIATERQ)\n s = \"A-ASSOCIATE RQ\";\n else if (assoc->type == DUL_TYPEASSOCIATEAC)\n s = \"A-ASSOCIATE AC\";\n else\n s = \"Unknown: Programming bug in parseAssociate\";\n\n/* If we hit the \"Unknown type\", there is a programming bug somewhere.\n** This function is only supposed to parse A-ASSOCIATE PDUs and\n** expects its input to have been properly screened.\n*/\n DCMNET_TRACE(\"PDU type: \"\n << STD_NAMESPACE hex << ((unsigned int)assoc->type)\n << STD_NAMESPACE dec << \" (\" << s << \"), PDU Length: \" << assoc->length << OFendl\n << \"DICOM Protocol: \"\n << STD_NAMESPACE hex << assoc->protocol\n << STD_NAMESPACE dec << OFendl\n << \"Called AP Title: \" << assoc->calledAPTitle << OFendl\n << \"Calling AP Title: \" << assoc->callingAPTitle);\n }\n while ((cond.good()) && (pduLength > 0))\n {\n type = *buf;\n DCMNET_TRACE(\"Parsing remaining \" << pduLength << \" bytes of A-ASSOCIATE PDU\" << OFendl\n << \"Next item type: \"\n << STD_NAMESPACE hex << STD_NAMESPACE setfill('0') << STD_NAMESPACE setw(2) << ((unsigned int)type));\n switch (type) {\n case DUL_TYPEAPPLICATIONCONTEXT:\n cond = parseSubItem(&assoc->applicationContext,\n buf, &itemLength, pduLength);\n if (cond.good())\n {\n buf += itemLength;\n if (!OFStandard::safeSubtract(pduLength, itemLength, pduLength))\n return makeUnderflowError(\"Application Context item\", pduLength, itemLength);\n DCMNET_TRACE(\"Successfully parsed Application Context\");\n }\n break;\n case DUL_TYPEPRESENTATIONCONTEXTRQ:\n case DUL_TYPEPRESENTATIONCONTEXTAC:\n context = (PRV_PRESENTATIONCONTEXTITEM*)malloc(sizeof(PRV_PRESENTATIONCONTEXTITEM));\n if (context == NULL) return EC_MemoryExhausted;\n (void) memset(context, 0, sizeof(*context));\n cond = parsePresentationContext(type, context, buf, &itemLength, pduLength);\n if (cond.bad()) return cond;\n buf += itemLength;\n if (!OFStandard::safeSubtract(pduLength, itemLength, pduLength))\n return makeUnderflowError(\"Presentation Context item\", pduLength, itemLength);\n LST_Enqueue(&assoc->presentationContextList, (LST_NODE*)context);\n DCMNET_TRACE(\"Successfully parsed Presentation Context\");\n break;\n case DUL_TYPEUSERINFO:\n // parse user info, which can contain several sub-items like User\n // Identity Negotiation or SOP Class Extended Negotiation\n cond = parseUserInfo(&assoc->userInfo, buf, &itemLength, assoc->type, pduLength);\n if (cond.bad())\n return cond;\n buf += itemLength;\n if (!OFStandard::safeSubtract(pduLength, itemLength, pduLength))\n return makeUnderflowError(\"User Information item\", pduLength, itemLength);\n DCMNET_TRACE(\"Successfully parsed User Information\");\n break;\n default:\n cond = parseDummy(buf, &itemLength, pduLength);\n if (cond.bad())\n return cond;\n buf += itemLength;\n if (!OFStandard::safeSubtract(pduLength, itemLength, pduLength))\n return makeUnderflowError(\"unknown item type\", pduLength, itemLength);\n break;\n }\n }\n return cond;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " static function displayname() {\n return gt(\"e-Commerce Category Manager\");\n }", "label": 1, "label_name": "safe"} -{"code": " public function misc_tab( $post ) {\n\n $upgrade_link = Envira_Gallery_Common_Admin::get_instance()->get_upgrade_link( 'http://enviragallery.com/docs/creating-first-envira-gallery/', 'adminpagemisc', 'readthedocumentation' );\n\n ?>\n
    \n

    \n \n \n \n
    \n \n \" class=\"envira-doc\" target=\"_blank\">\n \n \n or\n \n \n \n
    \n

    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n
    \n \n \n get_config( 'title', $this->get_config_default( 'title' ) ); ?>\" />\n

    \n
    \n \n \n get_config( 'slug', $this->get_config_default( 'slug' ) ); ?>\" />\n

    Unique internal gallery slug for identification and advanced gallery queries.', 'envira-gallery-lite' ); ?>

    \n
    \n \n \n \n

    \n
    \n \n \n get_config( 'rtl', $this->get_config_default( 'rtl' ) ); ?>\" get_config( 'rtl', $this->get_config_default( 'rtl' ) ), 1 ); ?> />\n \n
    \n
    \n display_inline_notice(\n 'envira_gallery_images_tab',\n __( 'Want to take your galleries further?', 'envira-gallery-lite' ),\n __( '

    By upgrading to Envira Gallery Pro, you can get access to numerous other features, including:

    \n

    Bonus: Envira Lite users get a discount code for 20% off regular price.

    ', 'envira-gallery-lite' ),\n 'warning',\n __( 'Click here to Upgrade', 'envira-gallery-lite' ),\n Envira_Gallery_Common_Admin::get_instance()->get_upgrade_link( false, 'adminpagemisc', 'clickheretoupgradebutton' ),\n false\n );\n\n\n\n }", "label": 0, "label_name": "vulnerable"} -{"code": "null!=this.linkHint&&(this.linkHint.style.visibility=\"\")};var Za=mxEdgeHandler.prototype.destroy;mxEdgeHandler.prototype.destroy=function(){Za.apply(this,arguments);null!=this.linkHint&&(this.linkHint.parentNode.removeChild(this.linkHint),this.linkHint=null);null!=this.changeHandler&&(this.graph.getModel().removeListener(this.changeHandler),this.graph.getSelectionModel().removeListener(this.changeHandler),this.changeHandler=null)}}();(function(){function b(c,l,x){mxShape.call(this);this.line=c;this.stroke=l;this.strokewidth=null!=x?x:1;this.updateBoundsFromLine()}function e(){mxSwimlane.call(this)}function k(){mxSwimlane.call(this)}function n(){mxCylinder.call(this)}function D(){mxCylinder.call(this)}function t(){mxActor.call(this)}function F(){mxCylinder.call(this)}function d(){mxCylinder.call(this)}function f(){mxCylinder.call(this)}function g(){mxCylinder.call(this)}function m(){mxShape.call(this)}function q(){mxShape.call(this)}", "label": 0, "label_name": "vulnerable"} -{"code": "this.spacing=0}function Ca(){mxArrowConnector.call(this);this.spacing=0}function Qa(){mxActor.call(this)}function Ta(){mxRectangleShape.call(this)}function Ka(){mxActor.call(this)}function bb(){mxActor.call(this)}function Ua(){mxActor.call(this)}function $a(){mxActor.call(this)}function z(){mxActor.call(this)}function L(){mxActor.call(this)}function M(){mxActor.call(this)}function T(){mxActor.call(this)}function ca(){mxActor.call(this)}function ia(){mxActor.call(this)}function ma(){mxEllipse.call(this)}", "label": 1, "label_name": "safe"} -{"code": "def get_cc_columns(filter_config_custom_read=False):\n tmpcc = calibre_db.session.query(db.Custom_Columns)\\\n .filter(db.Custom_Columns.datatype.notin_(db.cc_exceptions)).all()\n cc = []\n r = None\n if config.config_columns_to_ignore:\n r = re.compile(config.config_columns_to_ignore)\n\n for col in tmpcc:\n if filter_config_custom_read and config.config_read_column and config.config_read_column == col.id:\n continue\n if r and r.match(col.name):\n continue\n cc.append(col)\n\n return cc", "label": 0, "label_name": "vulnerable"} -{"code": "parsegid(const char *s, gid_t *gid)\n{\n\tstruct group *gr;\n\tconst char *errstr;\n\n\tif ((gr = getgrnam(s)) != NULL) {\n\t\t*gid = gr->gr_gid;\n\t\treturn 0;\n\t}\n\t#if !defined(__linux__) && !defined(__NetBSD__)\n\t*gid = strtonum(s, 0, GID_MAX, &errstr);\n\t#else\n\tsscanf(s, \"%d\", gid);\n\t#endif\n\tif (errstr)\n\t\treturn -1;\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "static int whereIndexExprTransColumn(Walker *p, Expr *pExpr){\n if( pExpr->op==TK_COLUMN ){\n IdxExprTrans *pX = p->u.pIdxTrans;\n if( pExpr->iTable==pX->iTabCur && pExpr->iColumn==pX->iTabCol ){\n assert( pExpr->y.pTab!=0 );\n pExpr->affExpr = sqlite3TableColumnAffinity(pExpr->y.pTab,pExpr->iColumn);\n pExpr->iTable = pX->iIdxCur;\n pExpr->iColumn = pX->iIdxCol;\n pExpr->y.pTab = 0;\n }\n }\n return WRC_Continue;\n}", "label": 1, "label_name": "safe"} -{"code": "function display_error_block() {\n if (!empty($_SESSION['error_msg'])) {\n echo '\n
    \n \n
    \n

    '. htmlentities($_SESSION['error_msg']) .'

    \n
    \n
    '.\"\\n\";\n unset($_SESSION['error_msg']);\n }\n}", "label": 1, "label_name": "safe"} -{"code": "func (f *Fosite) WriteRevocationResponse(rw http.ResponseWriter, err error) {\n\trw.Header().Set(\"Cache-Control\", \"no-store\")\n\trw.Header().Set(\"Pragma\", \"no-cache\")\n\n\tif err == nil {\n\t\trw.WriteHeader(http.StatusOK)\n\t\treturn\n\t}\n\n\tif errors.Is(err, ErrInvalidRequest) {\n\t\trw.Header().Set(\"Content-Type\", \"application/json;charset=UTF-8\")\n\n\t\tjs, err := json.Marshal(ErrInvalidRequest)\n\t\tif err != nil {\n\t\t\thttp.Error(rw, fmt.Sprintf(`{\"error\": \"%s\"}`, err.Error()), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\trw.WriteHeader(ErrInvalidRequest.Code)\n\t\t_, _ = rw.Write(js)\n\t} else if errors.Is(err, ErrInvalidClient) {\n\t\trw.Header().Set(\"Content-Type\", \"application/json;charset=UTF-8\")\n\n\t\tjs, err := json.Marshal(ErrInvalidClient)\n\t\tif err != nil {\n\t\t\thttp.Error(rw, fmt.Sprintf(`{\"error\": \"%s\"}`, err.Error()), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\trw.WriteHeader(ErrInvalidClient.Code)\n\t\t_, _ = rw.Write(js)\n\t} else {\n\t\t// 200 OK\n\t\trw.WriteHeader(http.StatusOK)\n\t}\n}", "label": 1, "label_name": "safe"} -{"code": "\t\t\t$rest = $count - ( floor( $nsize ) * floor( $iGroup ) );\n\n\t\t\tif ( $rest > 0 ) {\n\t\t\t\t$nsize += 1;\n\t\t\t}\n\n\t\t\t$output .= \"{|\" . $rowColFormat . \"\\n|\\n\";\n\n\t\t\tfor ( $g = 0; $g < $iGroup; $g++ ) {\n\t\t\t\t$output .= $lister->formatList( $articles, $nstart, (int)$nsize );\n\n\t\t\t\tif ( $columns != 1 ) {\n\t\t\t\t\t$output .= \"\\n|valign=top|\\n\";\n\t\t\t\t} else {\n\t\t\t\t\t$output .= \"\\n|-\\n|\\n\";\n\t\t\t\t}\n\n\t\t\t\t$nstart += $nsize;\n\n\t\t\t\tif ( $nstart + $nsize > $count ) {\n\t\t\t\t\t$nsize = $count - $nstart;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$output .= \"\\n|}\\n\";\n\t\t} elseif ( $rowSize > 0 ) {", "label": 1, "label_name": "safe"} -{"code": " def ajax_delete_mails\n Log.add_info(request, params.inspect)\n\n folder_id = params[:id]\n mail_account_id = params[:mail_account_id]\n\n unless params[:check_mail].blank?\n mail_folder = MailFolder.find(folder_id)\n trash_folder = MailFolder.get_for(@login_user, mail_account_id, MailFolder::XTYPE_TRASH)\n\n count = 0\n params[:check_mail].each do |email_id, value|\n next if value != '1'\n\n email = Email.find_by_id(email_id)\n next if email.nil? or (email.user_id != @login_user.id)\n\n if trash_folder.nil? \\\n or folder_id == trash_folder.id.to_s \\\n or mail_folder.get_parents(false).include?(trash_folder.id.to_s)\n email.destroy\n flash[:notice] ||= t('msg.delete_success')\n else\n begin\n email.update_attribute(:mail_folder_id, trash_folder.id)\n flash[:notice] ||= t('msg.moved_to_trash')\n rescue => evar\n Log.add_error(request, evar)\n email.destroy\n flash[:notice] ||= t('msg.delete_success')\n end\n end\n\n count += 1\n end\n end\n\n get_mails\n end", "label": 0, "label_name": "vulnerable"} -{"code": " $contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_DELETE, 'fas fa-trash', null, 'primary', null, 'btn-danger xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('reviews.php', 'page=' . $_GET['page'] . '&rID=' . $rInfo->reviews_id), null, null, 'btn-light')];", "label": 0, "label_name": "vulnerable"} -{"code": " public function disable()\n {\n $this->checkCSRFParam();\n $project = $this->getProject();\n $swimlane_id = $this->request->getIntegerParam('swimlane_id');\n\n if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) {\n $this->flash->success(t('Swimlane updated successfully.'));\n } else {\n $this->flash->failure(t('Unable to update this swimlane.'));\n }\n\n $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));\n }", "label": 0, "label_name": "vulnerable"} -{"code": "Ka(a,e,d,d===k?k:e._aData).data;else{var j=e.anCells;if (j)if (d!==k)g(j[d],d);else{c=0;for(f=j.length;ctop_frame;\n frame->retval = retval;\n\n if (njs_function_object_type(vm, frame->function)\n == NJS_OBJ_TYPE_ASYNC_FUNCTION)\n {\n return njs_async_function_frame_invoke(vm, retval);\n }\n\n if (frame->native) {\n return njs_function_native_call(vm);\n\n } else {\n return njs_function_lambda_call(vm, NULL, NULL);\n }\n}", "label": 1, "label_name": "safe"} -{"code": "size_t FdInStream::readWithTimeoutOrCallback(void* buf, size_t len, bool wait)\n{\n struct timeval before, after;\n if (timing)\n gettimeofday(&before, 0);\n\n int n;\n while (true) {\n do {\n fd_set fds;\n struct timeval tv;\n struct timeval* tvp = &tv;\n\n if (!wait) {\n tv.tv_sec = tv.tv_usec = 0;\n } else if (timeoutms != -1) {\n tv.tv_sec = timeoutms / 1000;\n tv.tv_usec = (timeoutms % 1000) * 1000;\n } else {\n tvp = 0;\n }\n\n FD_ZERO(&fds);\n FD_SET(fd, &fds);\n n = select(fd+1, &fds, 0, 0, tvp);\n } while (n < 0 && errno == EINTR);\n\n if (n > 0) break;\n if (n < 0) throw SystemException(\"select\",errno);\n if (!wait) return 0;\n if (!blockCallback) throw TimedOut();\n\n blockCallback->blockCallback();\n }\n\n do {\n n = ::recv(fd, (char*)buf, len, 0);\n } while (n < 0 && errno == EINTR);\n\n if (n < 0) throw SystemException(\"read\",errno);\n if (n == 0) throw EndOfStream();\n\n if (timing) {\n gettimeofday(&after, 0);\n int newTimeWaited = ((after.tv_sec - before.tv_sec) * 10000 +\n (after.tv_usec - before.tv_usec) / 100);\n int newKbits = n * 8 / 1000;\n\n // limit rate to between 10kbit/s and 40Mbit/s\n\n if (newTimeWaited > newKbits*1000) newTimeWaited = newKbits*1000;\n if (newTimeWaited < newKbits/4) newTimeWaited = newKbits/4;\n\n timeWaitedIn100us += newTimeWaited;\n timedKbits += newKbits;\n }\n\n return n;\n}", "label": 1, "label_name": "safe"} -{"code": "\"keydown\",mxUtils.bind(this,function(N){mxEvent.isConsumed(N)||((mxEvent.isControlDown(N)||mxClient.IS_MAC&&mxEvent.isMetaDown(N))&&13==N.keyCode?(I.click(),mxEvent.consume(N)):27==N.keyCode&&(u.click(),mxEvent.consume(N)))}));I.focus();I.className=\"geCommentEditBtn gePrimaryBtn\";ta.appendChild(I);U.insertBefore(ta,R);ia.style.display=\"none\";R.style.display=\"none\";la.focus()}function f(ja,U){U.innerHTML=\"\";ja=new Date(ja.modifiedDate);var J=b.timeSince(ja);null==J&&(J=mxResources.get(\"lessThanAMinute\"));\nmxUtils.write(U,mxResources.get(\"timeAgo\",[J],\"{1} ago\"));U.setAttribute(\"title\",ja.toLocaleDateString()+\" \"+ja.toLocaleTimeString())}function g(ja){var U=document.createElement(\"img\");U.className=\"geCommentBusyImg\";U.src=IMAGE_PATH+\"/spin.gif\";ja.appendChild(U);ja.busyImg=U}function m(ja){ja.style.border=\"1px solid red\";ja.removeChild(ja.busyImg)}function q(ja){ja.style.border=\"\";ja.removeChild(ja.busyImg)}function y(ja,U,J,V,P){function R(T,Q,Z){var na=document.createElement(\"li\");na.className=", "label": 0, "label_name": "vulnerable"} -{"code": "break}x.push(f+=1)}return x},d.prototype.setData=function(a){var b;return this.data=a,this.values=function(){var a,c,d,e;for(d=this.data,e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(parseFloat(b.value));return e}.call(this),this.redraw()},d.prototype.click=function(a){return this.fire(\"click\",a,this.data[a])},d.prototype.select=function(a){var b,c,d,e,f,g;for(g=this.segments,e=0,f=g.length;f>e;e++)c=g[e],c.deselect();return d=this.segments[a],d.select(),b=this.data[a],this.setLabels(b.label,this.options.formatter(b.value,b))},d.prototype.setLabels=function(a,b){var c,d,e,f,g,h,i,j;return c=2*(Math.min(this.el.width()/2,this.el.height()/2)-10)/3,f=1.8*c,e=c/2,d=c/3,this.text1.attr({text:a,transform:\"\"}),g=this.text1.getBBox(),h=Math.min(f/g.width,e/g.height),this.text1.attr({transform:\"S\"+h+\",\"+h+\",\"+(g.x+g.width/2)+\",\"+(g.y+g.height)}),this.text2.attr({text:b,transform:\"\"}),i=this.text2.getBBox(),j=Math.min(f/i.width,d/i.height),this.text2.attr({transform:\"S\"+j+\",\"+j+\",\"+(i.x+i.width/2)+\",\"+i.y})},d.prototype.drawEmptyDonutLabel=function(a,b,c,d,e){var f;return f=this.raphael.text(a,b,\"\").attr(\"font-size\",d).attr(\"fill\",c),null!=e&&f.attr(\"font-weight\",e),f},d.prototype.resizeHandler=function(){return this.timeoutId=null,this.raphael.setSize(this.el.width(),this.el.height()),this.redraw()},d}(b.EventEmitter),b.DonutSegment=function(a){function b(a,b,c,d,e,g,h,i,j,k){this.cx=a,this.cy=b,this.inner=c,this.outer=d,this.color=h,this.backgroundColor=i,this.index=j,this.raphael=k,this.deselect=f(this.deselect,this),this.select=f(this.select,this),this.sin_p0=Math.sin(e),this.cos_p0=Math.cos(e),this.sin_p1=Math.sin(g),this.cos_p1=Math.cos(g),this.is_long=g-e>Math.PI?1:0,this.path=this.calcSegment(this.inner+3,this.inner+this.outer-5),this.selectedPath=this.calcSegment(this.inner+3,this.inner+this.outer),this.hilight=this.calcArc(this.inner)}return h(b,a),b.prototype.calcArcPoints=function(a){return[this.cx+a*this.sin_p0,this.cy+a*this.cos_p0,this.cx+a*this.sin_p1,this.cy+a*this.cos_p1]},b.prototype.calcSegment=function(a,b){var c,d,e,f,g,h,i,j,k,l;return k=this.calcArcPoints(a),c=k[0],e=k[1],d=k[2],f=k[3],l=this.calcArcPoints(b),g=l[0],i=l[1],h=l[2],j=l[3],\"M\"+c+\",\"+e+(\"A\"+a+\",\"+a+\",0,\"+this.is_long+\",0,\"+d+\",\"+f)+(\"L\"+h+\",\"+j)+(\"A\"+b+\",\"+b+\",0,\"+this.is_long+\",1,\"+g+\",\"+i)+\"Z\"},b.prototype.calcArc=function(a){var b,c,d,e,f;return f=this.calcArcPoints(a),b=f[0],d=f[1],c=f[2],e=f[3],\"M\"+b+\",\"+d+(\"A\"+a+\",\"+a+\",0,\"+this.is_long+\",0,\"+c+\",\"+e)},b.prototype.render=function(){var a=this;return this.arc=this.drawDonutArc(this.hilight,this.color),this.seg=this.drawDonutSegment(this.path,this.color,this.backgroundColor,function(){return a.fire(\"hover\",a.index)},function(){return a.fire(\"click\",a.index)})},b.prototype.drawDonutArc=function(a,b){return this.raphael.path(a).attr({stroke:b,\"stroke-width\":2,opacity:0})},b.prototype.drawDonutSegment=function(a,b,c,d,e){return this.raphael.path(a).attr({fill:b,stroke:c,\"stroke-width\":3}).hover(d).click(e)},b.prototype.select=function(){return this.selected?void 0:(this.seg.animate({path:this.selectedPath},150,\"<>\"),this.arc.animate({opacity:1},150,\"<>\"),this.selected=!0)},b.prototype.deselect=function(){return this.selected?(this.seg.animate({path:this.path},150,\"<>\"),this.arc.animate({opacity:0},150,\"<>\"),this.selected=!1):void 0},b}(b.EventEmitter)}).call(this);", "label": 0, "label_name": "vulnerable"} -{"code": "\tvirtual size_t\tRead(void *buffer, size_t size, size_t count, void* limit_start = NULL, void* limit_end = NULL)\r\n\t{\r\n\t\tif (!m_fp) return 0;\r\n\t\tclamp_buffer(buffer, size, limit_start, limit_end);\r\n\t\treturn fread(buffer, size, count, m_fp);\r\n\t}\r", "label": 1, "label_name": "safe"} -{"code": "bool SSecurityTLS::processMsg(SConnection *sc)\n{\n rdr::InStream* is = sc->getInStream();\n rdr::OutStream* os = sc->getOutStream();\n\n vlog.debug(\"Process security message (session %p)\", session);\n\n if (!session) {\n initGlobal();\n\n if (gnutls_init(&session, GNUTLS_SERVER) != GNUTLS_E_SUCCESS)\n throw AuthFailureException(\"gnutls_init failed\");\n\n if (gnutls_set_default_priority(session) != GNUTLS_E_SUCCESS)\n throw AuthFailureException(\"gnutls_set_default_priority failed\");\n\n try {\n setParams(session);\n }\n catch(...) {\n os->writeU8(0);\n throw;\n }\n\n os->writeU8(1);\n os->flush();\n }\n\n rdr::TLSInStream *tlsis = new rdr::TLSInStream(is, session);\n rdr::TLSOutStream *tlsos = new rdr::TLSOutStream(os, session);\n\n int err;\n err = gnutls_handshake(session);\n if (err != GNUTLS_E_SUCCESS) {\n delete tlsis;\n delete tlsos;\n\n if (!gnutls_error_is_fatal(err)) {\n vlog.debug(\"Deferring completion of TLS handshake: %s\", gnutls_strerror(err));\n return false;\n }\n vlog.error(\"TLS Handshake failed: %s\", gnutls_strerror (err));\n shutdown();\n throw AuthFailureException(\"TLS Handshake failed\");\n }\n\n vlog.debug(\"Handshake completed\");\n\n sc->setStreams(fis = tlsis, fos = tlsos);\n\n return true;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " authHandler = function authHandler(authsLeft, partial, cb) {\n if (authPos === authsAllowed.length)\n return false;\n return authsAllowed[authPos++];\n };", "label": 0, "label_name": "vulnerable"} -{"code": "static void process_tree(struct rev_info *revs,\n\t\t\t struct tree *tree,\n\t\t\t show_object_fn show,\n\t\t\t struct strbuf *base,\n\t\t\t const char *name,\n\t\t\t void *cb_data)\n{\n\tstruct object *obj = &tree->object;\n\tstruct tree_desc desc;\n\tstruct name_entry entry;\n\tenum interesting match = revs->diffopt.pathspec.nr == 0 ?\n\t\tall_entries_interesting: entry_not_interesting;\n\tint baselen = base->len;\n\n\tif (!revs->tree_objects)\n\t\treturn;\n\tif (!obj)\n\t\tdie(\"bad tree object\");\n\tif (obj->flags & (UNINTERESTING | SEEN))\n\t\treturn;\n\tif (parse_tree_gently(tree, revs->ignore_missing_links) < 0) {\n\t\tif (revs->ignore_missing_links)\n\t\t\treturn;\n\t\tdie(\"bad tree object %s\", oid_to_hex(&obj->oid));\n\t}\n\n\tobj->flags |= SEEN;\n\tshow(obj, base, name, cb_data);\n\n\tstrbuf_addstr(base, name);\n\tif (base->len)\n\t\tstrbuf_addch(base, '/');\n\n\tinit_tree_desc(&desc, tree->buffer, tree->size);\n\n\twhile (tree_entry(&desc, &entry)) {\n\t\tif (match != all_entries_interesting) {\n\t\t\tmatch = tree_entry_interesting(&entry, base, 0,\n\t\t\t\t\t\t &revs->diffopt.pathspec);\n\t\t\tif (match == all_entries_not_interesting)\n\t\t\t\tbreak;\n\t\t\tif (match == entry_not_interesting)\n\t\t\t\tcontinue;\n\t\t}\n\n\t\tif (S_ISDIR(entry.mode))\n\t\t\tprocess_tree(revs,\n\t\t\t\t lookup_tree(entry.sha1),\n\t\t\t\t show, base, entry.path,\n\t\t\t\t cb_data);\n\t\telse if (S_ISGITLINK(entry.mode))\n\t\t\tprocess_gitlink(revs, entry.sha1,\n\t\t\t\t\tshow, base, entry.path,\n\t\t\t\t\tcb_data);\n\t\telse\n\t\t\tprocess_blob(revs,\n\t\t\t\t lookup_blob(entry.sha1),\n\t\t\t\t show, base, entry.path,\n\t\t\t\t cb_data);\n\t}\n\tstrbuf_setlen(base, baselen);\n\tfree_tree_buffer(tree);\n}", "label": 0, "label_name": "vulnerable"} -{"code": " replaceInValue: function (value, context) {\n return interpreter.replace(value, context, parseContext);\n },", "label": 1, "label_name": "safe"} -{"code": "int key_update(key_ref_t key_ref, const void *payload, size_t plen)\n{\n\tstruct key_preparsed_payload prep;\n\tstruct key *key = key_ref_to_ptr(key_ref);\n\tint ret;\n\n\tkey_check(key);\n\n\t/* the key must be writable */\n\tret = key_permission(key_ref, KEY_NEED_WRITE);\n\tif (ret < 0)\n\t\treturn ret;\n\n\t/* attempt to update it if supported */\n\tif (!key->type->update)\n\t\treturn -EOPNOTSUPP;\n\n\tmemset(&prep, 0, sizeof(prep));\n\tprep.data = payload;\n\tprep.datalen = plen;\n\tprep.quotalen = key->type->def_datalen;\n\tprep.expiry = TIME_T_MAX;\n\tif (key->type->preparse) {\n\t\tret = key->type->preparse(&prep);\n\t\tif (ret < 0)\n\t\t\tgoto error;\n\t}\n\n\tdown_write(&key->sem);\n\n\tret = key->type->update(key, &prep);\n\tif (ret == 0)\n\t\t/* Updating a negative key positively instantiates it */\n\t\tmark_key_instantiated(key, 0);\n\n\tup_write(&key->sem);\n\nerror:\n\tif (key->type->preparse)\n\t\tkey->type->free_preparse(&prep);\n\treturn ret;\n}", "label": 1, "label_name": "safe"} -{"code": "def list_books():\n off = int(request.args.get(\"offset\") or 0)\n limit = int(request.args.get(\"limit\") or config.config_books_per_page)\n search = request.args.get(\"search\")\n sort_param = request.args.get(\"sort\", \"id\")\n order = request.args.get(\"order\", \"\").lower()\n state = None\n join = tuple()\n\n if sort_param == \"state\":\n state = json.loads(request.args.get(\"state\", \"[]\"))\n elif sort_param == \"tags\":\n order = [db.Tags.name.asc()] if order == \"asc\" else [db.Tags.name.desc()]\n join = db.books_tags_link, db.Books.id == db.books_tags_link.c.book, db.Tags\n elif sort_param == \"series\":\n order = [db.Series.name.asc()] if order == \"asc\" else [db.Series.name.desc()]\n join = db.books_series_link, db.Books.id == db.books_series_link.c.book, db.Series\n elif sort_param == \"publishers\":\n order = [db.Publishers.name.asc()] if order == \"asc\" else [db.Publishers.name.desc()]\n join = db.books_publishers_link, db.Books.id == db.books_publishers_link.c.book, db.Publishers\n elif sort_param == \"authors\":\n order = [db.Authors.name.asc(), db.Series.name, db.Books.series_index] if order == \"asc\" \\\n else [db.Authors.name.desc(), db.Series.name.desc(), db.Books.series_index.desc()]\n join = db.books_authors_link, db.Books.id == db.books_authors_link.c.book, db.Authors, \\\n db.books_series_link, db.Books.id == db.books_series_link.c.book, db.Series\n elif sort_param == \"languages\":\n order = [db.Languages.lang_code.asc()] if order == \"asc\" else [db.Languages.lang_code.desc()]\n join = db.books_languages_link, db.Books.id == db.books_languages_link.c.book, db.Languages\n elif order and sort_param in [\"sort\", \"title\", \"authors_sort\", \"series_index\"]:\n order = [text(sort_param + \" \" + order)]\n elif not state:\n order = [db.Books.timestamp.desc()]\n\n total_count = filtered_count = calibre_db.session.query(db.Books).filter(calibre_db.common_filters(allow_show_archived=True)).count()\n if state is not None:\n if search:\n books = calibre_db.search_query(search, config.config_read_column).all()\n filtered_count = len(books)\n else:\n if not config.config_read_column:\n books = (calibre_db.session.query(db.Books, ub.ReadBook.read_status, ub.ArchivedBook.is_archived)\n .select_from(db.Books)\n .outerjoin(ub.ReadBook,\n and_(ub.ReadBook.user_id == int(current_user.id),\n ub.ReadBook.book_id == db.Books.id)))\n else:\n read_column = \"\"\n try:\n read_column = db.cc_classes[config.config_read_column]\n books = (calibre_db.session.query(db.Books, read_column.value, ub.ArchivedBook.is_archived)\n .select_from(db.Books)\n .outerjoin(read_column, read_column.book == db.Books.id))\n except (KeyError, AttributeError):\n log.error(\"Custom Column No.%d is not existing in calibre database\", read_column)\n # Skip linking read column and return None instead of read status\n books = calibre_db.session.query(db.Books, None, ub.ArchivedBook.is_archived)\n books = (books.outerjoin(ub.ArchivedBook, and_(db.Books.id == ub.ArchivedBook.book_id,\n int(current_user.id) == ub.ArchivedBook.user_id))\n .filter(calibre_db.common_filters(allow_show_archived=True)).all())\n entries = calibre_db.get_checkbox_sorted(books, state, off, limit, order, True)\n elif search:\n entries, filtered_count, __ = calibre_db.get_search_results(search,\n off,\n [order,''],\n limit,\n True,\n config.config_read_column,\n *join)\n else:\n entries, __, __ = calibre_db.fill_indexpage_with_archived_books((int(off) / (int(limit)) + 1),\n db.Books,\n limit,\n True,\n order,\n True,\n True,\n config.config_read_column,\n *join)\n\n result = list()\n for entry in entries:\n val = entry[0]\n val.read_status = entry[1] == ub.ReadBook.STATUS_FINISHED\n val.is_archived = entry[2] is True\n for index in range(0, len(val.languages)):\n val.languages[index].language_name = isoLanguages.get_language_name(get_locale(), val.languages[\n index].lang_code)\n result.append(val)\n\n table_entries = {'totalNotFiltered': total_count, 'total': filtered_count, \"rows\": result}\n js_list = json.dumps(table_entries, cls=db.AlchemyEncoder)\n\n response = make_response(js_list)\n response.headers[\"Content-Type\"] = \"application/json; charset=utf-8\"\n return response", "label": 0, "label_name": "vulnerable"} -{"code": "\"25px\";btn.className=\"geColorBtn\";return btn}function Y(za,ta,ka,pa,sa,ya,va){if(0(TokLinuxAfFamily(af));\n input.PushByReference(Extent{reinterpret_cast(src), src_size});\n input.Push(size);\n MessageReader output;\n\n const auto status = NonSystemCallDispatcher(\n ::asylo::host_call::kInetNtopHandler, &input, &output);\n CheckStatusAndParamCount(status, output, \"enc_untrusted_inet_ntop\", 2);\n\n auto result = output.next();\n int klinux_errno = output.next();\n if (result.empty()) {\n errno = FromkLinuxErrorNumber(klinux_errno);\n return nullptr;\n }\n\n memcpy(\n dst, result.data(),\n std::min({static_cast(size), static_cast(result.size()),\n static_cast(INET6_ADDRSTRLEN)}));\n return dst;\n}", "label": 1, "label_name": "safe"} -{"code": " $this->emitToken(array(\n 'type' => self::CHARACTR,\n 'data' => 'char--;\n $this->state = 'data';\n\n } else {\n /* Parse error. Switch to the bogus comment state. */\n $this->state = 'bogusComment';\n }\n }", "label": 1, "label_name": "safe"} -{"code": "\tpublic function load_template()\r\n\t{\r\n\t\tglobal $DB;\r\n\t\tglobal $website;\r\n\t\t\r\n\t\t$template = new template();\t\r\n\t\t\r\n\t\tif(\t$this->association == 'free' ||\r\n\t\t\t($this->association == 'category' && $this->embedding == '0'))\r\n\t\t{\r\n\t\t\t$template->load($this->template);\t\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$category_template = $DB->query_single(\r\n 'template',\r\n 'nv_structure',\r\n ' id = '.intval($this->category).' AND website = '.intval($website->id)\r\n );\r\n\t\t\t$template->load($category_template);\r\n\t\t}\r\n\t\t\r\n\t\treturn $template;\r\n\t}\r", "label": 1, "label_name": "safe"} -{"code": " $obj = new $modelname(intval($id));\n $obj->rank = $rank;\n $obj->save(false, true);\n $rank++;\n }", "label": 1, "label_name": "safe"} -{"code": "int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,\n\t\t struct msghdr *msg, size_t len,\n\t\t int noblock, int flags, int *addr_len)\n{\n\tstruct ipv6_pinfo *np = inet6_sk(sk);\n\tstruct inet_sock *inet = inet_sk(sk);\n\tstruct sk_buff *skb;\n\tunsigned int ulen, copied;\n\tint peeked, off = 0;\n\tint err;\n\tint is_udplite = IS_UDPLITE(sk);\n\tint is_udp4;\n\tbool slow;\n\n\tif (flags & MSG_ERRQUEUE)\n\t\treturn ipv6_recv_error(sk, msg, len);\n\n\tif (np->rxpmtu && np->rxopt.bits.rxpmtu)\n\t\treturn ipv6_recv_rxpmtu(sk, msg, len);\n\ntry_again:\n\tskb = __skb_recv_datagram(sk, flags | (noblock ? MSG_DONTWAIT : 0),\n\t\t\t\t &peeked, &off, &err);\n\tif (!skb)\n\t\tgoto out;\n\n\tulen = skb->len - sizeof(struct udphdr);\n\tcopied = len;\n\tif (copied > ulen)\n\t\tcopied = ulen;\n\telse if (copied < ulen)\n\t\tmsg->msg_flags |= MSG_TRUNC;\n\n\tis_udp4 = (skb->protocol == htons(ETH_P_IP));\n\n\t/*\n\t * If checksum is needed at all, try to do it while copying the\n\t * data. If the data is truncated, or if we only want a partial\n\t * coverage checksum (UDP-Lite), do it before the copy.\n\t */\n\n\tif (copied < ulen || UDP_SKB_CB(skb)->partial_cov) {\n\t\tif (udp_lib_checksum_complete(skb))\n\t\t\tgoto csum_copy_err;\n\t}\n\n\tif (skb_csum_unnecessary(skb))\n\t\terr = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),\n\t\t\t\t\t msg->msg_iov, copied);\n\telse {\n\t\terr = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov);\n\t\tif (err == -EINVAL)\n\t\t\tgoto csum_copy_err;\n\t}\n\tif (unlikely(err)) {\n\t\ttrace_kfree_skb(skb, udpv6_recvmsg);\n\t\tif (!peeked) {\n\t\t\tatomic_inc(&sk->sk_drops);\n\t\t\tif (is_udp4)\n\t\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\t\t UDP_MIB_INERRORS,\n\t\t\t\t\t\t is_udplite);\n\t\t\telse\n\t\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\t\t UDP_MIB_INERRORS,\n\t\t\t\t\t\t is_udplite);\n\t\t}\n\t\tgoto out_free;\n\t}\n\tif (!peeked) {\n\t\tif (is_udp4)\n\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INDATAGRAMS, is_udplite);\n\t\telse\n\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INDATAGRAMS, is_udplite);\n\t}\n\n\tsock_recv_ts_and_drops(msg, sk, skb);\n\n\t/* Copy the address. */\n\tif (msg->msg_name) {\n\t\tstruct sockaddr_in6 *sin6;\n\n\t\tsin6 = (struct sockaddr_in6 *) msg->msg_name;\n\t\tsin6->sin6_family = AF_INET6;\n\t\tsin6->sin6_port = udp_hdr(skb)->source;\n\t\tsin6->sin6_flowinfo = 0;\n\n\t\tif (is_udp4) {\n\t\t\tipv6_addr_set_v4mapped(ip_hdr(skb)->saddr,\n\t\t\t\t\t &sin6->sin6_addr);\n\t\t\tsin6->sin6_scope_id = 0;\n\t\t} else {\n\t\t\tsin6->sin6_addr = ipv6_hdr(skb)->saddr;\n\t\t\tsin6->sin6_scope_id =\n\t\t\t\tipv6_iface_scope_id(&sin6->sin6_addr,\n\t\t\t\t\t\t IP6CB(skb)->iif);\n\t\t}\n\t\t*addr_len = sizeof(*sin6);\n\t}\n\tif (is_udp4) {\n\t\tif (inet->cmsg_flags)\n\t\t\tip_cmsg_recv(msg, skb);\n\t} else {\n\t\tif (np->rxopt.all)\n\t\t\tip6_datagram_recv_ctl(sk, msg, skb);\n\t}\n\n\terr = copied;\n\tif (flags & MSG_TRUNC)\n\t\terr = ulen;\n\nout_free:\n\tskb_free_datagram_locked(sk, skb);\nout:\n\treturn err;\n\ncsum_copy_err:\n\tslow = lock_sock_fast(sk);\n\tif (!skb_kill_datagram(sk, skb, flags)) {\n\t\tif (is_udp4) {\n\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_CSUMERRORS, is_udplite);\n\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INERRORS, is_udplite);\n\t\t} else {\n\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_CSUMERRORS, is_udplite);\n\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INERRORS, is_udplite);\n\t\t}\n\t}\n\tunlock_sock_fast(sk, slow);\n\n\tif (noblock)\n\t\treturn -EAGAIN;\n\n\t/* starting over for a new packet */\n\tmsg->msg_flags &= ~MSG_TRUNC;\n\tgoto try_again;\n}", "label": 1, "label_name": "safe"} -{"code": "1)},setStartBefore:function(a){this.setStart(a.getParent(),a.getIndex())},setEndAfter:function(a){this.setEnd(a.getParent(),a.getIndex()+1)},setEndBefore:function(a){this.setEnd(a.getParent(),a.getIndex())},setStartAt:function(a,b){switch(b){case CKEDITOR.POSITION_AFTER_START:this.setStart(a,0);break;case CKEDITOR.POSITION_BEFORE_END:a.type==CKEDITOR.NODE_TEXT?this.setStart(a,a.getLength()):this.setStart(a,a.getChildCount());break;case CKEDITOR.POSITION_BEFORE_START:this.setStartBefore(a);break;case CKEDITOR.POSITION_AFTER_END:this.setStartAfter(a)}c(this)},", "label": 1, "label_name": "safe"} -{"code": "TfLiteStatus LogicalImpl(TfLiteContext* context, TfLiteNode* node,\n bool (*func)(bool, bool)) {\n OpData* data = reinterpret_cast(node->user_data);\n\n const TfLiteTensor* input1;\n TF_LITE_ENSURE_OK(context,\n GetInputSafe(context, node, kInputTensor1, &input1));\n const TfLiteTensor* input2;\n TF_LITE_ENSURE_OK(context,\n GetInputSafe(context, node, kInputTensor2, &input2));\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n\n if (data->requires_broadcast) {\n reference_ops::BroadcastBinaryFunction4DSlow(\n GetTensorShape(input1), GetTensorData(input1),\n GetTensorShape(input2), GetTensorData(input2),\n GetTensorShape(output), GetTensorData(output), func);\n } else {\n reference_ops::BinaryFunction(\n GetTensorShape(input1), GetTensorData(input1),\n GetTensorShape(input2), GetTensorData(input2),\n GetTensorShape(output), GetTensorData(output), func);\n }\n\n return kTfLiteOk;\n}", "label": 1, "label_name": "safe"} -{"code": " it \"prints the failure message on error\" do\n expect {\n subject.call ['', '/bin/false', 'failure message!']\n }.to raise_error Puppet::ParseError, /failure message!/\n end", "label": 0, "label_name": "vulnerable"} -{"code": " private static void validateName(String name) {\n if (!RE_NAME.matcher(name).matches()) {\n throw new IllegalArgumentException(String.format(\"Illegal character in name: '%s'.\", name));\n }\n }", "label": 1, "label_name": "safe"} -{"code": " def read(t: CompoundNBT): Unit\n def write(t: CompoundNBT): Unit\n def handleConfigPacket(m: MsgOutputCfgPayload): Unit\n}\n\nclass OutputConfigInvalid extends OutputConfig {\n override val id: String = \"invalid\"\n def read(t: CompoundNBT): Unit = {}", "label": 0, "label_name": "vulnerable"} -{"code": " public function setup($config)\n {\n $bdo = $this->addElement(\n 'bdo',\n 'Inline',\n 'Inline',\n array('Core', 'Lang'),\n array(\n 'dir' => 'Enum#ltr,rtl', // required\n // The Abstract Module specification has the attribute\n // inclusions wrong for bdo: bdo allows Lang\n )\n );\n $bdo->attr_transform_post[] = new HTMLPurifier_AttrTransform_BdoDir();\n\n $this->attr_collections['I18N']['dir'] = 'Enum#ltr,rtl';\n }", "label": 1, "label_name": "safe"} -{"code": "\tprivate void doRequest(String method, HttpServletRequest request,\n\t\t\tHttpServletResponse response) throws ServletException, IOException\n\t{\n\t\ttry\n\t\t{\n\t\t\tint serviceId = 0;\n\t\t\tString proxyPath = \"\";\n\t\t\tString queryString = \"\";\n\t\t\t\n\t\t\ttry \n\t\t\t{\n\t\t\t\tif (request.getQueryString() != null)\n\t\t\t\t{\n\t\t\t\t\tqueryString = \"?\" + request.getQueryString(); \t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (request.getPathInfo() != null) // /{serviceId}/*\n\t\t\t\t{\n\t\t\t\t\tString[] pathParts = request.getPathInfo().split(\"/\");\n\t\n\t\t\t\t\tif (pathParts.length > 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tserviceId = Integer.parseInt(pathParts[1]);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (pathParts.length > 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tproxyPath = String.join(\"/\", Arrays.copyOfRange(pathParts, 2, pathParts.length));\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (serviceId < 0 || serviceId > supportedServices.length)\n\t\t\t\t\t{\n\t\t\t\t\t\tserviceId = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (Exception e) \n\t\t\t{\n\t\t\t\t// Ignore and use 0\n\t\t\t\tserviceId = 0;\n\t\t\t}\n\t\t\t\n\t\t\tString exportUrl = System.getenv(supportedServices[serviceId]);\n\t\t\t\n\t\t\tif (exportUrl == null || exportUrl.isEmpty())\n\t\t\t{\n\t\t\t\tthrow new Exception(supportedServices[serviceId] + \" not set\");\n\t\t\t}\n\t\t\t\n\t\t\tURL url = new URL(exportUrl + proxyPath + queryString);\n\t\t\tHttpURLConnection con = (HttpURLConnection) url.openConnection();\n\t\t\t\n\t\t\tcon.setRequestMethod(method);\n\t\t\t\n\t\t\t//Copy request headers to export server\n\t\t\tEnumeration headerNames = request.getHeaderNames();\n\t\t\t \n\t while (headerNames.hasMoreElements()) \n\t {\n\t String headerName = headerNames.nextElement();\n\t Enumeration headers = request.getHeaders(headerName);\n\t \n\t while (headers.hasMoreElements()) \n\t {\n\t String headerValue = headers.nextElement();\n\t con.addRequestProperty(headerName, headerValue);\n\t }\n\t }\n\t \n\t if (\"POST\".equals(method))\n\t {\n\t\t\t\t// Send post request\n\t\t\t\tcon.setDoOutput(true);\n\t\t\t\t\n\t\t\t\tOutputStream params = con.getOutputStream();\n\t\t\t\tUtils.copy(request.getInputStream(), params);\n\t\t\t\tparams.flush();\n\t\t\t\tparams.close();\n\t }\n\t \n\t int responseCode = con.getResponseCode();\n\t\t\t//Copy response code\n\t\t\tresponse.setStatus(responseCode);\n\t\t\t\n\t\t\t//Copy response headers\n\t\t\tMap> map = con.getHeaderFields();\n\t\t\t\n\t\t\tfor (Map.Entry> entry : map.entrySet()) \n\t\t\t{\n\t\t\t\tString key = entry.getKey();\n\t\t\t\t\n\t\t\t\tif (key != null)\n\t\t\t\t{\n\t\t\t\t\tfor (String val : entry.getValue())\n\t\t\t\t\t{\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tresponse.addHeader(entry.getKey(), val);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//Copy response\n\t\t\tOutputStream out = response.getOutputStream();\n\t\t\t\n\t\t\t//Error\n\t\t\tif (responseCode >= 400)\n\t\t\t{\n\t\t\t\tUtils.copy(con.getErrorStream(), out);\n\t\t\t}\n\t\t\telse //Success\n\t\t\t{\n\t\t\t\tUtils.copy(con.getInputStream(), out);\n\t\t\t}\n\t\t\t\n\t\t\tout.flush();\n\t\t\tout.close();\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tresponse.setStatus(\n\t\t\t\t\tHttpServletResponse.SC_INTERNAL_SERVER_ERROR);\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": " foreach ($d->aliases as $alias) {\n $schema->addAlias(\n $alias->key,\n $d->id->key\n );\n }", "label": 1, "label_name": "safe"} -{"code": " private void testBSI()\n throws Exception\n {\n KeyPairGenerator kpGen = KeyPairGenerator.getInstance(\"ECDSA\", \"BC\");\n\n kpGen.initialize(new ECGenParameterSpec(TeleTrusTObjectIdentifiers.brainpoolP512r1.getId()));\n\n KeyPair kp = kpGen.generateKeyPair();\n\n byte[] data = \"Hello World!!!\".getBytes();\n String[] cvcAlgs = { \"SHA1WITHCVC-ECDSA\", \"SHA224WITHCVC-ECDSA\",\n \"SHA256WITHCVC-ECDSA\", \"SHA384WITHCVC-ECDSA\",\n \"SHA512WITHCVC-ECDSA\" };\n String[] cvcOids = { EACObjectIdentifiers.id_TA_ECDSA_SHA_1.getId(), EACObjectIdentifiers.id_TA_ECDSA_SHA_224.getId(),\n EACObjectIdentifiers.id_TA_ECDSA_SHA_256.getId(), EACObjectIdentifiers.id_TA_ECDSA_SHA_384.getId(),\n EACObjectIdentifiers.id_TA_ECDSA_SHA_512.getId() };\n\n testBsiAlgorithms(kp, data, cvcAlgs, cvcOids);\n\n String[] plainAlgs = { \"SHA1WITHPLAIN-ECDSA\", \"SHA224WITHPLAIN-ECDSA\",\n \"SHA256WITHPLAIN-ECDSA\", \"SHA384WITHPLAIN-ECDSA\",\n \"SHA512WITHPLAIN-ECDSA\", \"RIPEMD160WITHPLAIN-ECDSA\" };\n String[] plainOids = { BSIObjectIdentifiers.ecdsa_plain_SHA1.getId(), BSIObjectIdentifiers.ecdsa_plain_SHA224.getId(),\n BSIObjectIdentifiers.ecdsa_plain_SHA256.getId(), BSIObjectIdentifiers.ecdsa_plain_SHA384.getId(),\n BSIObjectIdentifiers.ecdsa_plain_SHA512.getId(), BSIObjectIdentifiers.ecdsa_plain_RIPEMD160.getId() };\n\n testBsiAlgorithms(kp, data, plainAlgs, plainOids);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "G.x+=this.editorUi.picker.offsetWidth+4;G.y+=C.offsetTop-E.height/2+16;return G}var P=x.apply(this,arguments);G=mxUtils.getOffset(this.editorUi.sidebarWindow.window.div);P.x+=G.x-16;P.y+=G.y;return P};var y=Menus.prototype.createPopupMenu;Menus.prototype.createPopupMenu=function(C,E,G){var P=this.editorUi.editor.graph;C.smartSeparators=!0;y.apply(this,arguments);\"1\"==urlParams.sketch?P.isEnabled()&&(C.addSeparator(),1==P.getSelectionCount()&&this.addMenuItems(C,[\"-\",\"lockUnlock\"],null,G)):1==P.getSelectionCount()?\n(P.isCellFoldable(P.getSelectionCell())&&this.addMenuItems(C,P.isCellCollapsed(E)?[\"expand\"]:[\"collapse\"],null,G),this.addMenuItems(C,[\"collapsible\",\"-\",\"lockUnlock\",\"enterGroup\"],null,G),C.addSeparator(),this.addSubmenu(\"layout\",C)):P.isSelectionEmpty()&&P.isEnabled()?(C.addSeparator(),this.addMenuItems(C,[\"editData\"],null,G),C.addSeparator(),this.addSubmenu(\"layout\",C),this.addSubmenu(\"insert\",C),this.addMenuItems(C,[\"-\",\"exitGroup\"],null,G)):P.isEnabled()&&this.addMenuItems(C,[\"-\",\"lockUnlock\"],\nnull,G)};var A=Menus.prototype.addPopupMenuEditItems;Menus.prototype.addPopupMenuEditItems=function(C,E,G){A.apply(this,arguments);this.editorUi.editor.graph.isSelectionEmpty()&&this.addMenuItems(C,[\"copyAsImage\"],null,G)};EditorUi.prototype.toggleFormatPanel=function(C){null!=this.formatWindow?this.formatWindow.window.setVisible(null!=C?C:!this.formatWindow.window.isVisible()):b(this)};DiagramFormatPanel.prototype.isMathOptionVisible=function(){return!0};var B=EditorUi.prototype.destroy;EditorUi.prototype.destroy=", "label": 1, "label_name": "safe"} -{"code": "INTERNAL void vterm_screen_free(VTermScreen *screen)\n{\n vterm_allocator_free(screen->vt, screen->buffers[0]);\n if(screen->buffers[1])\n vterm_allocator_free(screen->vt, screen->buffers[1]);\n\n vterm_allocator_free(screen->vt, screen->sb_buffer);\n\n vterm_allocator_free(screen->vt, screen);\n}", "label": 0, "label_name": "vulnerable"} -{"code": " def test_filelike_http11(self):\n to_send = \"GET /filelike HTTP/1.1\\r\\n\\r\\n\"\n to_send = tobytes(to_send)\n\n self.connect()\n\n for t in range(0, 2):\n self.sock.send(to_send)\n fp = self.sock.makefile(\"rb\", 0)\n line, headers, response_body = read_http(fp)\n self.assertline(line, \"200\", \"OK\", \"HTTP/1.1\")\n cl = int(headers[\"content-length\"])\n self.assertEqual(cl, len(response_body))\n ct = headers[\"content-type\"]\n self.assertEqual(ct, \"image/jpeg\")\n self.assertTrue(b\"\\377\\330\\377\" in response_body)", "label": 1, "label_name": "safe"} -{"code": "static ssize_t _epoll_writev(\n oe_fd_t* desc,\n const struct oe_iovec* iov,\n int iovcnt)\n{\n ssize_t ret = -1;\n epoll_t* file = _cast_epoll(desc);\n void* buf = NULL;\n size_t buf_size = 0;\n\n if (!file || (iovcnt && !iov) || iovcnt < 0 || iovcnt > OE_IOV_MAX)\n OE_RAISE_ERRNO(OE_EINVAL);\n\n /* Flatten the IO vector into contiguous heap memory. */\n if (oe_iov_pack(iov, iovcnt, &buf, &buf_size) != 0)\n OE_RAISE_ERRNO(OE_ENOMEM);\n\n /* Call the host. */\n if (oe_syscall_writev_ocall(&ret, file->host_fd, buf, iovcnt, buf_size) !=\n OE_OK)\n {\n OE_RAISE_ERRNO(OE_EINVAL);\n }\n\ndone:\n\n if (buf)\n oe_free(buf);\n\n return ret;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function test_generateFromToken_backtickDisabled()\n {\n $this->config->set('Output.FixInnerHTML', false);\n $this->assertGenerateFromToken(\n new HTMLPurifier_Token_Start('img', array('alt' => '`')),\n '\"`\"'\n );\n }", "label": 1, "label_name": "safe"} -{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n expect { scope.function_values([]) }.to( raise_error(Puppet::ParseError))\n end", "label": 0, "label_name": "vulnerable"} -{"code": " public function testMinimal()\n {\n $this->assertResult(\n '',\n ''\n );\n }", "label": 1, "label_name": "safe"} -{"code": "\t\t\t\t\tout : function(e, ui) {\n\t\t\t\t\t\tvar helper = ui.helper;\n\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\thelper.removeClass('elfinder-drag-helper-move elfinder-drag-helper-plus').data('dropover', Math.max(helper.data('dropover') - 1, 0));\n\t\t\t\t\t\t$(this).removeData('dropover')\n\t\t\t\t\t\t .removeClass(dropover);\n\t\t\t\t\t\tfm.trigger('unlockfiles', {files : helper.data('files'), helper: helper});\n\t\t\t\t\t},\n\t\t\t\t\tdrop : function(e, ui) {\n\t\t\t\t\t\tvar helper = ui.helper,\n\t\t\t\t\t\t\tresolve = true;\n\t\t\t\t\t\t\n\t\t\t\t\t\t$.each(helper.data('files'), function(i, hash) {\n\t\t\t\t\t\t\tvar dir = fm.file(hash);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (dir && dir.mime == 'directory' && !dirs[dir.hash]) {\n\t\t\t\t\t\t\t\tadd(dir);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tresolve = false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\tsave();\n\t\t\t\t\t\tresolve && helper.hide();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t// for touch device\n\t\t\t\t.on('touchstart', '.'+navdir+':not(.'+clroot+')', function(e) {\n\t\t\t\t\tvar hash = $(this).attr('id').substr(6),\n\t\t\t\t\tp = $(this)\n\t\t\t\t\t.addClass(hover)\n\t\t\t\t\t.data('longtap', null)\n\t\t\t\t\t.data('tmlongtap', setTimeout(function(){\n\t\t\t\t\t\t// long tap\n\t\t\t\t\t\tp.data('longtap', true);\n\t\t\t\t\t\tfm.trigger('contextmenu', {\n\t\t\t\t\t\t\traw : [{\n\t\t\t\t\t\t\t\tlabel : fm.i18n('rmFromPlaces'),\n\t\t\t\t\t\t\t\ticon : 'rm',\n\t\t\t\t\t\t\t\tcallback : function() { remove(hash); save(); }\n\t\t\t\t\t\t\t}],\n\t\t\t\t\t\t\t'x' : e.originalEvent.touches[0].pageX,\n\t\t\t\t\t\t\t'y' : e.originalEvent.touches[0].pageY\n\t\t\t\t\t\t});\n\t\t\t\t\t}, 500));\n\t\t\t\t})\n\t\t\t\t.on('touchmove touchend', '.'+navdir+':not(.'+clroot+')', function(e) {\n\t\t\t\t\tclearTimeout($(this).data('tmlongtap'));\n\t\t\t\t\tif (e.type == 'touchmove') {\n\t\t\t\t\t\t$(this).removeClass(hover);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t// \"on regist\" for command exec\n\t\t$(this).on('regist', function(e, files){\n\t\t\tvar added = false;\n\t\t\t$.each(files, function(i, dir) {\n\t\t\t\tif (dir && dir.mime == 'directory' && !dirs[dir.hash]) {\n\t\t\t\t\tif (add(dir)) {\n\t\t\t\t\t\tadded = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tadded && save();\n\t\t});\n\t\n\n\t\t// on fm load - show places and load files from backend\n\t\tfm.one('load', function() {\n\t\t\tvar dat, hashes;\n\t\t\t\n\t\t\tif (fm.oldAPI) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tplaces.show().parent().show();\n\n\t\t\tdirs = {};\n\t\t\tdat = $.map((fm.storage(key) || '').split(','), function(hash) { return hash || null;});\n\t\t\t$.each(dat, function(i, d) {\n\t\t\t\tvar dir = d.split('#')\n\t\t\t\tdirs[dir[0]] = dir[1]? dir[1] : dir[0];\n\t\t\t});\n\t\t\t// allow modify `dirs`\n\t\t\t/**\n\t\t\t * example for preset places\n\t\t\t * \n\t\t\t * elfinderInstance.bind('placesload', function(e, fm) {\n\t\t\t * \t//if (fm.storage(e.data.storageKey) === null) { // for first time only\n\t\t\t * \tif (!fm.storage(e.data.storageKey)) { // for empty places\n\t\t\t * \t\te.data.dirs[targetHash] = fallbackName; // preset folder\n\t\t\t * \t}\n\t\t\t * }\n\t\t\t **/\n\t\t\tfm.trigger('placesload', {dirs: dirs, storageKey: key}, true);\n\t\t\t\n\t\t\thashes = Object.keys(dirs);\n\t\t\tif (hashes.length) {\n\t\t\t\troot.prepend(spinner);\n\t\t\t\t\n\t\t\t\tfm.request({\n\t\t\t\t\tdata : {cmd : 'info', targets : hashes},\n\t\t\t\t\tpreventDefault : true\n\t\t\t\t})\n\t\t\t\t.done(function(data) {\n\t\t\t\t\tvar exists = {};\n\t\t\t\t\t$.each(data.files, function(i, f) {\n\t\t\t\t\t\tvar hash = f.hash;\n\t\t\t\t\t\texists[hash] = f;\n\t\t\t\t\t});\n\t\t\t\t\t$.each(dirs, function(h, f) {\n\t\t\t\t\t\tadd(exists[h] || { hash: h, name: f, mime: 'directory', notfound: true });\n\t\t\t\t\t});\n\t\t\t\t\tif (fm.storage('placesState') > 0) {\n\t\t\t\t\t\troot.click();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.always(function() {\n\t\t\t\t\tspinner.remove();\n\t\t\t\t})\n\t\t\t}\n\t\t\t\n\n\t\t\tfm.change(function(e) {\n\t\t\t\tvar changed = false;\n\t\t\t\t$.each(e.data.changed, function(i, file) {\n\t\t\t\t\tif (dirs[file.hash]) {\n\t\t\t\t\t\tif (file.mime !== 'directory') {\n\t\t\t\t\t\t\tif (remove(file.hash)) {\n\t\t\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (update(file)) {\n\t\t\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tchanged && save();\n\t\t\t})\n\t\t\t.bind('rename', function(e) {\n\t\t\t\tvar changed = false;\n\t\t\t\tif (e.data.removed) {\n\t\t\t\t\t$.each(e.data.removed, function(i, hash) {\n\t\t\t\t\t\tif (e.data.added[i]) {\n\t\t\t\t\t\t\tif (update(e.data.added[i], hash)) {\n\t\t\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tchanged && save();\n\t\t\t})\n\t\t\t.bind('rm paste', function(e) {\n\t\t\t\tvar names = [],\n\t\t\t\t\tchanged = false;\n\t\t\t\tif (e.data.removed) {\n\t\t\t\t\t$.each(e.data.removed, function(i, hash) {\n\t\t\t\t\t\tvar name = remove(hash);\n\t\t\t\t\t\tname && names.push(name);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (names.length) {\n\t\t\t\t\tchanged = true;\n\t\t\t\t}\n\t\t\t\tif (e.data.added && names.length) {\n\t\t\t\t\t$.each(e.data.added, function(i, file) {\n\t\t\t\t\t\tif ($.inArray(file.name, names) !== 1) {\n\t\t\t\t\t\t\tfile.mime == 'directory' && add(file);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tchanged && save();\n\t\t\t})\n\t\t\t.bind('sync', function() {\n\t\t\t\tvar hashes = Object.keys(dirs);\n\t\t\t\tif (hashes.length) {\n\t\t\t\t\troot.prepend(spinner);\n\n\t\t\t\t\tfm.request({\n\t\t\t\t\t\tdata : {cmd : 'info', targets : hashes},\n\t\t\t\t\t\tpreventDefault : true\n\t\t\t\t\t})\n\t\t\t\t\t.done(function(data) {\n\t\t\t\t\t\tvar exists = {},\n\t\t\t\t\t\t\tupdated = false,\n\t\t\t\t\t\t\tcwd = fm.cwd().hash;\n\t\t\t\t\t\t$.each(data.files || [], function(i, file) {\n\t\t\t\t\t\t\tvar hash = file.hash;\n\t\t\t\t\t\t\texists[hash] = file;\n\t\t\t\t\t\t\tif (!fm.files().hasOwnProperty(file.hash)) {\n\t\t\t\t\t\t\t\t// update cache\n\t\t\t\t\t\t\t\tfm.trigger('tree', {tree: [file]});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t$.each(dirs, function(h, f) {\n\t\t\t\t\t\t\tif (!f.notfound != !!exists[h]) {\n\t\t\t\t\t\t\t\tif (f.phash === cwd || (exists[h] && exists[h].mime !== 'directory')) {\n\t\t\t\t\t\t\t\t\tif (remove(h)) {\n\t\t\t\t\t\t\t\t\t\tupdated = true;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tif (update(exists[h] || { hash: h, name: f.name, mime: 'directory', notfound: true })) {\n\t\t\t\t\t\t\t\t\t\tupdated = true;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (exists[h] && exists[h].phash != cwd) {\n\t\t\t\t\t\t\t\t// update permission of except cwd\n\t\t\t\t\t\t\t\tupdate(exists[h]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tupdated && save();\n\t\t\t\t\t})\n\t\t\t\t\t.always(function() {\n\t\t\t\t\t\tspinner.remove();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t})\n\t\t\t\n\t\t})\n\t\t\n\t});\n}", "label": 0, "label_name": "vulnerable"} -{"code": " def create\n if !@resource.value(:source)\n create_repository(@resource.value(:path))\n else\n checkout_repository\n end\n update_owner\n end", "label": 0, "label_name": "vulnerable"} -{"code": " it \"removes all matching documents\" do\n session.should_receive(:with, :consistency => :strong).\n and_yield(session)\n\n session.should_receive(:execute).with do |delete|\n delete.flags.should eq []\n delete.selector.should eq query.operation.selector\n end\n\n query.remove_all\n end", "label": 0, "label_name": "vulnerable"} -{"code": "function(l){this.actions.get(\"shapes\").funct();mxEvent.consume(l)}));d.appendChild(g);return d};EditorUi.prototype.handleError=function(d,g,k,l,p,q,x){var y=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},z=null!=d&&null!=d.error?d.error:d;if(null!=d&&(\"1\"==urlParams.test||null!=d.stack)&&null!=d.message)try{x?null!=window.console&&console.error(\"EditorUi.handleError:\",d):EditorUi.logError(\"Caught: \"+(\"\"==d.message&&null!=d.name)?d.name:d.message,d.filename,d.lineNumber,\nd.columnNumber,d,\"INFO\")}catch(u){}if(null!=z||null!=g){x=mxUtils.htmlEntities(mxResources.get(\"unknownError\"));var A=mxResources.get(\"ok\"),L=null;g=null!=g?g:mxResources.get(\"error\");if(null!=z){null!=z.retry&&(A=mxResources.get(\"cancel\"),L=function(){y();z.retry()});if(404==z.code||404==z.status||403==z.code){x=403==z.code?null!=z.message?mxUtils.htmlEntities(z.message):mxUtils.htmlEntities(mxResources.get(\"accessDenied\")):null!=p?p:mxUtils.htmlEntities(mxResources.get(\"fileNotFoundOrDenied\")+(null!=\nthis.drive&&null!=this.drive.user?\" (\"+this.drive.user.displayName+\", \"+this.drive.user.email+\")\":\"\"));var O=null!=p?null:null!=q?q:window.location.hash;if(null!=O&&(\"#G\"==O.substring(0,2)||\"#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D\"==O.substring(0,45))&&(null!=d&&null!=d.error&&(null!=d.error.errors&&0\");I.setAttribute(\"disabled\",\"disabled\");G.appendChild(I)}I=document.createElement(\"option\");mxUtils.write(I,mxResources.get(\"addAccount\"));I.value=D.length;G.appendChild(I)}var D=this.drive.getUsersList(),B=document.createElement(\"div\"),C=document.createElement(\"span\");C.style.marginTop=\"6px\";mxUtils.write(C,mxResources.get(\"changeUser\")+\": \");B.appendChild(C);var G=document.createElement(\"select\");G.style.width=\"200px\";u();mxEvent.addListener(G,\"change\",mxUtils.bind(this,\nfunction(){var N=G.value,I=D.length!=N;I&&this.drive.setUser(D[N]);this.drive.authorize(I,mxUtils.bind(this,function(){I||(D=this.drive.getUsersList(),u())}),mxUtils.bind(this,function(F){this.handleError(F)}),!0)}));B.appendChild(G);B=new CustomDialog(this,B,mxUtils.bind(this,function(){this.loadFile(window.location.hash.substr(1),!0)}));this.showDialog(B.container,300,100,!0,!0)}),mxResources.get(\"cancel\"),mxUtils.bind(this,function(){this.hideDialog();null!=k&&k()}),480,150);return}}null!=z.message?\nx=\"\"==z.message&&null!=z.name?mxUtils.htmlEntities(z.name):mxUtils.htmlEntities(z.message):null!=z.response&&null!=z.response.error?x=mxUtils.htmlEntities(z.response.error):\"undefined\"!==typeof window.App&&(z.code==App.ERROR_TIMEOUT?x=mxUtils.htmlEntities(mxResources.get(\"timeout\")):z.code==App.ERROR_BUSY?x=mxUtils.htmlEntities(mxResources.get(\"busy\")):\"string\"===typeof z&&0warmUp(dirname(self::$cacheFile));\n\n $this->assertFileExists(self::$cacheFile);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "jpeg_error_handler(j_common_ptr p)\t// Common JPEG data\n{\n hd_jpeg_err_t\t*jerr = (hd_jpeg_err_t *)p->err;\n\t\t\t\t\t// JPEG error handler\n\n\n // Save the error message in the string buffer...\n (jerr->jerr.format_message)(p, jerr->message);\n\n // Return to the point we called setjmp()...\n longjmp(jerr->retbuf, 1);\n}", "label": 1, "label_name": "safe"} -{"code": " private SingleButtonPanel addNewAjaxActionButton(final AjaxCallback ajaxCallback, final String label, final String... classnames)\n {\n final AjaxButton button = new AjaxButton(\"button\", form) {\n private static final long serialVersionUID = -5306532706450731336L;\n\n @Override\n protected void onSubmit(final AjaxRequestTarget target, final Form< ? > form)\n {\n csrfTokenHandler.onSubmit();\n ajaxCallback.callback(target);\n }\n\n @Override\n protected void onError(final AjaxRequestTarget target, final Form< ? > form)\n {\n if (ajaxCallback instanceof AjaxFormSubmitCallback) {\n ((AjaxFormSubmitCallback) ajaxCallback).onError(target, form);\n }\n }\n };\n final SingleButtonPanel buttonPanel = new SingleButtonPanel(this.actionButtons.newChildId(), button, label, classnames);\n buttonPanel.add(button);\n return buttonPanel;\n }", "label": 1, "label_name": "safe"} -{"code": "\t\t\t\t\tparser.validateLink = function(url) {\n\t\t\t\t\t\tvar BAD_PROTOCOLS = [ 'vbscript', 'javascript', 'file', 'data' ];\n\t\t\t\t\t\tvar str = url.trim().toLowerCase();\n\n\t\t\t\t\t\tif (str.indexOf(':') >= 0 && BAD_PROTOCOLS.indexOf(str.split(':')[0]) >= 0) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}", "label": 1, "label_name": "safe"} -{"code": " it \"using %s should be higher then when I wrote this test\" do\n result = scope.function_strftime([\"%s\"])\n expect(result.to_i).to(be > 1311953157)\n end", "label": 0, "label_name": "vulnerable"} -{"code": "static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflen)\n{\n\tstruct page *pages[NFS4ACL_MAXPAGES] = {NULL, };\n\tstruct nfs_getaclargs args = {\n\t\t.fh = NFS_FH(inode),\n\t\t.acl_pages = pages,\n\t\t.acl_len = buflen,\n\t};\n\tstruct nfs_getaclres res = {\n\t\t.acl_len = buflen,\n\t};\n\tstruct rpc_message msg = {\n\t\t.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETACL],\n\t\t.rpc_argp = &args,\n\t\t.rpc_resp = &res,\n\t};\n\tunsigned int npages = DIV_ROUND_UP(buflen, PAGE_SIZE);\n\tint ret = -ENOMEM, i;\n\n\t/* As long as we're doing a round trip to the server anyway,\n\t * let's be prepared for a page of acl data. */\n\tif (npages == 0)\n\t\tnpages = 1;\n\tif (npages > ARRAY_SIZE(pages))\n\t\treturn -ERANGE;\n\n\tfor (i = 0; i < npages; i++) {\n\t\tpages[i] = alloc_page(GFP_KERNEL);\n\t\tif (!pages[i])\n\t\t\tgoto out_free;\n\t}\n\n\t/* for decoding across pages */\n\tres.acl_scratch = alloc_page(GFP_KERNEL);\n\tif (!res.acl_scratch)\n\t\tgoto out_free;\n\n\targs.acl_len = npages * PAGE_SIZE;\n\targs.acl_pgbase = 0;\n\n\tdprintk(\"%s buf %p buflen %zu npages %d args.acl_len %zu\\n\",\n\t\t__func__, buf, buflen, npages, args.acl_len);\n\tret = nfs4_call_sync(NFS_SERVER(inode)->client, NFS_SERVER(inode),\n\t\t\t &msg, &args.seq_args, &res.seq_res, 0);\n\tif (ret)\n\t\tgoto out_free;\n\n\t/* Handle the case where the passed-in buffer is too short */\n\tif (res.acl_flags & NFS4_ACL_TRUNC) {\n\t\t/* Did the user only issue a request for the acl length? */\n\t\tif (buf == NULL)\n\t\t\tgoto out_ok;\n\t\tret = -ERANGE;\n\t\tgoto out_free;\n\t}\n\tnfs4_write_cached_acl(inode, pages, res.acl_data_offset, res.acl_len);\n\tif (buf)\n\t\t_copy_from_pages(buf, pages, res.acl_data_offset, res.acl_len);\nout_ok:\n\tret = res.acl_len;\nout_free:\n\tfor (i = 0; i < npages; i++)\n\t\tif (pages[i])\n\t\t\t__free_page(pages[i]);\n\tif (res.acl_scratch)\n\t\t__free_page(res.acl_scratch);\n\treturn ret;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "EditorUi.prototype.updateTabContainer=function(){null!=this.tabContainer&&(this.tabContainer.style.right=\"70px\",this.diagramContainer.style.bottom=\"1\"==urlParams.sketch?\"0px\":this.tabContainerHeight+\"px\");f.apply(this,arguments)};var g=EditorUi.prototype.updateActionStates;EditorUi.prototype.updateActionStates=function(){g.apply(this,arguments);this.menus.get(\"save\").setEnabled(null!=this.getCurrentFile()||\"1\"==urlParams.embed)};var m=Menus.prototype.addShortcut;Menus.prototype.addShortcut=function(O,\nX){null!=X.shortcut&&900>n&&!mxClient.IS_IOS?O.firstChild.nextSibling.setAttribute(\"title\",X.shortcut):m.apply(this,arguments)};var q=App.prototype.updateUserElement;App.prototype.updateUserElement=function(){q.apply(this,arguments);if(null!=this.userElement){var O=this.userElement;O.style.cssText=\"position:relative;margin-right:4px;cursor:pointer;display:\"+O.style.display;O.className=\"geToolbarButton\";O.innerHTML=\"\";O.style.backgroundImage=\"url(\"+Editor.userImage+\")\";O.style.backgroundPosition=\"center center\";", "label": 0, "label_name": "vulnerable"} -{"code": "static __forceinline void draw_line(float *output, int x0, int y0, int x1, int y1, int n)\n{\n int dy = y1 - y0;\n int adx = x1 - x0;\n int ady = abs(dy);\n int base;\n int x=x0,y=y0;\n int err = 0;\n int sy;\n\n#ifdef STB_VORBIS_DIVIDE_TABLE\n if (adx < DIVTAB_DENOM && ady < DIVTAB_NUMER) {\n if (dy < 0) {\n base = -integer_divide_table[ady][adx];\n sy = base-1;\n } else {\n base = integer_divide_table[ady][adx];\n sy = base+1;\n }\n } else {\n base = dy / adx;\n if (dy < 0)\n sy = base - 1;\n else\n sy = base+1;\n }\n#else\n base = dy / adx;\n if (dy < 0)\n sy = base - 1;\n else\n sy = base+1;\n#endif\n ady -= abs(base) * adx;\n if (x1 > n) x1 = n;\n if (x < x1) {\n LINE_OP(output[x], inverse_db_table[y&255]);\n for (++x; x < x1; ++x) {\n err += ady;\n if (err >= adx) {\n err -= adx;\n y += sy;\n } else\n y += base;\n LINE_OP(output[x], inverse_db_table[y&255]);\n }\n }\n}", "label": 1, "label_name": "safe"} -{"code": " public static ExportFile DownloadExportFile(DateTime date, string fileName)\n {\n var exportFile = new ExportFile();\n var statusCode = Client.Instance.PerformRequest(Client.HttpRequestMethod.Get,\n string.Format(ExportFile.FileUrlPrefix, date.ToString(\"yyyy-MM-dd\"), Uri.EscapeUriString(fileName)),\n exportFile.ReadXml);\n\n return statusCode != HttpStatusCode.NotFound ? exportFile : null;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "window.addEventListener(\"message\",v)}})));c(q);q.onversionchange=function(){q.close()}});k.onerror=e;k.onblocked=function(){}}catch(m){null!=e&&e(m)}else null!=e&&e()}else c(this.database)};EditorUi.prototype.setDatabaseItem=function(c,e,g,k,m){this.openDatabase(mxUtils.bind(this,function(q){try{m=m||\"objects\";Array.isArray(m)||(m=[m],c=[c],e=[e]);var v=q.transaction(m,\"readwrite\");v.oncomplete=g;v.onerror=k;for(q=0;q md5(mt_rand()),\n 'tmp_name' => md5(mt_rand()),\n 'type' => 'image/jpeg',\n 'size' => mt_rand(1000, 10000),\n 'error' => '0',\n ];\n }", "label": 0, "label_name": "vulnerable"} -{"code": "ber_parse_header(STREAM s, int tagval, int *length)\n{\n\tint tag, len;\n\n\tif (tagval > 0xff)\n\t{\n\t\tin_uint16_be(s, tag);\n\t}\n\telse\n\t{\n\t\tin_uint8(s, tag);\n\t}\n\n\tif (tag != tagval)\n\t{\n\t\tlogger(Core, Error, \"ber_parse_header(), expected tag %d, got %d\", tagval, tag);\n\t\treturn False;\n\t}\n\n\tin_uint8(s, len);\n\n\tif (len & 0x80)\n\t{\n\t\tlen &= ~0x80;\n\t\t*length = 0;\n\t\twhile (len--)\n\t\t\tnext_be(s, *length);\n\t}\n\telse\n\t\t*length = len;\n\n\treturn s_check(s);\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function testPreserveNamespace()\n {\n $this->assertResult('%Core namespace (not recognized)');\n }", "label": 1, "label_name": "safe"} -{"code": "init_remote_listener(int port, gboolean encrypted)\n{\n int rc;\n int *ssock = NULL;\n struct sockaddr_in saddr;\n int optval;\n static struct mainloop_fd_callbacks remote_listen_fd_callbacks = \n {\n .dispatch = cib_remote_listen,\n .destroy = remote_connection_destroy,\n };\n\n if (port <= 0) {\n /* dont start it */\n return 0;\n }\n\n if (encrypted) {\n#ifndef HAVE_GNUTLS_GNUTLS_H\n crm_warn(\"TLS support is not available\");\n return 0;\n#else\n crm_notice(\"Starting a tls listener on port %d.\", port);\n gnutls_global_init();\n /* gnutls_global_set_log_level (10); */\n gnutls_global_set_log_function(debug_log);\n gnutls_dh_params_init(&dh_params);\n gnutls_dh_params_generate2(dh_params, DH_BITS);\n gnutls_anon_allocate_server_credentials(&anon_cred_s);\n gnutls_anon_set_server_dh_params(anon_cred_s, dh_params);\n#endif\n } else {\n crm_warn(\"Starting a plain_text listener on port %d.\", port);\n }\n#ifndef HAVE_PAM\n crm_warn(\"PAM is _not_ enabled!\");\n#endif\n\n /* create server socket */\n ssock = malloc(sizeof(int));\n *ssock = socket(AF_INET, SOCK_STREAM, 0);\n if (*ssock == -1) {\n crm_perror(LOG_ERR, \"Can not create server socket.\" ERROR_SUFFIX);\n free(ssock);\n return -1;\n }\n\n /* reuse address */\n optval = 1;\n rc = setsockopt(*ssock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval));\n if(rc < 0) {\n crm_perror(LOG_INFO, \"Couldn't allow the reuse of local addresses by our remote listener\");\n }\n\n /* bind server socket */\n memset(&saddr, '\\0', sizeof(saddr));\n saddr.sin_family = AF_INET;\n saddr.sin_addr.s_addr = INADDR_ANY;\n saddr.sin_port = htons(port);\n if (bind(*ssock, (struct sockaddr *)&saddr, sizeof(saddr)) == -1) {\n crm_perror(LOG_ERR, \"Can not bind server socket.\" ERROR_SUFFIX);\n close(*ssock);\n free(ssock);\n return -2;\n }\n if (listen(*ssock, 10) == -1) {\n crm_perror(LOG_ERR, \"Can not start listen.\" ERROR_SUFFIX);\n close(*ssock);\n free(ssock);\n return -3;\n }\n\n mainloop_add_fd(\"cib-remote\", G_PRIORITY_DEFAULT, *ssock, ssock, &remote_listen_fd_callbacks);\n\n return *ssock;\n}", "label": 1, "label_name": "safe"} -{"code": "int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)\n{\n\tstruct snd_ctl_elem_id id;\n\tunsigned int idx;\n\tunsigned int count;\n\tint err = -EINVAL;\n\n\tif (! kcontrol)\n\t\treturn err;\n\tif (snd_BUG_ON(!card || !kcontrol->info))\n\t\tgoto error;\n\tid = kcontrol->id;\n\tif (id.index > UINT_MAX - kcontrol->count)\n\t\tgoto error;\n\n\tdown_write(&card->controls_rwsem);\n\tif (snd_ctl_find_id(card, &id)) {\n\t\tup_write(&card->controls_rwsem);\n\t\tdev_err(card->dev, \"control %i:%i:%i:%s:%i is already present\\n\",\n\t\t\t\t\tid.iface,\n\t\t\t\t\tid.device,\n\t\t\t\t\tid.subdevice,\n\t\t\t\t\tid.name,\n\t\t\t\t\tid.index);\n\t\terr = -EBUSY;\n\t\tgoto error;\n\t}\n\tif (snd_ctl_find_hole(card, kcontrol->count) < 0) {\n\t\tup_write(&card->controls_rwsem);\n\t\terr = -ENOMEM;\n\t\tgoto error;\n\t}\n\tlist_add_tail(&kcontrol->list, &card->controls);\n\tcard->controls_count += kcontrol->count;\n\tkcontrol->id.numid = card->last_numid + 1;\n\tcard->last_numid += kcontrol->count;\n\tcount = kcontrol->count;\n\tup_write(&card->controls_rwsem);\n\tfor (idx = 0; idx < count; idx++, id.index++, id.numid++)\n\t\tsnd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id);\n\treturn 0;\n\n error:\n\tsnd_ctl_free_one(kcontrol);\n\treturn err;\n}", "label": 1, "label_name": "safe"} -{"code": "t1mac_output_ascii(char *s, int len)\n{\n if (blocktyp == POST_BINARY) {\n output_current_post();\n blocktyp = POST_ASCII;\n }\n /* Mac line endings */\n if (len > 0 && s[len-1] == '\\n')\n s[len-1] = '\\r';\n t1mac_output_data((byte *)s, len);\n if (strncmp(s, \"/FontName\", 9) == 0) {\n for (s += 9; isspace((unsigned char) *s); s++)\n /* skip */;\n if (*s == '/') {\n const char *t = ++s;\n while (*t && !isspace((unsigned char) *t)) t++;\n free(font_name);\n font_name = (char *)malloc(t - s + 1);\n memcpy(font_name, s, t - s);\n font_name[t - s] = 0;\n }\n }\n}", "label": 1, "label_name": "safe"} -{"code": "function(){b.spinner.stop();if(null==b.linkPicker){var n=b.drive.createLinkPicker();b.linkPicker=n.setCallback(function(x){LinkDialog.filePicked(x)}).build()}b.linkPicker.setVisible(!0)}))});\"undefined\"!=typeof Dropbox&&\"undefined\"!=typeof Dropbox.choose&&c(IMAGE_PATH+\"/dropbox-logo.svg\",mxResources.get(\"dropbox\"),function(){Dropbox.choose({linkType:\"direct\",cancel:function(){},success:function(n){k.value=n[0].link;k.focus()}})});null!=b.oneDrive&&c(IMAGE_PATH+\"/onedrive-logo.svg\",mxResources.get(\"oneDrive\"),", "label": 1, "label_name": "safe"} -{"code": " void Compute(OpKernelContext* ctx) override {\n const Tensor& gradient = ctx->input(0);\n const Tensor& input = ctx->input(1);\n Tensor* input_backprop = nullptr;\n OP_REQUIRES_OK(ctx,\n ctx->allocate_output(0, input.shape(), &input_backprop));\n\n OP_REQUIRES(\n ctx, input.IsSameSize(gradient),\n errors::InvalidArgument(\"gradient and input must be the same size\"));\n const int depth = (axis_ == -1) ? 1 : input.dim_size(axis_);\n const Tensor& input_min_tensor = ctx->input(2);\n OP_REQUIRES(ctx,\n input_min_tensor.dims() == 0 || input_min_tensor.dims() == 1,\n errors::InvalidArgument(\n \"Input min tensor must have dimension 1. Recieved \",\n input_min_tensor.dims(), \".\"));\n const Tensor& input_max_tensor = ctx->input(3);\n OP_REQUIRES(ctx,\n input_max_tensor.dims() == 0 || input_max_tensor.dims() == 1,\n errors::InvalidArgument(\n \"Input max tensor must have dimension 1. Recieved \",\n input_max_tensor.dims(), \".\"));\n if (axis_ != -1) {\n OP_REQUIRES(\n ctx, input_min_tensor.dim_size(0) == depth,\n errors::InvalidArgument(\"min has incorrect size, expected \", depth,\n \" was \", input_min_tensor.dim_size(0)));\n OP_REQUIRES(\n ctx, input_max_tensor.dim_size(0) == depth,\n errors::InvalidArgument(\"max has incorrect size, expected \", depth,\n \" was \", input_max_tensor.dim_size(0)));\n }\n\n TensorShape min_max_shape(input_min_tensor.shape());\n Tensor* input_min_backprop;\n OP_REQUIRES_OK(ctx,\n ctx->allocate_output(1, min_max_shape, &input_min_backprop));\n\n Tensor* input_max_backprop;\n OP_REQUIRES_OK(ctx,\n ctx->allocate_output(2, min_max_shape, &input_max_backprop));\n\n if (axis_ == -1) {\n functor::QuantizeAndDequantizeOneScaleGradientFunctor f;\n f(ctx->eigen_device(), gradient.template flat(),\n input.template flat(), input_min_tensor.scalar(),\n input_max_tensor.scalar(), input_backprop->template flat(),\n input_min_backprop->template scalar(),\n input_max_backprop->template scalar());\n } else {\n functor::QuantizeAndDequantizePerChannelGradientFunctor f;\n f(ctx->eigen_device(),\n gradient.template flat_inner_outer_dims(axis_ - 1),\n input.template flat_inner_outer_dims(axis_ - 1),\n &input_min_tensor, &input_max_tensor,\n input_backprop->template flat_inner_outer_dims(axis_ - 1),\n input_min_backprop->template flat(),\n input_max_backprop->template flat());\n }\n }", "label": 1, "label_name": "safe"} -{"code": "def yet_another_upload_file(request):\n path = tempfile.mkdtemp()\n file_name = os.path.join(path, \"yet_another_%s.txt\" % request.node.name)\n with open(file_name, \"w\") as f:\n f.write(request.node.name)\n return file_name", "label": 0, "label_name": "vulnerable"} -{"code": " def test_size_is_not_scalar(self): # b/206619828\n with self.assertRaisesRegex((ValueError, errors.InvalidArgumentError),\n \"Shape must be rank 0 but is rank 1\"):\n self.evaluate(\n gen_math_ops.dense_bincount(\n input=[0], size=[1, 1], weights=[3], binary_output=False))", "label": 1, "label_name": "safe"} -{"code": "func (*UserList) Descriptor() ([]byte, []int) {\n\treturn file_console_proto_rawDescGZIP(), []int{40}\n}", "label": 1, "label_name": "safe"} -{"code": "static int rd_allocate_sgl_table(struct rd_dev *rd_dev, struct rd_dev_sg_table *sg_table,\n\t\t\t\t u32 total_sg_needed, unsigned char init_payload)\n{\n\tu32 i = 0, j, page_offset = 0, sg_per_table;\n\tu32 max_sg_per_table = (RD_MAX_ALLOCATION_SIZE /\n\t\t\t\tsizeof(struct scatterlist));\n\tstruct page *pg;\n\tstruct scatterlist *sg;\n\tunsigned char *p;\n\n\twhile (total_sg_needed) {\n\t\tsg_per_table = (total_sg_needed > max_sg_per_table) ?\n\t\t\tmax_sg_per_table : total_sg_needed;\n\n\t\tsg = kzalloc(sg_per_table * sizeof(struct scatterlist),\n\t\t\t\tGFP_KERNEL);\n\t\tif (!sg) {\n\t\t\tpr_err(\"Unable to allocate scatterlist array\"\n\t\t\t\t\" for struct rd_dev\\n\");\n\t\t\treturn -ENOMEM;\n\t\t}\n\n\t\tsg_init_table(sg, sg_per_table);\n\n\t\tsg_table[i].sg_table = sg;\n\t\tsg_table[i].rd_sg_count = sg_per_table;\n\t\tsg_table[i].page_start_offset = page_offset;\n\t\tsg_table[i++].page_end_offset = (page_offset + sg_per_table)\n\t\t\t\t\t\t- 1;\n\n\t\tfor (j = 0; j < sg_per_table; j++) {\n\t\t\tpg = alloc_pages(GFP_KERNEL, 0);\n\t\t\tif (!pg) {\n\t\t\t\tpr_err(\"Unable to allocate scatterlist\"\n\t\t\t\t\t\" pages for struct rd_dev_sg_table\\n\");\n\t\t\t\treturn -ENOMEM;\n\t\t\t}\n\t\t\tsg_assign_page(&sg[j], pg);\n\t\t\tsg[j].length = PAGE_SIZE;\n\n\t\t\tp = kmap(pg);\n\t\t\tmemset(p, init_payload, PAGE_SIZE);\n\t\t\tkunmap(pg);\n\t\t}\n\n\t\tpage_offset += sg_per_table;\n\t\ttotal_sg_needed -= sg_per_table;\n\t}\n\n\treturn 0;\n}", "label": 1, "label_name": "safe"} -{"code": " private X509TrustManager createTrustManager() {\n X509TrustManager trustManager = new X509TrustManager() {\n\n /**\n * {@InheritDoc}\n *\n * @see javax.net.ssl.X509TrustManager#checkClientTrusted(java.security.cert.X509Certificate[], java.lang.String)\n */\n public void checkClientTrusted(X509Certificate[] xcs, String string) throws CertificateException {\n logger.trace(\"Skipping trust check on client certificate {}\", string);\n }\n\n /**\n * {@InheritDoc}\n *\n * @see javax.net.ssl.X509TrustManager#checkServerTrusted(java.security.cert.X509Certificate[], java.lang.String)\n */\n public void checkServerTrusted(X509Certificate[] xcs, String string) throws CertificateException {\n logger.trace(\"Skipping trust check on server certificate {}\", string);\n }\n\n /**\n * {@InheritDoc}\n *\n * @see javax.net.ssl.X509TrustManager#getAcceptedIssuers()\n */\n public X509Certificate[] getAcceptedIssuers() {\n logger.trace(\"Returning empty list of accepted issuers\");\n return null;\n }\n\n };\n\n return trustManager;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "MagickExport MemoryInfo *AcquireVirtualMemory(const size_t count,\n const size_t quantum)\n{\n MemoryInfo\n *memory_info;\n\n size_t\n length;\n\n length=count*quantum;\n if ((count == 0) || (quantum != (length/count)))\n {\n errno=ENOMEM;\n return((MemoryInfo *) NULL);\n }\n memory_info=(MemoryInfo *) MagickAssumeAligned(AcquireAlignedMemory(1,\n sizeof(*memory_info)));\n if (memory_info == (MemoryInfo *) NULL)\n ThrowFatalException(ResourceLimitFatalError,\"MemoryAllocationFailed\");\n (void) ResetMagickMemory(memory_info,0,sizeof(*memory_info));\n memory_info->length=length;\n memory_info->signature=MagickSignature;\n if (AcquireMagickResource(MemoryResource,length) != MagickFalse)\n {\n memory_info->blob=AcquireAlignedMemory(1,length);\n if (memory_info->blob != NULL)\n memory_info->type=AlignedVirtualMemory;\n else\n RelinquishMagickResource(MemoryResource,length);\n }\n if ((memory_info->blob == NULL) &&\n (AcquireMagickResource(MapResource,length) != MagickFalse))\n {\n /*\n Heap memory failed, try anonymous memory mapping.\n */\n memory_info->blob=MapBlob(-1,IOMode,0,length);\n if (memory_info->blob != NULL)\n memory_info->type=MapVirtualMemory;\n else\n RelinquishMagickResource(MapResource,length);\n }\n if (memory_info->blob == NULL)\n {\n int\n file;\n\n /*\n Anonymous memory mapping failed, try file-backed memory mapping.\n */\n file=AcquireUniqueFileResource(memory_info->filename);\n if (file != -1)\n {\n if ((lseek(file,length-1,SEEK_SET) >= 0) && (write(file,\"\",1) == 1))\n {\n memory_info->blob=MapBlob(file,IOMode,0,length);\n if (memory_info->blob != NULL)\n {\n memory_info->type=MapVirtualMemory;\n (void) AcquireMagickResource(MapResource,length);\n }\n }\n (void) close(file);\n }\n }\n if (memory_info->blob == NULL)\n {\n memory_info->blob=AcquireMagickMemory(length);\n if (memory_info->blob != NULL)\n memory_info->type=UnalignedVirtualMemory;\n }\n if (memory_info->blob == NULL)\n memory_info=RelinquishVirtualMemory(memory_info);\n return(memory_info);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "spnego_gss_import_sec_context(\n\tOM_uint32\t\t*minor_status,\n\tconst gss_buffer_t\tinterprocess_token,\n\tgss_ctx_id_t\t\t*context_handle)\n{\n\t/*\n\t * Until we implement partial context exports, there are no SPNEGO\n\t * exported context tokens, only tokens for underlying mechs. So just\n\t * return an error for now.\n\t */\n\treturn GSS_S_UNAVAILABLE;\n}", "label": 1, "label_name": "safe"} -{"code": " def self.destroy_by_user(user_id, add_con=nil)\n\n SqlHelper.validate_token([user_id])\n\n con = \"user_id=#{user_id}\"\n con << \" and (#{add_con})\" unless add_con.nil? or add_con.empty?\n emails = Email.where(con).to_a\n\n emails.each do |email|\n email.destroy\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": " public function getName()\n {\n return 'ajax';\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic function formatItem( Article $article, $pageText = null ) {\n\t\t$item = '';\n\n\t\tif ( $pageText !== null ) {\n\t\t\t//Include parsed/processed wiki markup content after each item before the closing tag.\n\t\t\t$item .= $pageText;\n\t\t}\n\n\t\t$item = $this->getItemStart() . $item . $this->getItemEnd();\n\n\t\t$item = $this->replaceTagParameters( $item, $article );\n\n\t\treturn $item;\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": "def test_get_delete_dataobj(test_app, client: FlaskClient, note_fixture):\n response = client.get(\"/dataobj/delete/1\")\n assert response.status_code == 302", "label": 0, "label_name": "vulnerable"} -{"code": "Ga),!0,null,!0);var Ha=document.createElement(\"div\");Ha.className=\"geTempDlgDialogMask\";Q.appendChild(Ha);var Na=b.sidebar.hideTooltip;b.sidebar.hideTooltip=function(){Ha&&(Q.removeChild(Ha),Ha=null,Na.apply(this,arguments),b.sidebar.hideTooltip=Na)};mxEvent.addListener(Ha,\"click\",function(){b.sidebar.hideTooltip()})}}var qa=null;if(Ca||b.sidebar.currentElt==ca)b.sidebar.hideTooltip();else{var oa=function(na){Ca&&b.sidebar.currentElt==ca&&ma(na,mxEvent.getClientX(ja),mxEvent.getClientY(ja));Ca=!1;", "label": 0, "label_name": "vulnerable"} -{"code": " private def impersonateImpl(anyUserId: Opt[PatId], viewAsOnly: Bo,\n request: DebikiRequest[_]): p_Result = {\n\n // To view as another user, the session id should be amended so it includes info like:\n // \"We originally logged in as Nnn and now we're viewing as Nnn2.\" And pages should be shown\n // only if _both_ Nnn and Nnn2 may view them. \u2014 Not yet implemented, only view-as-stranger\n // supported right now.\n dieIf(anyUserId.isDefined && viewAsOnly, \"EdE6WKT0S\")\n\n val sidAndXsrfCookies = anyUserId.toList flatMap { userId =>\n createSessionIdAndXsrfToken(request.siteId, userId)._3\n }\n\n val logoutCookie =\n if (anyUserId.isEmpty) Seq(DiscardingSessionCookie)\n else Nil\n\n val impCookie = makeImpersonationCookie(request.siteId, viewAsOnly, request.theUserId)\n val newCookies = impCookie :: sidAndXsrfCookies\n\n request.dao.pubSub.unsubscribeUser(request.siteId, request.theRequester)\n\n // But don't subscribe to events for the user we'll be viewing the site as. Real\n // time events isn't the purpose of view-site-as. The client should resubscribe\n // the requester to hens *own* notfs, once done impersonating, though.\n\n Ok.withCookies(newCookies: _*).discardingCookies(logoutCookie: _*)\n }\n\n\n private def makeImpersonationCookie(siteId: SiteId, viewAsGroupOnly: Boolean,", "label": 0, "label_name": "vulnerable"} -{"code": " def add(self, image_id, image_file, image_size, connection=None):\n location = self.create_location(image_id)\n if not connection:\n connection = self.get_connection(location)\n\n self._create_container_if_missing(location.container, connection)\n\n LOG.debug(_(\"Adding image object '%(obj_name)s' \"\n \"to Swift\") % dict(obj_name=location.obj))\n try:\n if image_size > 0 and image_size < self.large_object_size:\n # Image size is known, and is less than large_object_size.\n # Send to Swift with regular PUT.\n obj_etag = connection.put_object(location.container,\n location.obj, image_file,\n content_length=image_size)\n else:\n # Write the image into Swift in chunks.\n chunk_id = 1\n if image_size > 0:\n total_chunks = str(int(\n math.ceil(float(image_size) /\n float(self.large_object_chunk_size))))\n else:\n # image_size == 0 is when we don't know the size\n # of the image. This can occur with older clients\n # that don't inspect the payload size.\n LOG.debug(_(\"Cannot determine image size. Adding as a \"\n \"segmented object to Swift.\"))\n total_chunks = '?'\n\n checksum = hashlib.md5()\n combined_chunks_size = 0\n while True:\n chunk_size = self.large_object_chunk_size\n if image_size == 0:\n content_length = None\n else:\n left = image_size - combined_chunks_size\n if left == 0:\n break\n if chunk_size > left:\n chunk_size = left\n content_length = chunk_size\n\n chunk_name = \"%s-%05d\" % (location.obj, chunk_id)\n reader = ChunkReader(image_file, checksum, chunk_size)\n chunk_etag = connection.put_object(\n location.container, chunk_name, reader,\n content_length=content_length)\n bytes_read = reader.bytes_read\n msg = _(\"Wrote chunk %(chunk_name)s (%(chunk_id)d/\"\n \"%(total_chunks)s) of length %(bytes_read)d \"\n \"to Swift returning MD5 of content: \"\n \"%(chunk_etag)s\")\n LOG.debug(msg % locals())\n\n if bytes_read == 0:\n # Delete the last chunk, because it's of zero size.\n # This will happen if size == 0.\n LOG.debug(_(\"Deleting final zero-length chunk\"))\n connection.delete_object(location.container,\n chunk_name)\n break\n\n chunk_id += 1\n combined_chunks_size += bytes_read\n\n # In the case we have been given an unknown image size,\n # set the size to the total size of the combined chunks.\n if image_size == 0:\n image_size = combined_chunks_size\n\n # Now we write the object manifest and return the\n # manifest's etag...\n manifest = \"%s/%s\" % (location.container, location.obj)\n headers = {'ETag': hashlib.md5(\"\").hexdigest(),\n 'X-Object-Manifest': manifest}\n\n # The ETag returned for the manifest is actually the\n # MD5 hash of the concatenated checksums of the strings\n # of each chunk...so we ignore this result in favour of\n # the MD5 of the entire image file contents, so that\n # users can verify the image file contents accordingly\n connection.put_object(location.container, location.obj,\n None, headers=headers)\n obj_etag = checksum.hexdigest()\n\n # NOTE: We return the user and key here! Have to because\n # location is used by the API server to return the actual\n # image data. We *really* should consider NOT returning\n # the location attribute from GET /images/ and\n # GET /images/details\n\n return (location.get_uri(), image_size, obj_etag)\n except swiftclient.ClientException, e:\n if e.http_status == httplib.CONFLICT:\n raise exception.Duplicate(_(\"Swift already has an image at \"\n \"this location\"))\n msg = (_(\"Failed to add object to Swift.\\n\"\n \"Got error from Swift: %(e)s\") % locals())\n LOG.error(msg)\n raise glance.store.BackendException(msg)", "label": 1, "label_name": "safe"} -{"code": "Mocha.prototype.growl = function() {\n this.options.growl = true;\n return this;\n};", "label": 1, "label_name": "safe"} -{"code": "},!1)):s.prependTo(i).after('
    '+c.i18n(\"or\")+\"
    \")[0],c.dialog(i,{title:this.title+(u?\" - \"+c.escape(c.file(u[0]).name):\"\"),modal:!0,resizable:!1,destroyOnClose:!0}),m))}},elFinder.prototype.commands.view=function(){this.value=this.fm.viewType,this.alwaysEnabled=!0,this.updateOnSelect=!1,this.options={ui:\"viewbutton\"},this.getstate=function(){return 0},this.exec=function(){var e=this.fm.storage(\"view\",\"list\"==this.value?\"icons\":\"list\");this.fm.viewchange(),this.update(void 0,e)}}}(jQuery);", "label": 0, "label_name": "vulnerable"} -{"code": "TfLiteStatus ResizeOutputTensor(TfLiteContext* context,\n const TfLiteTensor* data,\n const TfLiteTensor* segment_ids,\n TfLiteTensor* output) {\n // Segment ids should be of same cardinality as first input dimension and they\n // should be increasing by at most 1, from 0 (e.g., [0, 0, 1, 2, 3] is valid)\n const int segment_id_size = segment_ids->dims->data[0];\n TF_LITE_ENSURE_EQ(context, segment_id_size, data->dims->data[0]);\n int previous_segment_id = -1;\n for (int i = 0; i < segment_id_size; i++) {\n const int current_segment_id = GetTensorData(segment_ids)[i];\n if (i == 0) {\n TF_LITE_ENSURE_EQ(context, current_segment_id, 0);\n } else {\n int delta = current_segment_id - previous_segment_id;\n TF_LITE_ENSURE(context, delta == 0 || delta == 1);\n }\n previous_segment_id = current_segment_id;\n }\n\n const int max_index = previous_segment_id;\n\n const int data_rank = NumDimensions(data);\n TfLiteIntArray* output_shape = TfLiteIntArrayCreate(NumDimensions(data));\n output_shape->data[0] = max_index + 1;\n for (int i = 1; i < data_rank; ++i) {\n output_shape->data[i] = data->dims->data[i];\n }\n return context->ResizeTensor(context, output, output_shape);\n}", "label": 1, "label_name": "safe"} -{"code": "static int muscle_list_files(sc_card_t *card, u8 *buf, size_t bufLen)\n{\n\tmuscle_private_t* priv = MUSCLE_DATA(card);\n\tmscfs_t *fs = priv->fs;\n\tint x;\n\tint count = 0;\n\n\tmscfs_check_cache(priv->fs);\n\n\tfor(x = 0; x < fs->cache.size; x++) {\n\t\tu8* oid= fs->cache.array[x].objectId.id;\n\t\tsc_debug(card->ctx, SC_LOG_DEBUG_NORMAL,\n\t\t\t\"FILE: %02X%02X%02X%02X\\n\",\n\t\t\toid[0],oid[1],oid[2],oid[3]);\n\t\tif(0 == memcmp(fs->currentPath, oid, 2)) {\n\t\t\tbuf[0] = oid[2];\n\t\t\tbuf[1] = oid[3];\n\t\t\tif(buf[0] == 0x00 && buf[1] == 0x00) continue; /* No directories/null names outside of root */\n\t\t\tbuf += 2;\n\t\t\tcount+=2;\n\t\t}\n\t}\n\treturn count;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,\n\t\t struct msghdr *msg, size_t len,\n\t\t int noblock, int flags, int *addr_len)\n{\n\tstruct ipv6_pinfo *np = inet6_sk(sk);\n\tstruct inet_sock *inet = inet_sk(sk);\n\tstruct sk_buff *skb;\n\tunsigned int ulen, copied;\n\tint peeked, off = 0;\n\tint err;\n\tint is_udplite = IS_UDPLITE(sk);\n\tint is_udp4;\n\tbool slow;\n\n\tif (addr_len)\n\t\t*addr_len = sizeof(struct sockaddr_in6);\n\n\tif (flags & MSG_ERRQUEUE)\n\t\treturn ipv6_recv_error(sk, msg, len);\n\n\tif (np->rxpmtu && np->rxopt.bits.rxpmtu)\n\t\treturn ipv6_recv_rxpmtu(sk, msg, len);\n\ntry_again:\n\tskb = __skb_recv_datagram(sk, flags | (noblock ? MSG_DONTWAIT : 0),\n\t\t\t\t &peeked, &off, &err);\n\tif (!skb)\n\t\tgoto out;\n\n\tulen = skb->len - sizeof(struct udphdr);\n\tcopied = len;\n\tif (copied > ulen)\n\t\tcopied = ulen;\n\telse if (copied < ulen)\n\t\tmsg->msg_flags |= MSG_TRUNC;\n\n\tis_udp4 = (skb->protocol == htons(ETH_P_IP));\n\n\t/*\n\t * If checksum is needed at all, try to do it while copying the\n\t * data. If the data is truncated, or if we only want a partial\n\t * coverage checksum (UDP-Lite), do it before the copy.\n\t */\n\n\tif (copied < ulen || UDP_SKB_CB(skb)->partial_cov) {\n\t\tif (udp_lib_checksum_complete(skb))\n\t\t\tgoto csum_copy_err;\n\t}\n\n\tif (skb_csum_unnecessary(skb))\n\t\terr = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),\n\t\t\t\t\t msg->msg_iov, copied);\n\telse {\n\t\terr = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov);\n\t\tif (err == -EINVAL)\n\t\t\tgoto csum_copy_err;\n\t}\n\tif (unlikely(err)) {\n\t\ttrace_kfree_skb(skb, udpv6_recvmsg);\n\t\tif (!peeked) {\n\t\t\tatomic_inc(&sk->sk_drops);\n\t\t\tif (is_udp4)\n\t\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\t\t UDP_MIB_INERRORS,\n\t\t\t\t\t\t is_udplite);\n\t\t\telse\n\t\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\t\t UDP_MIB_INERRORS,\n\t\t\t\t\t\t is_udplite);\n\t\t}\n\t\tgoto out_free;\n\t}\n\tif (!peeked) {\n\t\tif (is_udp4)\n\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INDATAGRAMS, is_udplite);\n\t\telse\n\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INDATAGRAMS, is_udplite);\n\t}\n\n\tsock_recv_ts_and_drops(msg, sk, skb);\n\n\t/* Copy the address. */\n\tif (msg->msg_name) {\n\t\tstruct sockaddr_in6 *sin6;\n\n\t\tsin6 = (struct sockaddr_in6 *) msg->msg_name;\n\t\tsin6->sin6_family = AF_INET6;\n\t\tsin6->sin6_port = udp_hdr(skb)->source;\n\t\tsin6->sin6_flowinfo = 0;\n\n\t\tif (is_udp4) {\n\t\t\tipv6_addr_set_v4mapped(ip_hdr(skb)->saddr,\n\t\t\t\t\t &sin6->sin6_addr);\n\t\t\tsin6->sin6_scope_id = 0;\n\t\t} else {\n\t\t\tsin6->sin6_addr = ipv6_hdr(skb)->saddr;\n\t\t\tsin6->sin6_scope_id =\n\t\t\t\tipv6_iface_scope_id(&sin6->sin6_addr,\n\t\t\t\t\t\t IP6CB(skb)->iif);\n\t\t}\n\n\t}\n\tif (is_udp4) {\n\t\tif (inet->cmsg_flags)\n\t\t\tip_cmsg_recv(msg, skb);\n\t} else {\n\t\tif (np->rxopt.all)\n\t\t\tip6_datagram_recv_ctl(sk, msg, skb);\n\t}\n\n\terr = copied;\n\tif (flags & MSG_TRUNC)\n\t\terr = ulen;\n\nout_free:\n\tskb_free_datagram_locked(sk, skb);\nout:\n\treturn err;\n\ncsum_copy_err:\n\tslow = lock_sock_fast(sk);\n\tif (!skb_kill_datagram(sk, skb, flags)) {\n\t\tif (is_udp4) {\n\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_CSUMERRORS, is_udplite);\n\t\t\tUDP_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INERRORS, is_udplite);\n\t\t} else {\n\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_CSUMERRORS, is_udplite);\n\t\t\tUDP6_INC_STATS_USER(sock_net(sk),\n\t\t\t\t\tUDP_MIB_INERRORS, is_udplite);\n\t\t}\n\t}\n\tunlock_sock_fast(sk, slow);\n\n\tif (noblock)\n\t\treturn -EAGAIN;\n\n\t/* starting over for a new packet */\n\tmsg->msg_flags &= ~MSG_TRUNC;\n\tgoto try_again;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "[];for(G=0;GarchiveSize += filesize($p);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {", "label": 0, "label_name": "vulnerable"} -{"code": " constructor(client, info, localChan) {\n super();\n\n this.type = 'session';\n this.subtype = undefined;\n this._ending = false;\n this._channel = undefined;\n this._chanInfo = {\n type: 'session',\n incoming: {\n id: localChan,\n window: MAX_WINDOW,\n packetSize: PACKET_SIZE,\n state: 'open'\n },\n outgoing: {\n id: info.sender,\n window: info.window,\n packetSize: info.packetSize,\n state: 'open'\n }\n };\n }", "label": 1, "label_name": "safe"} -{"code": "int main() {\n int selftest;\n\n MSPACK_SYS_SELFTEST(selftest);\n TEST(selftest == MSPACK_ERR_OK);\n\n kwajd_open_test_01();\n\n printf(\"ALL %d TESTS PASSED.\\n\", test_count);\n return 0;\n}", "label": 1, "label_name": "safe"} -{"code": "int ZlibInStream::overrun(int itemSize, int nItems, bool wait)\n{\n if (itemSize > bufSize)\n throw Exception(\"ZlibInStream overrun: max itemSize exceeded\");\n if (!underlying)\n throw Exception(\"ZlibInStream overrun: no underlying stream\");\n\n if (end - ptr != 0)\n memmove(start, ptr, end - ptr);\n\n offset += ptr - start;\n end -= ptr - start;\n ptr = start;\n\n while (end - ptr < itemSize) {\n if (!decompress(wait))\n return 0;\n }\n\n if (itemSize * nItems > end - ptr)\n nItems = (end - ptr) / itemSize;\n\n return nItems;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public void translate(ServerDifficultyPacket packet, GeyserSession session) {\n SetDifficultyPacket setDifficultyPacket = new SetDifficultyPacket();\n setDifficultyPacket.setDifficulty(packet.getDifficulty().ordinal());\n session.sendUpstreamPacket(setDifficultyPacket);\n\n session.getWorldCache().setDifficulty(packet.getDifficulty());\n }", "label": 0, "label_name": "vulnerable"} -{"code": " def test___post_init__(self):\n from openapi_python_client.parser.properties import StringProperty\n\n sp = StringProperty(name=\"test\", required=True, default=\"A Default Value\",)\n\n assert sp.default == '\"A Default Value\"'", "label": 0, "label_name": "vulnerable"} -{"code": "function test($serialized) {\n $ret = null;\n var_dump(\n fb_unserialize(\n $serialized,\n inout $ret,\n FB_SERIALIZE_HACK_ARRAYS\n )\n );\n var_dump($ret);\n}", "label": 1, "label_name": "safe"} -{"code": "fn main() -> std::io::Result<()> {\n env::set_var(\"RUST_LOG\", \"swhks=trace\");\n env_logger::init();\n\n let pid_file_path = String::from(\"/tmp/swhks.pid\");\n let sock_file_path = String::from(\"/tmp/swhkd.sock\");\n\n if Path::new(&pid_file_path).exists() {\n log::trace!(\"Reading {} file and checking for running instances.\", pid_file_path);\n let swhkd_pid = match fs::read_to_string(&pid_file_path) {\n Ok(swhkd_pid) => swhkd_pid,\n Err(e) => {\n log::error!(\"Unable to read {} to check all running instances\", e);\n exit(1);\n }\n };\n log::debug!(\"Previous PID: {}\", swhkd_pid);\n\n let mut sys = System::new_all();\n sys.refresh_all();\n for (pid, process) in sys.processes() {\n if pid.to_string() == swhkd_pid && process.exe() == env::current_exe().unwrap() {\n log::error!(\"Server is already running!\");\n exit(1);\n }\n }\n }\n\n if Path::new(&sock_file_path).exists() {\n log::trace!(\"Sockfile exists, attempting to remove it.\");\n match fs::remove_file(&sock_file_path) {\n Ok(_) => {\n log::debug!(\"Removed old socket file\");\n }\n Err(e) => {\n log::error!(\"Error removing the socket file!: {}\", e);\n log::error!(\"You can manually remove the socket file: {}\", sock_file_path);\n exit(1);\n }\n };\n }\n\n match fs::write(&pid_file_path, id().to_string()) {\n Ok(_) => {}\n Err(e) => {\n log::error!(\"Unable to write to {}: {}\", pid_file_path, e);\n exit(1);\n }\n }\n\n let listener = UnixListener::bind(sock_file_path)?;\n loop {\n match listener.accept() {\n Ok((mut socket, address)) => {\n let mut response = String::new();\n socket.read_to_string(&mut response)?;\n run_system_command(&response);\n log::debug!(\"Socket: {:?} Address: {:?} Response: {}\", socket, address, response);\n }\n Err(e) => log::error!(\"accept function failed: {:?}\", e),\n }\n }\n}", "label": 0, "label_name": "vulnerable"} -{"code": "document.createElement(\"link\");N.setAttribute(\"rel\",\"preload\");N.setAttribute(\"href\",T);N.setAttribute(\"as\",\"font\");N.setAttribute(\"crossorigin\",\"\");E.parentNode.insertBefore(N,E)}}}};Editor.trimCssUrl=function(u){return u.replace(RegExp(\"^[\\\\s\\\"']+\",\"g\"),\"\").replace(RegExp(\"[\\\\s\\\"']+$\",\"g\"),\"\")};Editor.GOOGLE_FONTS=\"https://fonts.googleapis.com/css?family=\";Editor.GUID_ALPHABET=\"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_\";Editor.GUID_LENGTH=20;Editor.guid=function(u){u=null!=", "label": 0, "label_name": "vulnerable"} -{"code": " $arcs['create']['application/x-rar'] = array('cmd' => ELFINDER_RAR_PATH, 'argc' => 'a -inul' . (defined('ELFINDER_RAR_MA4') && ELFINDER_RAR_MA4? ' -ma4' : '') . ' --', 'ext' => 'rar');", "label": 1, "label_name": "safe"} -{"code": "\tpublic function execute()\n\t{\n\t\t// if not in debug-mode we should include the minified versions\n\t\tif(!SPOON_DEBUG && SpoonFile::exists(BACKEND_CORE_PATH . '/js/minified.js'))\n\t\t{\n\t\t\t// include the minified JS-file\n\t\t\t$this->header->addJS('minified.js', 'core', false);\n\t\t}\n\n\t\t// in debug-mode or minified files don't exist\n\t\telse\n\t\t{\n\t\t\t// add jquery, we will need this in every action, so add it globally\n\t\t\t$this->header->addJS('jquery/jquery.js', 'core');\n\t\t\t$this->header->addJS('jquery/jquery.ui.js', 'core');\n\t\t\t$this->header->addJS('jquery/jquery.ui.dialog.patch.js', 'core');\n\t\t\t$this->header->addJS('jquery/jquery.tools.js', 'core');\n\t\t\t$this->header->addJS('jquery/jquery.backend.js', 'core');\n\t\t}\n\n\t\t// add items that always need to be loaded\n\t\t$this->header->addJS('utils.js', 'core', true);\n\t\t$this->header->addJS('backend.js', 'core', true);\n\n\t\t// add module js\n\t\tif(SpoonFile::exists(BACKEND_MODULE_PATH . '/js/' . $this->getModule() . '.js'))\n\t\t{\n\t\t\t$this->header->addJS($this->getModule() . '.js', null, true);\n\t\t}\n\n\t\t// add action js\n\t\tif(SpoonFile::exists(BACKEND_MODULE_PATH . '/js/' . $this->getAction() . '.js'))\n\t\t{\n\t\t\t$this->header->addJS($this->getAction() . '.js', null, true);\n\t\t}\n\n\t\t// if not in debug-mode we should include the minified version\n\t\tif(!SPOON_DEBUG && SpoonFile::exists(BACKEND_CORE_PATH . '/layout/css/minified.css'))\n\t\t{\n\t\t\t$this->header->addCSS('minified.css', 'core');\n\t\t}\n\n\t\t// debug-mode or minified file does not exist\n\t\telse\n\t\t{\n\t\t\t$this->header->addCSS('reset.css', 'core');\n\t\t\t$this->header->addCSS('jquery_ui/fork/jquery_ui.css', 'core');\n\t\t\t$this->header->addCSS('debug.css', 'core');\n\t\t\t$this->header->addCSS('screen.css', 'core');\n\t\t}\n\n\t\t// add module specific css\n\t\tif(SpoonFile::exists(BACKEND_MODULE_PATH . '/layout/css/' . $this->getModule() . '.css'))\n\t\t{\n\t\t\t$this->header->addCSS($this->getModule() . '.css', null);\n\t\t}\n\n\t\t// store var so we don't have to call this function twice\n\t\t$var = $this->getParameter('var', 'array');\n\n\t\t// is there a report to show?\n\t\tif($this->getParameter('report') !== null)\n\t\t{\n\t\t\t// show the report\n\t\t\t$this->tpl->assign('report', true);\n\n\t\t\t// camelcase the string\n\t\t\t$messageName = SpoonFilter::toCamelCase(SpoonFilter::stripHTML($this->getParameter('report')), '-');\n\n\t\t\t// if we have data to use it will be passed as the var parameter\n\t\t\tif(!empty($var)) $this->tpl->assign('reportMessage', vsprintf(BL::msg($messageName), $var));\n\t\t\telse $this->tpl->assign('reportMessage', BL::msg($messageName));\n\n\t\t\t// highlight an element with the given id if needed\n\t\t\tif($this->getParameter('highlight')) $this->tpl->assign('highlight', SpoonFilter::stripHTML($this->getParameter('highlight')));\n\t\t}\n\n\t\t// is there an error to show?\n\t\tif($this->getParameter('error') !== null)\n\t\t{\n\t\t\t// camelcase the string\n\t\t\t$errorName = SpoonFilter::toCamelCase(SpoonFilter::stripHTML($this->getParameter('error')), '-');\n\n\t\t\t// if we have data to use it will be passed as the var parameter\n\t\t\tif(!empty($var)) $this->tpl->assign('errorMessage', vsprintf(BL::err($errorName), $var));\n\t\t\telse $this->tpl->assign('errorMessage', BL::err($errorName));\n\t\t}\n\t}", "label": 1, "label_name": "safe"} -{"code": " public function tearDown()\n {\n foreach ($this->cleanup as $file) {\n if (is_scalar($file) && file_exists($file)) {\n unlink($file);\n }\n }\n }", "label": 1, "label_name": "safe"} -{"code": " public Optional convert(Object object, Class targetType, ConversionContext context) {\n CorsOriginConfiguration configuration = new CorsOriginConfiguration();\n if (object instanceof Map) {\n Map mapConfig = (Map) object;\n ConvertibleValues convertibleValues = new ConvertibleValuesMap<>(mapConfig);\n\n convertibleValues\n .get(ALLOWED_ORIGINS, ConversionContext.LIST_OF_STRING)\n .ifPresent(configuration::setAllowedOrigins);\n\n convertibleValues\n .get(ALLOWED_METHODS, CONVERSION_CONTEXT_LIST_OF_HTTP_METHOD)\n .ifPresent(configuration::setAllowedMethods);\n\n convertibleValues\n .get(ALLOWED_HEADERS, ConversionContext.LIST_OF_STRING)\n .ifPresent(configuration::setAllowedHeaders);\n\n convertibleValues\n .get(EXPOSED_HEADERS, ConversionContext.LIST_OF_STRING)\n .ifPresent(configuration::setExposedHeaders);\n\n convertibleValues\n .get(ALLOW_CREDENTIALS, ConversionContext.BOOLEAN)\n .ifPresent(configuration::setAllowCredentials);\n\n convertibleValues\n .get(MAX_AGE, ConversionContext.LONG)\n .ifPresent(configuration::setMaxAge);\n }\n return Optional.of(configuration);\n }", "label": 1, "label_name": "safe"} -{"code": "[H];!u(H)&&!d(H)||D(H)||x.traverse(H,!0,function(U,Q){var W=null!=Q&&x.isTreeEdge(Q);W&&0>mxUtils.indexOf(S,Q)&&S.push(Q);(null==Q||W)&&0>mxUtils.indexOf(S,U)&&S.push(U);return null==Q||W});return S};var G=mxVertexHandler.prototype.init;mxVertexHandler.prototype.init=function(){G.apply(this,arguments);(u(this.state.cell)||d(this.state.cell))&&!D(this.state.cell)&&0this.state.width?10:0)+2+\"px\",this.moveHandle.style.top=this.state.y+this.state.height+(40>this.state.height?10:0)+2+\"px\")};var J=mxVertexHandler.prototype.setHandlesVisible;mxVertexHandler.prototype.setHandlesVisible=function(H){J.apply(this,", "label": 0, "label_name": "vulnerable"} -{"code": "b,e){b=this.jobs[b];b.state=a.activeFilter.checkFeature(this)?b.refresh.call(this,a,e):i;return b.state},getContext:function(a){return a.contains(this.context)}}})();(function(){function s(e){function g(b){for(var f=d.startContainer,a=d.endContainer;f&&!f.getParent().equals(b);)f=f.getParent();for(;a&&!a.getParent().equals(b);)a=a.getParent();if(!f||!a)return!1;for(var h=f,f=[],c=!1;!c;)h.equals(a)&&(c=!0),f.push(h),h=h.getNext();if(1>f.length)return!1;h=b.getParents(!0);for(a=0;a :absent}\n @property_hash[:ensure] = :absent if @property_hash.empty?\n end\n @property_hash.dup\n end", "label": 0, "label_name": "vulnerable"} -{"code": "TfLiteStatus PrepareHashtableSize(TfLiteContext* context, TfLiteNode* node) {\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n\n const TfLiteTensor* input_resource_id_tensor =\n GetInput(context, node, kInputResourceIdTensor);\n TF_LITE_ENSURE_EQ(context, input_resource_id_tensor->type, kTfLiteInt32);\n TF_LITE_ENSURE_EQ(context, NumDimensions(input_resource_id_tensor), 1);\n TF_LITE_ENSURE_EQ(context, SizeOfDimension(input_resource_id_tensor, 0), 1);\n\n TfLiteTensor* output_tensor = GetOutput(context, node, kOutputTensor);\n TF_LITE_ENSURE(context, output_tensor != nullptr);\n TF_LITE_ENSURE_EQ(context, output_tensor->type, kTfLiteInt64);\n TfLiteIntArray* outputSize = TfLiteIntArrayCreate(1);\n outputSize->data[0] = 1;\n return context->ResizeTensor(context, output_tensor, outputSize);\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public void existingDocumentFromUITemplateProviderSpecifiedNonTerminalOverridenFromUIToTerminal() throws Exception\n {\n // current document = xwiki:Main.WebHome\n DocumentReference documentReference = new DocumentReference(\"xwiki\", Arrays.asList(\"Main\"), \"WebHome\");\n XWikiDocument document = mock(XWikiDocument.class);\n when(document.getDocumentReference()).thenReturn(documentReference);\n when(document.isNew()).thenReturn(false);\n when(document.getLocalReferenceMaxLength()).thenReturn(255);\n context.setDoc(document);\n\n // Submit from the UI spaceReference=X&name=Y&templateProvider=XWiki.MyTemplateProvider\n String templateProviderFullName = \"XWiki.MyTemplateProvider\";\n String spaceReferenceString = \"X\";\n when(mockRequest.getParameter(\"spaceReference\")).thenReturn(spaceReferenceString);\n when(mockRequest.getParameter(\"name\")).thenReturn(\"Y\");\n when(mockRequest.getParameter(\"templateprovider\")).thenReturn(templateProviderFullName);\n when(mockRequest.getParameter(\"tocreate\")).thenReturn(\"terminal\");\n\n // Mock 1 existing template provider that creates terminal documents.\n mockExistingTemplateProviders(templateProviderFullName,\n new DocumentReference(\"xwiki\", Arrays.asList(\"XWiki\"), \"MyTemplateProvider\"), Collections.EMPTY_LIST,\n false);\n\n // Run the action\n String result = action.render(context);\n\n // The tests are below this line!\n\n // Verify null is returned (this means the response has been returned)\n assertNull(result);\n\n // Note: We are creating the document X.Y as terminal, even if the template provider says otherwise.\n // Also using a template, as specified in the template provider.\n verify(mockURLFactory).createURL(\"X\", \"Y\", \"edit\", \"template=XWiki.MyTemplate&parent=Main.WebHome&title=Y\",\n null, \"xwiki\", context);\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp)\n{\n\tint *fdp = (int*)CMSG_DATA(cmsg);\n\tstruct scm_fp_list *fpl = *fplp;\n\tstruct file **fpp;\n\tint i, num;\n\n\tnum = (cmsg->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr)))/sizeof(int);\n\n\tif (num <= 0)\n\t\treturn 0;\n\n\tif (num > SCM_MAX_FD)\n\t\treturn -EINVAL;\n\n\tif (!fpl)\n\t{\n\t\tfpl = kmalloc(sizeof(struct scm_fp_list), GFP_KERNEL);\n\t\tif (!fpl)\n\t\t\treturn -ENOMEM;\n\t\t*fplp = fpl;\n\t\tfpl->count = 0;\n\t\tfpl->max = SCM_MAX_FD;\n\t\tfpl->user = NULL;\n\t}\n\tfpp = &fpl->fp[fpl->count];\n\n\tif (fpl->count + num > fpl->max)\n\t\treturn -EINVAL;\n\n\t/*\n\t *\tVerify the descriptors and increment the usage count.\n\t */\n\n\tfor (i=0; i< num; i++)\n\t{\n\t\tint fd = fdp[i];\n\t\tstruct file *file;\n\n\t\tif (fd < 0 || !(file = fget_raw(fd)))\n\t\t\treturn -EBADF;\n\t\t*fpp++ = file;\n\t\tfpl->count++;\n\t}\n\n\tif (!fpl->user)\n\t\tfpl->user = get_uid(current_user());\n\n\treturn num;\n}", "label": 1, "label_name": "safe"} +{"code": " public function testCompilePathIsProperlyCreated()\n {\n $compiler = new BladeCompiler($this->getFiles(), __DIR__);\n $this->assertEquals(__DIR__.'/'.sha1('foo').'.php', $compiler->getCompiledPath('foo'));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " it \"should be able to count arrays\" do\n expect(scope.function_count([[\"1\",\"2\",\"3\"]])).to(eq(3))\n end", "label": 0, "label_name": "vulnerable"} +{"code": " def prepare_context(self, request, context, *args, **kwargs):\n \"\"\" Hook for adding additional data to the context dict \"\"\"\n pass", "label": 0, "label_name": "vulnerable"} +{"code": " public function store($zdb)\n {\n try {\n $values = array(\n self::PK => $this->id,\n 'model_fields' => serialize($this->fields)\n );\n\n if (!isset($this->id) || $this->id == '') {\n //we're inserting a new model\n unset($values[self::PK]);\n $this->creation_date = date(\"Y-m-d H:i:s\");\n $values['model_creation_date'] = $this->creation_date;\n\n $insert = $zdb->insert(self::TABLE);\n $insert->values($values);\n $results = $zdb->execute($insert);\n\n if ($results->count() > 0) {\n return true;\n } else {\n throw new \\Exception(\n 'An error occurred inserting new import model!'\n );\n }\n } else {\n //we're editing an existing model\n $update = $zdb->update(self::TABLE);\n $update->set($values);\n $update->where(self::PK . '=' . $this->id);\n $zdb->execute($update);\n return true;\n }\n } catch (Throwable $e) {\n Analog::log(\n 'Something went wrong storing import model :\\'( | ' .\n $e->getMessage() . \"\\n\" . $e->getTraceAsString(),\n Analog::ERROR\n );\n throw $e;\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static int xfrm_dump_policy(struct sk_buff *skb, struct netlink_callback *cb)\n{\n\tstruct net *net = sock_net(skb->sk);\n\tstruct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1];\n\tstruct xfrm_dump_info info;\n\n\tBUILD_BUG_ON(sizeof(struct xfrm_policy_walk) >\n\t\t sizeof(cb->args) - sizeof(cb->args[0]));\n\n\tinfo.in_skb = cb->skb;\n\tinfo.out_skb = skb;\n\tinfo.nlmsg_seq = cb->nlh->nlmsg_seq;\n\tinfo.nlmsg_flags = NLM_F_MULTI;\n\n\tif (!cb->args[0]) {\n\t\tcb->args[0] = 1;\n\t\txfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY);\n\t}\n\n\t(void) xfrm_policy_walk(net, walk, dump_one_policy, &info);\n\n\treturn skb->len;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " function oneTimeListener(value, old, scope) {\n lastValue = value;\n if (isFunction(listener)) {\n listener(value, old, scope);\n }\n if (isDefined(value)) {\n scope.$$postDigest(function() {\n if (isDefined(lastValue)) {\n unwatch();\n }\n });\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": " self::rpc($p);\r\n //echo \"'$p'
    \";\r\n }\r\n }\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": "spnego_gss_inquire_context(\n\t\t\tOM_uint32\t*minor_status,\n\t\t\tconst gss_ctx_id_t context_handle,\n\t\t\tgss_name_t\t*src_name,\n\t\t\tgss_name_t\t*targ_name,\n\t\t\tOM_uint32\t*lifetime_rec,\n\t\t\tgss_OID\t\t*mech_type,\n\t\t\tOM_uint32\t*ctx_flags,\n\t\t\tint\t\t*locally_initiated,\n\t\t\tint\t\t*opened)\n{\n\tOM_uint32 ret = GSS_S_COMPLETE;\n\n\tret = gss_inquire_context(minor_status,\n\t\t\t\tcontext_handle,\n\t\t\t\tsrc_name,\n\t\t\t\ttarg_name,\n\t\t\t\tlifetime_rec,\n\t\t\t\tmech_type,\n\t\t\t\tctx_flags,\n\t\t\t\tlocally_initiated,\n\t\t\t\topened);\n\n\treturn (ret);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "X){null!=X.shortcut&&900>n&&!mxClient.IS_IOS?O.firstChild.nextSibling.setAttribute(\"title\",X.shortcut):m.apply(this,arguments)};var q=App.prototype.updateUserElement;App.prototype.updateUserElement=function(){q.apply(this,arguments);if(null!=this.userElement){var O=this.userElement;O.style.cssText=\"position:relative;margin-right:4px;cursor:pointer;display:\"+O.style.display;O.className=\"geToolbarButton\";O.innerHTML=\"\";O.style.backgroundImage=\"url(\"+Editor.userImage+\")\";O.style.backgroundPosition=\"center center\";\nO.style.backgroundRepeat=\"no-repeat\";O.style.backgroundSize=\"24px 24px\";O.style.height=\"24px\";O.style.width=\"24px\";O.style.cssFloat=\"right\";O.setAttribute(\"title\",mxResources.get(\"changeUser\"));if(\"none\"!=O.style.display){O.style.display=\"inline-block\";var X=this.getCurrentFile();if(null!=X&&X.isRealtimeEnabled()&&X.isRealtimeSupported()){var ea=document.createElement(\"img\");ea.setAttribute(\"border\",\"0\");ea.style.position=\"absolute\";ea.style.left=\"18px\";ea.style.top=\"2px\";ea.style.width=\"12px\";ea.style.height=\n\"12px\";var ka=X.getRealtimeError();X=X.getRealtimeState();var ja=mxResources.get(\"realtimeCollaboration\");1==X?(ea.src=Editor.syncImage,ja+=\" (\"+mxResources.get(\"online\")+\")\"):(ea.src=Editor.syncProblemImage,ja=null!=ka&&null!=ka.message?ja+(\" (\"+ka.message+\")\"):ja+(\" (\"+mxResources.get(\"disconnected\")+\")\"));ea.setAttribute(\"title\",ja);O.style.paddingRight=\"4px\";O.appendChild(ea)}}}};var y=App.prototype.updateButtonContainer;App.prototype.updateButtonContainer=function(){y.apply(this,arguments);if(null!=", "label": 1, "label_name": "safe"} +{"code": " public function __construct()\n {\n parent::__construct();\n if ($GLOBALS['HTMLPurifierTest']['PH5P']) {\n require_once 'HTMLPurifier/Lexer/PH5P.php';\n }\n }", "label": 1, "label_name": "safe"} +{"code": " function __construct () {\r\n\r\n }\r", "label": 0, "label_name": "vulnerable"} +{"code": "function _showSelectDialog(title, label, options, button, callbackFcn, callbackArg, defaultValue) {\n var dialog = dialogs[title+label];\n if (dialog) {\n $(\"bgDialogDiv\").show();\n }\n else {\n var fields = createElement(\"p\", null, []);\n\tfields.update(label);\n var select = createElement(\"select\"); //, null, null, { cname: name } );\n\tfields.appendChild(select);\n var values = $H(options).keys();\n for (var i = 0; i < values.length; i++) {\n var option = createElement(\"option\", null, null,\n { value: values[i] }, null, select);\n option.update(options[values[i]]);\n }\n fields.appendChild(createElement(\"br\"));\n\n fields.appendChild(createButton(null,\n button,\n callbackFcn.bind(select, callbackArg)));\n\tfields.appendChild(createButton(null,\n _(\"Cancel\"),\n disposeDialog));\n dialog = createDialog(null,\n title,\n null,\n fields,\n \"none\");\n document.body.appendChild(dialog);\n dialogs[title+label] = dialog;\n }\n if (defaultValue)\n\tdefaultOption = dialog.down('option[value=\"'+defaultValue+'\"]').selected = true;\n if (Prototype.Browser.IE)\n jQuery('#bgDialogDiv').css('opacity', 0.4);\n jQuery(dialog).fadeIn('fast');\n}", "label": 1, "label_name": "safe"} +{"code": " return !isset($thisstaff) || $f->isRequiredForStaff();\n };\n if (!$form->isValid($filter))\n $valid = false;\n\n //Make sure the email is not in-use\n if (($field=$form->getField('email'))\n && $field->getClean()\n && User::lookup(array('emails__address'=>$field->getClean()))) {\n $field->addError(__('Email is assigned to another user'));\n $valid = false;\n }\n\n return $valid ? self::fromVars($form->getClean(), $create) : null;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "function buildURL (source, reqBase) {\n const dest = new URL(source, reqBase)\n\n // if base is specified, source url should not override it\n if (reqBase && !reqBase.startsWith(dest.origin)) {\n throw new Error('source must be a relative path string')\n }\n\n return dest\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\tprivate function _ordercollation( $option ) {\n\t\t$option = mb_strtolower( $option );\n\n\t\t$results = $this->DB->query( 'SHOW CHARACTER SET' );\n\t\tif ( !$results ) {\n\t\t\treturn false;\n\t\t}\n\n\t\twhile ( $row = $results->fetchRow() ) {\n\t\t\tif ( $option == $row['Default collation'] ) {\n\t\t\t\t$this->setCollation( $option );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}", "label": 1, "label_name": "safe"} +{"code": " labels: templateInstance.topTasks.get().map((task) => $('').text(task._id).html()),\n datasets: [{\n values: templateInstance.topTasks.get().map((task) => task.count),\n }],\n },\n tooltipOptions: {\n },\n })\n })\n })\n }", "label": 1, "label_name": "safe"} +{"code": " def self.get_for(user, mail_account_id, xtype)\n\n return nil if user.nil? or mail_account_id.blank?\n\n if user.kind_of?(User)\n user_id = user.id\n else\n user_id = user.to_s\n end\n\n SqlHelper.validate_token([user_id, mail_account_id, xtype])\n\n con = []\n con << \"(user_id=#{user_id})\"\n con << \"(mail_account_id=#{mail_account_id})\"\n con << \"(xtype='#{xtype}')\"\n\n return MailFolder.where(con.join(' and ')).first\n end", "label": 0, "label_name": "vulnerable"} +{"code": "function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {\n\tfor ( var i = 0, l = checkSet.length; i < l; i++ ) {\n\t\tvar elem = checkSet[i];\n\t\tif ( elem ) {\n\t\t\telem = elem[dir];\n\t\t\tvar match = false;\n\n\t\t\twhile ( elem && elem.nodeType ) {\n\t\t\t\tvar done = elem[doneName];\n\t\t\t\tif ( done ) {\n\t\t\t\t\tmatch = checkSet[ done ];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif ( elem.nodeType === 1 && !isXML )\n\t\t\t\t\telem[doneName] = i;\n\n\t\t\t\tif ( elem.nodeName === cur ) {\n\t\t\t\t\tmatch = elem;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\telem = elem[dir];\n\t\t\t}\n\n\t\t\tcheckSet[i] = match;\n\t\t}\n\t}\n}", "label": 0, "label_name": "vulnerable"} +{"code": "void kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr)\n{\n\tvcpu->arch.apic->vapic_addr = vapic_addr;\n\tif (vapic_addr)\n\t\t__set_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention);\n\telse\n\t\t__clear_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention);\n}", "label": 0, "label_name": "vulnerable"} +{"code": "R_API RBinJavaAttrInfo *r_bin_java_synthetic_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut64 offset = 0;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\toffset += 6;\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_SYNTHETIC_ATTR;\n\tattr->size = offset;\n\treturn attr;\n}", "label": 0, "label_name": "vulnerable"} +{"code": " function searchName() {\n return gt(\"Calendar Event\");\n }", "label": 1, "label_name": "safe"} +{"code": "\tpublic function delete_version() {\n\t if (empty($this->params['id'])) {\n\t flash('error', gt('The version you are trying to delete could not be found'));\n\t }\n\n\t // get the version\n\t $version = new help_version($this->params['id']);\n\t if (empty($version->id)) {\n\t flash('error', gt('The version you are trying to delete could not be found'));\n\t }\n\n\t // if we have errors than lets get outta here!\n\t if (!expQueue::isQueueEmpty('error')) expHistory::back();\n\n\t // delete the version\n\t $version->delete();\n\n\t expSession::un_set('help-version');\n\n\t flash('message', gt('Deleted version').' '.$version->version.' '.gt('and all documents in that version.'));\n\t expHistory::back();\n\t}", "label": 1, "label_name": "safe"} +{"code": " public function validateChildren($children, $config, $context)\n {\n // Flag for subclasses\n $this->whitespace = false;\n\n // if there are no tokens, delete parent node\n if (empty($children)) {\n return false;\n }\n\n // the new set of children\n $result = array();\n\n // whether or not parsed character data is allowed\n // this controls whether or not we silently drop a tag\n // or generate escaped HTML from it\n $pcdata_allowed = isset($this->elements['#PCDATA']);\n\n // a little sanity check to make sure it's not ALL whitespace\n $all_whitespace = true;\n\n $stack = array_reverse($children);\n while (!empty($stack)) {\n $node = array_pop($stack);\n if (!empty($node->is_whitespace)) {\n $result[] = $node;\n continue;\n }\n $all_whitespace = false; // phew, we're not talking about whitespace\n\n if (!isset($this->elements[$node->name])) {\n // special case text\n // XXX One of these ought to be redundant or something\n if ($pcdata_allowed && $node instanceof HTMLPurifier_Node_Text) {\n $result[] = $node;\n continue;\n }\n // spill the child contents in\n // ToDo: Make configurable\n if ($node instanceof HTMLPurifier_Node_Element) {\n for ($i = count($node->children) - 1; $i >= 0; $i--) {\n $stack[] = $node->children[$i];\n }\n continue;\n }\n continue;\n }\n $result[] = $node;\n }\n if (empty($result)) {\n return false;\n }\n if ($all_whitespace) {\n $this->whitespace = true;\n return false;\n }\n return $result;\n }", "label": 1, "label_name": "safe"} +{"code": " it 'should run successfully' do\n\n pp = \"\n class { 'nginx':\n mail => true,\n }\n nginx::resource::vhost { 'www.puppetlabs.com':\n ensure => present,\n www_root => '/var/www/www.puppetlabs.com',\n }\n nginx::resource::mailhost { 'domain1.example':\n ensure => present,\n auth_http => 'localhost/cgi-bin/auth',\n protocol => 'smtp',\n listen_port => 587,\n ssl_port => 465,\n xclient => 'off',\n }\n \"\n\n puppet_apply(pp) do |r|\n [0,2].should include r.exit_code\n r.refresh\n # Not until deprecated variables fixed.\n #r.stderr.should be_empty\n r.exit_code.should be_zero\n end\n end", "label": 0, "label_name": "vulnerable"} +{"code": "function(){return mxClient.IS_CHROMEAPP||this.useCanvasForExport};Editor.prototype.getMaxCanvasScale=function(p,C,I){var T=mxClient.IS_FF?8192:16384;return Math.min(I,Math.min(T/p,T/C))};Editor.prototype.exportToCanvas=function(p,C,I,T,P,O,R,Y,da,ha,Z,ea,aa,ua,la,Aa,Fa,xa){try{O=null!=O?O:!0;R=null!=R?R:!0;ea=null!=ea?ea:this.graph;aa=null!=aa?aa:0;var Da=da?null:ea.background;Da==mxConstants.NONE&&(Da=null);null==Da&&(Da=T);null==Da&&0==da&&(Da=Aa?this.graph.defaultPageBackgroundColor:\"#ffffff\");", "label": 0, "label_name": "vulnerable"} +{"code": "printlabels(grammar *g, FILE *fp)\n{\n label *l;\n int i;\n\n fprintf(fp, \"static label labels[%d] = {\\n\", g->g_ll.ll_nlabels);\n l = g->g_ll.ll_label;\n for (i = g->g_ll.ll_nlabels; --i >= 0; l++) {\n if (l->lb_str == NULL)\n fprintf(fp, \" {%d, 0},\\n\", l->lb_type);\n else\n fprintf(fp, \" {%d, \\\"%s\\\"},\\n\",\n l->lb_type, l->lb_str);\n }\n fprintf(fp, \"};\\n\");\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testGetCauseMessage()\n {\n $cause = new Exception('foo bar');\n $e = new PEAR_Exception('I caught an exception', $cause);\n\n $e->getCauseMessage($causes);\n $this->assertEquals('I caught an exception', $causes[0]['message']);\n $this->assertEquals('foo bar', $causes[1]['message']);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " $edges = array_merge($edges, $this->findEdges($id, $argument, $required, $name));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " it 'should contain the default swapfile' do\n shell('/sbin/swapon -s | grep /mnt/swap.1', :acceptable_exit_codes => [0])\n end", "label": 0, "label_name": "vulnerable"} +{"code": "void ConnectionImpl::onHeaderValue(const char* data, size_t length) {\n if (header_parsing_state_ == HeaderParsingState::Done) {\n // Ignore trailers.\n return;\n }\n\n const absl::string_view header_value = absl::string_view(data, length);\n\n if (strict_header_validation_) {\n if (!Http::HeaderUtility::headerIsValid(header_value)) {\n ENVOY_CONN_LOG(debug, \"invalid header value: {}\", connection_, header_value);\n error_code_ = Http::Code::BadRequest;\n sendProtocolError();\n throw CodecProtocolException(\"http/1.1 protocol error: header value contains invalid chars\");\n }\n } else if (header_value.find('\\0') != absl::string_view::npos) {\n // http-parser should filter for this\n // (https://tools.ietf.org/html/rfc7230#section-3.2.6), but it doesn't today. HeaderStrings\n // have an invariant that they must not contain embedded zero characters\n // (NUL, ASCII 0x0).\n throw CodecProtocolException(\"http/1.1 protocol error: header value contains NUL\");\n }\n\n header_parsing_state_ = HeaderParsingState::Value;\n current_header_value_.append(data, length);\n\n const uint32_t total =\n current_header_field_.size() + current_header_value_.size() + current_header_map_->byteSize();\n if (total > (max_request_headers_kb_ * 1024)) {\n error_code_ = Http::Code::RequestHeaderFieldsTooLarge;\n sendProtocolError();\n throw CodecProtocolException(\"headers size exceeds limit\");\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": "ast2obj_withitem(void* _o)\n{\n withitem_ty o = (withitem_ty)_o;\n PyObject *result = NULL, *value = NULL;\n if (!o) {\n Py_INCREF(Py_None);\n return Py_None;\n }\n\n result = PyType_GenericNew(withitem_type, NULL, NULL);\n if (!result) return NULL;\n value = ast2obj_expr(o->context_expr);\n if (!value) goto failed;\n if (_PyObject_SetAttrId(result, &PyId_context_expr, value) == -1)\n goto failed;\n Py_DECREF(value);\n value = ast2obj_expr(o->optional_vars);\n if (!value) goto failed;\n if (_PyObject_SetAttrId(result, &PyId_optional_vars, value) == -1)\n goto failed;\n Py_DECREF(value);\n return result;\nfailed:\n Py_XDECREF(value);\n Py_XDECREF(result);\n return NULL;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "Na+=\"@import url(\"+La+\");\\n\":Ga+='@font-face {\\nfont-family: \"'+Ea+'\";\\nsrc: url(\"'+La+'\");\\n}\\n'}Ha.appendChild(Aa.createTextNode(Na+Ga));qa.getElementsByTagName(\"defs\")[0].appendChild(Ha)}null!=ja&&(this.shapeBackgroundColor=Da,this.shapeForegroundColor=Ba,this.stylesheet=ja,this.refresh());return qa};var C=Graph.prototype.createSvgImageExport;Graph.prototype.createSvgImageExport=function(){var u=C.apply(this,arguments);if(this.mathEnabled){var D=u.drawText;u.drawText=function(K,T){if(null!=K.text&&\nnull!=K.text.value&&K.text.checkBounds()&&(mxUtils.isNode(K.text.value)||K.text.dialect==mxConstants.DIALECT_STRICTHTML)){var N=K.text.getContentNode();if(null!=N){N=N.cloneNode(!0);if(N.getElementsByTagNameNS)for(var Q=N.getElementsByTagNameNS(\"http://www.w3.org/1998/Math/MathML\",\"math\");0getDefinition('URI', $raw, $optimized);\n }", "label": 1, "label_name": "safe"} +{"code": " def index\n valid_http_methods :get, :post\n\n # for permission check\n if params[:package] and not [\"_repository\", \"_jobhistory\"].include?(params[:package])\n pkg = DbPackage.get_by_project_and_name( params[:project], params[:package], use_source=false )\n else\n prj = DbProject.get_by_name params[:project]\n end\n\n if request.get?\n pass_to_backend \n return\n end\n\n if @http_user.is_admin?\n # check for a local package instance\n DbPackage.get_by_project_and_name( params[:project], params[:package], follow_project_links=false )\n pass_to_backend\n else\n render_error :status => 403, :errorcode => \"execute_cmd_no_permission\",\n :message => \"Upload of binaries is only permitted for administrators\"\n end\n end", "label": 1, "label_name": "safe"} +{"code": " public function __construct(array $params, array $uploads, $useBrackets = true)\n {\n $this->_params = self::_flattenArray('', $params, $useBrackets);\n foreach ($uploads as $fieldName => $f) {\n if (!is_array($f['fp'])) {\n $this->_uploads[] = $f + array('name' => $fieldName);\n } else {\n for ($i = 0; $i < count($f['fp']); $i++) {\n $upload = array(\n 'name' => ($useBrackets? $fieldName . '[' . $i . ']': $fieldName)\n );\n foreach (array('fp', 'filename', 'size', 'type') as $key) {\n $upload[$key] = $f[$key][$i];\n }\n $this->_uploads[] = $upload;\n }\n }\n }\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\"startWidth\",this.defaultArrowWidth)};Ca.prototype.getEndArrowWidth=function(){return this.getEdgeWidth()+mxUtils.getNumber(this.style,\"endWidth\",this.defaultArrowWidth)};Ca.prototype.getEdgeWidth=function(){return mxUtils.getNumber(this.style,\"width\",this.defaultWidth)+Math.max(0,this.strokewidth-1)};mxCellRenderer.registerShape(\"flexArrow\",Ca);mxUtils.extend(Qa,mxActor);Qa.prototype.size=30;Qa.prototype.isRoundable=function(){return!0};Qa.prototype.redrawPath=function(c,l,x,p,v){l=Math.min(v,parseFloat(mxUtils.getValue(this.style,", "label": 1, "label_name": "safe"} +{"code": "\tpublic int decryptWithAd(byte[] ad, byte[] ciphertext,\n\t\t\tint ciphertextOffset, byte[] plaintext, int plaintextOffset,\n\t\t\tint length) throws ShortBufferException, BadPaddingException {\n\t\tint space;\n\t\tif (ciphertextOffset > ciphertext.length)\n\t\t\tspace = 0;\n\t\telse\n\t\t\tspace = ciphertext.length - ciphertextOffset;\n\t\tif (length > space)\n\t\t\tthrow new ShortBufferException();\n\t\tif (plaintextOffset > plaintext.length)\n\t\t\tspace = 0;\n\t\telse\n\t\t\tspace = plaintext.length - plaintextOffset;\n\t\tif (!haskey) {\n\t\t\t// The key is not set yet - return the ciphertext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(ciphertext, ciphertextOffset, plaintext, plaintextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (length < 16)\n\t\t\tNoise.throwBadTagException();\n\t\tint dataLen = length - 16;\n\t\tif (dataLen > space)\n\t\t\tthrow new ShortBufferException();\n\t\tsetup(ad);\n\t\tghash.update(ciphertext, ciphertextOffset, dataLen);\n\t\tghash.pad(ad != null ? ad.length : 0, dataLen);\n\t\tghash.finish(enciv, 0, 16);\n\t\tint temp = 0;\n\t\tfor (int index = 0; index < 16; ++index)\n\t\t\ttemp |= (hashKey[index] ^ enciv[index] ^ ciphertext[ciphertextOffset + dataLen + index]);\n\t\tif ((temp & 0xFF) != 0)\n\t\t\tNoise.throwBadTagException();\n\t\tencryptCTR(ciphertext, ciphertextOffset, plaintext, plaintextOffset, dataLen);\n\t\treturn dataLen;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": " public function addChild(Profile $child)\n {\n $this->children[] = $child;\n $child->setParent($this);\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function testTransformToForbiddenElement()\n {\n $this->config->set('HTML.Allowed', 'div');\n $this->assertResult(\n 'Big Warning!',\n 'Big Warning!'\n );\n }", "label": 1, "label_name": "safe"} +{"code": " public function save_change_password() {\n global $user;\n\n $isuser = ($this->params['uid'] == $user->id) ? 1 : 0;\n\n if (!$user->isAdmin() && !$isuser) {\n flash('error', gt('You do not have permissions to change this users password.'));\n expHistory::back();\n }\n\n if (($isuser && empty($this->params['password'])) || (!empty($this->params['password']) && $user->password != user::encryptPassword($this->params['password']))) {\n flash('error', gt('The current password you entered is not correct.'));\n expHistory::returnTo('editable');\n }\n //eDebug($user);\n $u = new user($this->params['uid']);\n\n $ret = $u->setPassword($this->params['new_password1'], $this->params['new_password2']);\n //eDebug($u, true);\n if (is_string($ret)) {\n flash('error', $ret);\n expHistory::returnTo('editable');\n } else {\n $params = array();\n $params['is_admin'] = !empty($u->is_admin);\n $params['is_acting_admin'] = !empty($u->is_acting_admin);\n $u->update($params);\n }\n\n if (!$isuser) {\n flash('message', gt('The password for') . ' ' . $u->username . ' ' . gt('has been changed.'));\n } else {\n $user->password = $u->password;\n flash('message', gt('Your password has been changed.'));\n }\n expHistory::back();\n }", "label": 0, "label_name": "vulnerable"} +{"code": "Runnable.prototype.fullTitle = function() {\n return this.parent.fullTitle() + ' ' + this.title;\n};", "label": 1, "label_name": "safe"} +{"code": "chunk_new_with_alloc_size(size_t alloc)\n{\n chunk_t *ch;\n ch = tor_malloc(alloc);\n ch->next = NULL;\n ch->datalen = 0;\n#ifdef DEBUG_CHUNK_ALLOC\n ch->DBG_alloc = alloc;\n#endif\n ch->memlen = CHUNK_SIZE_WITH_ALLOC(alloc);\n total_bytes_allocated_in_chunks += alloc;\n ch->data = &ch->mem[0];\n CHUNK_SET_SENTINEL(ch, alloc);\n return ch;\n}", "label": 1, "label_name": "safe"} +{"code": " def api_login_allow_multiple_providers(self):\n return self.appbuilder.get_app.config[\"AUTH_API_LOGIN_ALLOW_MULTIPLE_PROVIDERS\"]", "label": 1, "label_name": "safe"} +{"code": "void ecall_find_range_bounds(uint8_t *sort_order, size_t sort_order_length,\n uint32_t num_partitions,\n uint8_t *input_rows, size_t input_rows_length,\n uint8_t **output_rows, size_t *output_rows_length) {\n // Guard against operating on arbitrary enclave memory\n assert(sgx_is_outside_enclave(input_rows, input_rows_length) == 1);\n sgx_lfence();\n\n try {\n find_range_bounds(sort_order, sort_order_length,\n num_partitions,\n input_rows, input_rows_length,\n output_rows, output_rows_length);\n } catch (const std::runtime_error &e) {\n ocall_throw(e.what());\n }\n}", "label": 1, "label_name": "safe"} +{"code": "ProcessTCPHeader(tTcpIpPacketParsingResult _res, PVOID pIpHeader, ULONG len, USHORT ipHeaderSize)\n{\n ULONG tcpipDataAt;\n tTcpIpPacketParsingResult res = _res;\n tcpipDataAt = ipHeaderSize + sizeof(TCPHeader);\n res.TcpUdp = ppresIsTCP;\n\n if (len >= tcpipDataAt)\n {\n TCPHeader *pTcpHeader = (TCPHeader *)RtlOffsetToPointer(pIpHeader, ipHeaderSize);\n res.xxpStatus = ppresXxpKnown;\n res.xxpFull = TRUE;\n tcpipDataAt = ipHeaderSize + TCP_HEADER_LENGTH(pTcpHeader);\n res.XxpIpHeaderSize = tcpipDataAt;\n }\n else\n {\n DPrintf(2, (\"tcp: %d < min headers %d\\n\", len, tcpipDataAt));\n res.xxpFull = FALSE;\n res.xxpStatus = ppresXxpIncomplete;\n }\n return res;\n}", "label": 1, "label_name": "safe"} +{"code": "PHP_FUNCTION(imagesetstyle)\n{\n\tzval *IM, *styles;\n\tgdImagePtr im;\n\tint * stylearr;\n\tint index;\n\tHashPosition pos;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"ra\", &IM, &styles) == FAILURE) {\n\t\treturn;\n\t}\n\n\tZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, \"Image\", le_gd);\n\n\t/* copy the style values in the stylearr */\n\tstylearr = safe_emalloc(sizeof(int), zend_hash_num_elements(HASH_OF(styles)), 0);\n\n\tzend_hash_internal_pointer_reset_ex(HASH_OF(styles), &pos);\n\n\tfor (index = 0;; zend_hash_move_forward_ex(HASH_OF(styles), &pos))\t{\n\t\tzval ** item;\n\n\t\tif (zend_hash_get_current_data_ex(HASH_OF(styles), (void **) &item, &pos) == FAILURE) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconvert_to_long_ex(item);\n\n\t\tstylearr[index++] = Z_LVAL_PP(item);\n\t}\n\n\tgdImageSetStyle(im, stylearr, index);\n\n\tefree(stylearr);\n\n\tRETURN_TRUE;\n}", "label": 0, "label_name": "vulnerable"} +{"code": "\tpublic function isAllowedFilename($filename){\n\t\t$allow_array = array(\n\t\t\t'.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp',\n\t\t\t'.mp3','.wav','.mp4',\n\t\t\t'.mov','.webmv','.flac','.mkv',\n\t\t\t'.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso',\n\t\t\t'.pdf','.ofd','.swf','.epub','.xps',\n\t\t\t'.doc','.docx','.wps',\n\t\t\t'.ppt','.pptx','.xls','.xlsx','.txt','.psd','.csv',\n\t\t\t'.cer','.ppt','.pub','.json','.css',\n\t\t\t) ;\n\n\t\t$ext = strtolower(substr($filename,strripos($filename,'.')) ); //\u83b7\u53d6\u6587\u4ef6\u6269\u5c55\u540d\uff08\u8f6c\u4e3a\u5c0f\u5199\u540e\uff09\n\t\tif(in_array( $ext , $allow_array ) ){\n\t\t\treturn true ;\n\t\t}\n\t\treturn false;\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "\tfunction edit_vendor() {\n\t\t$vendor = new vendor();\n\t\t\n\t\tif(isset($this->params['id'])) {\n\t\t\t$vendor = $vendor->find('first', 'id =' .$this->params['id']);\n\t\t\tassign_to_template(array(\n 'vendor'=>$vendor\n ));\n\t\t}\n\t}", "label": 0, "label_name": "vulnerable"} +{"code": "b,c)))return d;return null},A=function(a,b,c,e,d){if(c){for(var g=0,f;f=a[g];g++){if(f.id==c)return a.splice(g,0,b),b;if(e&&f[e]&&(f=A(f[e],b,c,e,!0)))return f}if(d)return null}a.push(b);return b},B=function(a,b,c){for(var e=0,d;d=a[e];e++){if(d.id==b)return a.splice(e,1);if(c&&d[c]&&(d=B(d[c],b,c)))return d}return null},L=function(a,b){this.dialog=a;for(var c=b.contents,e=0,d;d=c[e];e++)c[e]=d&&new I(a,d);CKEDITOR.tools.extend(this,b)};L.prototype={getContents:function(a){return z(this.contents,", "label": 1, "label_name": "safe"} +{"code": " public function getPath()\n {\n return $this->path;\n }", "label": 0, "label_name": "vulnerable"} +{"code": " function categoryBreadcrumb() {\n// global $db, $router;\n\n //eDebug($this->category);\n\n /*if(isset($router->params['action']))\n {\n $ancestors = $this->category->pathToNode(); \n }else if(isset($router->params['section']))\n {\n $current = $db->selectObject('section',' id= '.$router->params['section']);\n $ancestors[] = $current;\n if( $current->parent != -1 || $current->parent != 0 )\n { \n while ($db->selectObject('section',' id= '.$router->params['section']);)\n if ($section->id == $id) {\n $current = $section;\n break;\n }\n }\n }\n eDebug($sections);\n $ancestors = $this->category->pathToNode(); \n }*/\n\n $ancestors = $this->category->pathToNode();\n // eDebug($ancestors);\n assign_to_template(array(\n 'ancestors' => $ancestors\n ));\n }", "label": 0, "label_name": "vulnerable"} +{"code": " public function isMethodSafe()\n {\n return in_array($this->getMethod(), array('GET', 'HEAD', 'OPTIONS', 'TRACE'));\n }", "label": 1, "label_name": "safe"} +{"code": " public function testInterleaved()\n {\n $this->assertResult(\n 'foobarbaz',\n 'foobarbaz'\n );\n }", "label": 1, "label_name": "safe"} +{"code": "function usercheck_callback_p(data) {\r\n var response = (data == 1);\r\n\r\n var obj = document.getElementById('ajax_output_1');\r\n obj.style.color = (response) ? '#008800' : '#ff0000';\r\n obj.innerHTML = (response == 1) ? 'Username Available' : 'Username already taken';\r\n\r\n var staff_username = document.getElementById(\"USERNAME\").value;\r\n var staff_username_flag = document.getElementById(\"staff_username_flag\").value;\r\n\r\n if(staff_username != '' && staff_username_flag == '0')\r\n {\r\n var obj = document.getElementById('ajax_output_1');\r\n obj.style.color = '#ff0000';\r\n obj.innerHTML = 'Username can only contain letters, numbers, underscores, at the rate and dots';\r\n\r\n window.$(\"#mod_staff_btn\").attr(\"disabled\", true);\r\n }\r\n else\r\n {\r\n window.$(\"#mod_staff_btn\").attr(\"disabled\", false);\r\n }\r\n}\r", "label": 1, "label_name": "safe"} +{"code": "L.length)n();else{var F=L[M];StorageFile.getFileContent(this,F,mxUtils.bind(this,function(G){null==G||\".scratchpad\"==F&&G==this.emptyLibraryXml?x.contentWindow.postMessage(JSON.stringify({action:\"remoteInvoke\",funtionName:\"getLocalStorageFile\",functionArgs:[F]}),\"*\"):y()}),y)}}catch(G){console.log(G)}}),B=mxUtils.bind(this,function(F){try{this.setDatabaseItem(null,[{title:F.title,size:F.data.length,lastModified:Date.now(),type:F.isLib?\"L\":\"F\"},{title:F.title,data:F.data}],y,y,[\"filesInfo\",\"files\"])}catch(G){console.log(G)}});", "label": 0, "label_name": "vulnerable"} +{"code": "void CSecurityTLS::shutdown(bool needbye)\n{\n if (session && needbye)\n if (gnutls_bye(session, GNUTLS_SHUT_RDWR) != GNUTLS_E_SUCCESS)\n vlog.error(\"gnutls_bye failed\");\n\n if (anon_cred) {\n gnutls_anon_free_client_credentials(anon_cred);\n anon_cred = 0;\n }\n\n if (cert_cred) {\n gnutls_certificate_free_credentials(cert_cred);\n cert_cred = 0;\n }\n\n if (session) {\n gnutls_deinit(session);\n session = 0;\n\n gnutls_global_deinit();\n }\n}", "label": 0, "label_name": "vulnerable"} +{"code": " public function testShouldSaveMasterRequestSession()\n {\n $this->sessionHasBeenStarted();\n $this->sessionMustBeSaved();\n\n $this->filterResponse(new Request());\n }", "label": 0, "label_name": "vulnerable"} +{"code": "\t\tpublic function transferPage()\n\t\t{\n\t\t\t//FIXME Put Import code in here. \n\t\t}", "label": 0, "label_name": "vulnerable"} +{"code": " it 'should not contain docroot ' do\n is_expected.not_to contain_file(params[:docroot])\n end", "label": 0, "label_name": "vulnerable"} +{"code": " changePassword: function(newPassword) {\n var d = $q.defer(),\n loginCookie = readLoginCookie();\n\n $http({\n method: 'POST',\n url: '/SOGo/so/changePassword',\n data: {\n userName: loginCookie[0],\n password: loginCookie[1],\n newPassword: newPassword }\n }).then(d.resolve, function(response) {\n var error,\n data = response.data,\n perr = data.LDAPPasswordPolicyError;\n\n if (!perr) {\n perr = passwordPolicyConfig.PolicyPasswordSystemUnknown;\n error = _(\"Unhandled error response\");\n }\n else if (perr == passwordPolicyConfig.PolicyNoError) {\n error = l(\"Password change failed\");\n } else if (perr == passwordPolicyConfig.PolicyPasswordModNotAllowed) {\n error = l(\"Password change failed - Permission denied\");\n } else if (perr == passwordPolicyConfig.PolicyInsufficientPasswordQuality) {\n error = l(\"Password change failed - Insufficient password quality\");\n } else if (perr == passwordPolicyConfig.PolicyPasswordTooShort) {\n error = l(\"Password change failed - Password is too short\");\n } else if (perr == passwordPolicyConfig.PolicyPasswordTooYoung) {\n error = l(\"Password change failed - Password is too young\");\n } else if (perr == passwordPolicyConfig.PolicyPasswordInHistory) {\n error = l(\"Password change failed - Password is in history\");\n } else {\n error = l(\"Unhandled policy error: %{0}\").formatted(perr);\n perr = passwordPolicyConfig.PolicyPasswordUnknown;\n }\n\n d.reject(error);\n });\n return d.promise;\n }", "label": 0, "label_name": "vulnerable"} +{"code": "static int atalk_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,\n\t\t\t size_t size, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct ddpehdr *ddp;\n\tint copied = 0;\n\tint offset = 0;\n\tint err = 0;\n\tstruct sk_buff *skb;\n\n\tskb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,\n\t\t\t\t\t\tflags & MSG_DONTWAIT, &err);\n\tlock_sock(sk);\n\n\tif (!skb)\n\t\tgoto out;\n\n\t/* FIXME: use skb->cb to be able to use shared skbs */\n\tddp = ddp_hdr(skb);\n\tcopied = ntohs(ddp->deh_len_hops) & 1023;\n\n\tif (sk->sk_type != SOCK_RAW) {\n\t\toffset = sizeof(*ddp);\n\t\tcopied -= offset;\n\t}\n\n\tif (copied > size) {\n\t\tcopied = size;\n\t\tmsg->msg_flags |= MSG_TRUNC;\n\t}\n\terr = skb_copy_datagram_iovec(skb, offset, msg->msg_iov, copied);\n\n\tif (!err && msg->msg_name) {\n\t\tstruct sockaddr_at *sat = msg->msg_name;\n\t\tsat->sat_family = AF_APPLETALK;\n\t\tsat->sat_port = ddp->deh_sport;\n\t\tsat->sat_addr.s_node = ddp->deh_snode;\n\t\tsat->sat_addr.s_net = ddp->deh_snet;\n\t\tmsg->msg_namelen = sizeof(*sat);\n\t}\n\n\tskb_free_datagram(sk, skb);\t/* Free the datagram. */\n\nout:\n\trelease_sock(sk);\n\treturn err ? : copied;\n}", "label": 1, "label_name": "safe"} +{"code": " isExpOperator: function(ch) {\n return (ch === '-' || ch === '+' || this.isNumber(ch));\n },", "label": 0, "label_name": "vulnerable"} +{"code": "var CommentsWindow=function(b,e,f,c,m,n){function v(){for(var K=O.getElementsByTagName(\"div\"),F=0,H=0;HassertResult(\n '