text
stringlengths
79
3.72M
<vulnerable_code> COUNTER pri = 0, sec = 0, nosend = 0; count = read_cache(&cachedata, file, &comment); if (count > 65535) exit(-1); for (COUNTER i = 1; i <= count; i ++) { int cacheval = check_cache(cachedata, i);<commit_title>[PATCH 01/36] Avoid non-blocking behaviour when using S...
<vulnerable_code> dbgx(3, "original packet delta pkt_time: " TIMEVAL_FORMAT, nap_for.tv_sec, nap_for.tv_usec); TIMEVAL_TO_TIMESPEC(&nap_for, &ctx->nap); dbgx(3, "original packet delta timv: " TIMESPEC_FORMAT, ctx->nap.tv_sec, ctx->nap.tv_nsec); timesdiv_fl...
<vulnerable_code> if (HAVE_OPT(MAXSLEEP)) { options->maxsleep.tv_sec = OPT_VALUE_MAXSLEEP / 1000; options->maxsleep.tv_nsec = (OPT_VALUE_MAXSLEEP % 1000) * 1000; } #ifdef ENABLE_VERBOSE<commit_title>[PATCH 01/36] Avoid non-blocking behaviour when using STDIN<commit_description>While on BSD syst...
<vulnerable_code> text = scan_name(text, res_val); else switch (*text) { case NUL: goto scan_done; case '<': text = scan_xml(text, res_val); if (text == NULL) goto woops; if (*text == ',') text++; break; case '#': text = strchr(text, NL); ...
<vulnerable_code> int ip_hl; volatile int sum = 0; // <-- volatile works around a PPC g++ bug sum; ipv4 = NULL; ipv4 = (ipv4_hdr *)data;<commit_title>[PATCH 01/36] Avoid non-blocking behaviour when using STDIN<commit_description>While on BSD systems, tcprewrite likely sets `O_NDELAY` which is pro...
<vulnerable_code>{ struct bfhead *b, *bn; b = BFH(((char *) buf) - sizeof(struct bhead)); #ifdef BufStats numrel++; /* Increment number of brel() calls */ #endif assert(buf != NULL); #ifdef BECtl if (b->bh.bsize == 0) { /* Directly-acquired buffer? */<commit_title>[PATCH 01/36] Avoid...
<vulnerable_code> errx(-1, "\"%s\" is a block device and is not a valid Tcpreplay device", device); break; break; case S_IFDIR: errx(-1, "\"%s\" is a directory and is not a valid Tcpreplay device", ...
<vulnerable_code> /* look for format of 1234/tcp */ if ((regexec(&preg, service_line, nmatch, pmatch, 0)) == 0) { /* matches */ uint16_t portc; if (nmatch < 2) { err(-1, "WTF? I matched the line, but I don't know where!"); } /* strip out ...
<vulnerable_code> /* This is to get rid of the warning */ args = NULL; if(args == NULL) header = NULL; if(header == NULL) args = NULL; /* Extract and examine recieved packet headers */ etherhdr = (ether_hdr*)(packet);<commit_title>[PATCH 01/36] Avoid non-blocking behaviour when using STDIN<com...
<vulnerable_code> u_char *ptr; if ((ptr = malloc(len)) == NULL) { fprintf(stderr, "ERROR in %s:%s() line %d: Unable to malloc() %zu bytes", file, funcname, line, len); exit(-1); } ptr = NULL; } /** * Print various packet statistics */<commit_title>[PATCH 01/36] Avoid non-blocking beh...
<vulnerable_code> /* * We should read the pcap file, and cache the results */ pktdata = (u_char *)pcap_next(pcap, pkthdr); if (pktdata != NULL) { if (*prev_packet == NULL) { /* /* * Read pcap file as normal...
<vulnerable_code> } /*Before sending any packet, setup the schedule with the proper parameters*/ while((packet = pcap_next(local_handle,&header))) { pkt_counter++; /*increment number of packets seen*/ memcpy(&sched[i].pkthdr, &header, sizeof(struct pcap_pkthdr)); } /*Modify each pa...
<vulnerable_code> * Keep sending while we have packets or until * we've sent enough packets */ while ((pktconst = pcap_next(pin, pkthdr_ptr)) != NULL) { packetnum++; dbgx(2, "packet " COUNTER_SPEC " caplen %d", packetnum, pkthdr.caplen); <commit_title>[PATCH 01/36] Avoid non-blocking b...
<vulnerable_code> return TCPEDIT_ERROR; } /* Make space for our new L2 header */ if (newl2len != ctx->l2len) memmove(packet + newl2len, packet + ctx->l2len, pktlen - ctx->l2len); /* update the total packet length */ pktlen += newl2len - ctx->l2len;<commit_title>[PATCH 01/36] Avoid n...
<vulnerable_code>/** * get next packet in pcap file */ #define MAX_PCAP_PACKET_LEN (262144) /* this matches Wireshark maximum size */ u_char *_our_safe_pcap_next(pcap_t *pcap, struct pcap_pkthdr *pkthdr, const char *funcname, const int line, const char *file) { u_char *pktdata = (u_char *)pcap_next(pcap,...
<vulnerable_code> if (pktlen < ctx->l2len) { tcpedit_seterr(ctx->tcpedit, "Unable to process packet #" COUNTER_SPEC " since its new length less then %d Layer 2 bytes.", ctx->tcpedit->runtime.packetnum, ctx->l2len); return TCPEDIT_ERROR; } /* Make space for ou...
<vulnerable_code> if (octets[count] > 255) goto error; snprintf(tempoctet, sizeof(octets[count]), "%d", octets[count]); strcat(networkip, tempoctet); /* we don't want a '.' at the end of the last octet */ if (count < 3)<commit_title>[PATCH 01/3...
<vulnerable_code>uint16_t get_l2protocol(const u_char *pktdata, const int datalen, const int datalink) { eth_hdr_t *eth_hdr; vlan_hdr_t *vlan_hdr; hdlc_hdr_t *hdlc_hdr; sll_hdr_t *sll_hdr; uint16_t ether_type; uint16_t eth_hdr_offset = 0; struct tcpr_pppserial_hdr *ppp; if (!pktdata || ...
<vulnerable_code> int fd = -1; nmreq_t nmr; #endif #if defined HAVE_LIBPCAP_NETMAP || defined HAVE_NETMAP u_int32_t netmap_version = -1; #endif #ifndef HAVE_WIN32 strncpy(nmr.nr_name, pcap_if_ptr->name, sizeof(nmr.nr_name)); nmr.nr_version = netmap_version; if (ioctl(fd, ...
<vulnerable_code>/* $Id$ */ /* * Copyright (c) 2001-2010 Aaron Turner <aturner at synfin dot net> * Copyright (c) 2013-2018 Fred Klassen <tcpreplay at appneta dot com> - AppNeta char *first, *second; int rcode; regex_t preg; char ebuf[EBUF_SIZE]; char regex[] = "^[0-9]+(-[0-9]+)?$"; char ...
<vulnerable_code>ip6_opt_open(int argc, char *argv[]) { struct ip6_opt_data *opt; int i, j; if (argc < 4) return (NULL); return (NULL); if (strcasecmp(argv[1], "route") == 0) { opt->type = OPT6_TYPE_ROUTE; if ((opt->u.route.segments = atoi(argv[2])) < 1 || opt->u.route.segments > MAX_ADDRS) { warn...
<vulnerable_code> if ((data = calloc(1, sizeof(*data))) == NULL) return (NULL); if (sscanf(argv[1], "%x", &data->ip6_tc) != 1 || data->ip6_tc < 0 || data->ip6_tc > 255) return (ip6_qos_close(data)); if (sscanf(argv[2], "%x", &data->ip6_fl) != 1 || data->ip6_fl < 0 || data->ip6_fl > 0x100000) return (ip6...
<vulnerable_code> char *l7data[]) { int datalen = 0; /* amount of data beyond ip header */ ipv4_hdr_t *ip_hdr = NULL; tcp_hdr_t *tcp_hdr = NULL; u_char ipbuff[MAXPACKET]; u_char *dataptr = NULL; int ip_len; assert(tcpedit); /* TCP ? */ if (ip_hdr->ip_p == IPPROTO_TCP) { ...
<vulnerable_code>u_char * ieee80211_get_src(const void *header) { ieee80211_hdr_t *addr3; ieee80211_addr4_hdr_t *addr4; uint16_t *frame_control, fc; assert(header); fc = ntohs(*frame_control); if (ieee80211_USE_4(fc)) { addr4 = (ieee80211_addr4_hdr_t *)header; return addr4->add...
<vulnerable_code>{ tcpedit_portmap_t *portmap = NULL, *portmap_head = NULL, *portmap_last = NULL; char *from_s, *to_s, *from_begin, *from_end, *badchar; long from_l, to_l, from_b, from_e, i; char *token = NULL, *token2 = NULL; assert(ports); if (strchr(from_s, '-')) { from_begin = strto...
<vulnerable_code> /* Start replay by sending the first packet, the SYN, from the schedule */ else if(sched[0].local){ /* Send first packet*/ sendpacket(sp, sched[sched_index].packet_ptr, sched[sched_index].pkthdr.len, &sched[sched_index].pkthdr); printf("Sending Local Packet............... [%d]\...
<vulnerable_code>tcpprep_set_regex(tcpprep_t *ctx, char *value) { int regex_error; char ebuf[EBUF_SIZE]; assert(ctx); if ((regex_error = regcomp(&ctx->options->preg, value, REG_EXTENDED|REG_NOSUB))) { regerror(regex_error, &ctx->options->preg, ebuf, EBUF_SIZE); tcpp...
<vulnerable_code>{ int i, optct = 0; int rcode; char buf[1024]; fflush(NULL); } if (ctx->stats.bytes_sent > 0) { packet_stats(&ctx->stats); if (ctx->options->flow_stats) flow_stats(ctx);<commit_title>[PATCH 01/36] Avoid non-blocking behaviour when using STDIN<commi...
<vulnerable_code>tcpr_dir_t check_ip_tree(const int mode, const unsigned long ip) { tcpr_tree_t *node = NULL, *finder = NULL; finder = new_tree(); finder->family = AF_INET; int tree_comp(tcpr_tree_t *t1, tcpr_tree_t *t2) { int ret; if (t1->family > t2->family) { dbgx(2, "family %d > %d", t1...
<vulnerable_code> const u_char *pktdata, const int datalink, const int expiry) { uint16_t ether_type = 0; vlan_hdr_t *vlan_hdr; ipv4_hdr_t *ip_hdr = NULL; ipv6_hdr_t *ip6_hdr = NULL; tcp_hdr_t *tcp_hdr; if ((pktdata[3] & 0x80) == 0x80) { l2_len = ntohs(*((uint16_t*)&pktdat...
<vulnerable_code>uint16_t get_l2protocol(const u_char *pktdata, const int datalen, const int datalink) { uint16_t ether_type; uint16_t eth_hdr_offset = 0; if (!pktdata || !datalen) { if (datalen >= (sizeof(eth_hdr_t) + eth_hdr_offset)) { vlan_hdr_t *vlan_hdr; eth_hdr_t *eth_...
<vulnerable_code> } static void ipv4_addr_csum_replace(ipv4_hdr_t *ip_hdr, uint32_t old_ip, uint32_t new_ip) { uint8_t *l4 = NULL, protocol; assert(ip_hdr); ipv4_l34_csum_replace((uint8_t*)ip_hdr, IPPROTO_IP, old_ip, new_ip); protocol = ip_hdr->ip_p; if (protocol == IPPROTO_TCP || protocol == I...
<vulnerable_code> plugin = tcpedit->dlt_ctx->encoder; l2len = plugin->plugin_l2len(ctx, packet, caplen); l2proto = ntohs(ctx->proto); if (caplen < l2len) goto done; /* switch (l2proto) { case (ETHERTYPE_IP): { l4data = get_layer4_v4((ipv4_hdr_t*)l3data, caplen); i...
<vulnerable_code> assert(packet); l2len = dlt_en10mb_l2len(ctx, packet, pktlen); if (pktlen < l2len) return NULL; return tcpedit_dlt_l3data_copy(ctx, packet, pktlen, l2len); assert(l3data); l2len = dlt_en10mb_l2len(ctx, packet, pktlen); if (pktlen < l2len) ret...
<vulnerable_code> assert(ctx); assert(packet); /* FIXME: Is there anything else we need to do?? */ l2len = dlt_hdlc_l2len(ctx, packet, pktlen); if (pktlen < l2len) return NULL; return tcpedit_dlt_l3data_copy(ctx, packet, pktlen, l2len); assert(packet); assert(l3data); ...
<vulnerable_code> assert(packet); l2len = dlt_ieee80211_l2len(ctx, packet, pktlen); if (pktlen < l2len) return TCPEDIT_ERROR; dbgx(3, "Decoding 802.11 packet " COUNTER_SPEC, ctx->tcpedit->runtime.packetnum); assert(packet); l2len = dlt_ieee80211_l2len(ctx, packet, pktlen); if (pkt...
<vulnerable_code> } l2len = dlt_jnpr_ether_l2len(ctx, packet, pktlen); if (pktlen < l2len) return NULL; return tcpedit_dlt_l3data_copy(ctx, packet, pktlen, l2len); assert(l3data); l2len = dlt_jnpr_ether_l2len(ctx, packet, pktlen); if (pktlen < l2len) return NULL; ...
<vulnerable_code> assert(packet); l2len = dlt_linuxsll_l2len(ctx, packet, pktlen); if (pktlen < l2len) return NULL; return tcpedit_dlt_l3data_copy(ctx, packet, pktlen, l2len); assert(l3data); l2len = dlt_linuxsll_l2len(ctx, packet, pktlen); if (pktlen < l2len) return NULL...
<vulnerable_code>tcpedit_dlt_l2len(tcpeditdlt_t *ctx, int dlt, const u_char *packet, const int pktlen) { tcpeditdlt_plugin_t *plugin; assert(ctx); assert(dlt >= 0); assert(packet); tcpedit_seterr(ctx->tcpedit, "Unable to find plugin for DLT 0x%04x", dlt); return -1; } ret...
<vulnerable_code> /* FIXME: Is there anything else we need to do?? */ l2len = dlt_pppserial_l2len(ctx, packet, pktlen); if (pktlen < l2len) return NULL; return tcpedit_dlt_l3data_copy(ctx, packet, pktlen, l2len); /* FIXME: Is there anything else we need to do?? */ l2len = dlt_ppps...
<vulnerable_code> assert(packet); if (pktlen < 4) return 0; memcpy(&radiolen, &packet[2], 2); /* little endian to host */ int dlt_radiotap_80211_l2len(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen) { int radiolen; u_char *data; radiolen = dlt_radiotap_l2len(ctx, pac...
<vulnerable_code> ipv4_hdr_t *ip_hdr = NULL; ipv6_hdr_t *ip6_hdr = NULL; arp_hdr_t *arp_hdr = NULL; int l2len = 0, l2proto, retval = 0, dst_dlt, src_dlt, pktlen, lendiff; int ipflags = 0, tclass = 0; int needtorecalc = 0; /* did the packet change? if so, checksum */ u_char *packet; ...
<vulnerable_code> warnx("Unable to get MAC address: %s", sendpacket_geterr(sp)); err(-1, "Please consult the man page for using the -M option."); } sendpacket_close(sp); memcpy(options.intf1_mac, eth_buff, ETHER_ADDR_LEN); } if (memcmp(options.intf2_mac, "\00\00\0...
<vulnerable_code>void fix_ipv4_length(struct pcap_pkthdr *pkthdr, ipv4_hdr_t *ip_hdr) { if (!ip_hdr->ip_len) ip_hdr->ip_len = pkthdr->len; } void fix_ipv6_length(struct pcap_pkthdr *pkthdr, ipv6_hdr_t *ip6_hdr) { if (!ip6_hdr->ip_len) ip6_hdr->ip_len = pkthdr->len; } static void ipv4_l34_csum_...
<vulnerable_code> bool preload = options->file_cache[idx].cached; bool top_speed = (options->speed.mode == speed_topspeed || (options->speed.mode == speed_mbpsrate && options->speed.speed == 0)); bool now_is_now; ctx->skip_packets = 0; start_us = TIMEVAL_TO_MICROSEC(&ctx->stats.start_tim...
<vulnerable_code> return -1; } init_timestamp(&ctx->stats.last_time); init_timestamp(&ctx->stats.last_print); init_timestamp(&ctx->stats.end_time); if (gettimeofday(&ctx->stats.start_time, NULL) < 0) { tcpreplay_seterr(ctx, "gettimeofday() failed: %s", strerror(errno)); ret...
<vulnerable_code> assert(cachedata); /* first run? malloc our first entry, set bit count to 0 */ if (*cachedata == NULL) { *cachedata = new_cache(); lastcache = *cachedata; }<commit_title>[PATCH 01/36] Avoid non-blocking behaviour when using STDIN<commit_description>While on BSD systems...
<vulnerable_code>#ifdef DEBUG char netstr[INET6_ADDRSTRLEN]; #endif int i, j, k; if (mycidr->family != AF_INET6) return 0; goto out; } k = ~0 << (8 - k); i = addr->tcpr_s6_addr[j] & k; j = mycidr->u.network6.tcpr_s6_addr[j] & k; ret = i == j;<commit_title>[PATCH 01/36] ...
<vulnerable_code> sll_hdr_t *sll_hdr; struct tcpr_pppserial_hdr *ppp; flow_entry_data_t entry; int l2_len = 0; int ip_len; uint8_t protocol; uint32_t hash;<commit_title>[PATCH 01/36] Avoid non-blocking behaviour when using STDIN<commit_description>While on BSD systems, tcprewrite likely sets ...
<vulnerable_code> } /* no break */ case DLT_EN10MB: if (datalen >= (sizeof(eth_hdr_t) + eth_hdr_offset)) { vlan_hdr_t *vlan_hdr; eth_hdr_t *eth_hdr = (eth_hdr_t *)(pktdata + eth_hdr_offset); uint16_t ether_type = ntohs(eth_hdr->ether_type); break; ...
<vulnerable_code> nmreq_t nmr; #endif #ifdef HAVE_NETMAP u_int32_t netmap_version; #endif #ifndef HAVE_WIN32<commit_title>[PATCH 01/36] Avoid non-blocking behaviour when using STDIN<commit_description>While on BSD systems, tcprewrite likely sets `O_NDELAY` which is proper for most posix systems as this is the n...
<vulnerable_code> break; default: sendpacket_seterr(sp, "Error with %s [" COUNTER_SPEC "]: %s (errno = %d)", INJECT_METHOD, sp->sent + sp->failed + 1, strerror(errno), errno); } } ...
<vulnerable_code> } #endif /* stop sending based on the duration limit... */ if ((end_us > 0 && TIMEVAL_TO_MICROSEC(&now) > end_us) || /* ... or stop sending based on the limit -L? */ (limit_send > 0 && ctx->stats.pkts_sent >= limit_send)) { ctx->abort ...
<vulnerable_code> } /* read the frame */ maxread = min(caplen, sizeof(buf)); if ((ret = read(fd, &buf, maxread)) != maxread) { if (ret < 0) { printf("Error reading file: %s: %s\n", argv[i], strerror(errno));<commit_title>[PATCH 01/36] A...
<vulnerable_code> offset = sizeof(*ip6_hdr); next_header = ip6_hdr->ip_nh; while (sizeof(*nhdr) + offset < pkt_len) { if (next_header != TCPR_IPV6_NH_HBH && next_header != TCPR_IPV6_NH_ROUTING assert(ip_hdr); if (len < sizeof(*ip_hdr)) return; ipv4_l34_csum...
<vulnerable_code> * fuzz random-size segment at the beginning of the packet payload * with random bytes */ int i; uint32_t sgt_size = fuzz_get_sgt_size(r, l4len); if (!sgt_size) goto done; case FUZZING_CHANGE_MID_RANDOM: { /* fuzz random-size...
<vulnerable_code> assert(ctx); assert(packet); if (pktlen < sizeof(*hdlc)) return TCPEDIT_ERROR; if (ctx->decoded_extra_size < sizeof(*extra)) assert(ctx); assert(packet); if (pktlen < sizeof(*hdlc)) return TCPEDIT_ERROR; if (ctx->decoded_extra_size < sizeof(*extra...
<vulnerable_code> * Returns: total packet len or TCPEDIT_ERROR */ int dlt_ieee80211_encode(tcpeditdlt_t *ctx, u_char *packet, int pktlen, _U_ tcpr_dir_t dir) { assert(ctx); assert(packet);<commit_title>[PATCH 01/36] Avoid non-blocking behaviour when using STDIN<commit_description>While on BSD systems, tcprewr...
<vulnerable_code> * return NULL on error/address doesn't exist */ u_char * dlt_pppserial_get_mac(tcpeditdlt_t *ctx, tcpeditdlt_mac_type_t UNUSED(mac), const u_char *packet, const int pktlen) { assert(ctx); assert(packet);<commit_title>[PATCH 01/36] Avoid non-blocking behaviour when using STDIN<commit_descr...
<vulnerable_code> * Returns: total packet len or TCPEDIT_ERROR */ int dlt_radiotap_encode(tcpeditdlt_t *ctx, u_char *packet, int pktlen, _U_ tcpr_dir_t dir) { assert(ctx); assert(packet); * since we track which was the last packet # we copied. */ static u_char * dlt_radiotap_get_80211(tcpeditdlt_t *ctx, con...
<vulnerable_code> * Returns: total packet len or TCPEDIT_ERROR */ int dlt_raw_encode(tcpeditdlt_t *ctx, u_char *packet, int pktlen, _U_ tcpr_dir_t dir) { assert(ctx); assert(packet); * Function returns a pointer to the layer 3 protocol header or NULL on error */ u_char * dlt_raw_get_layer3(tcpeditdlt_t *ctx...
<vulnerable_code> /* you should never decode packets with this plugin! */ int dlt_user_decode(tcpeditdlt_t *ctx, const u_char *packet, const int pktlen) { assert(ctx); assert(packet); * Function returns the Layer 3 protocol type of the given packet, or TCPEDIT_ERROR on error */ int dlt_user_proto(tcpeditdlt...
<vulnerable_code> p = get_layer4_v6(ip6_hdr, (*pkthdr)->caplen - l2len); if (!p) { tcpedit_seterr(tcpedit, "Packet length %d is to short to contain a layer %d byte IPv6 header for DLT 0x%04x", pktlen, ip_hdr->ip_hl << 2, dst_dlt); return TCPEDIT_ERROR; ...
<vulnerable_code> * This function is called every time we receive a remote packet */ void got_packet(u_char *args, const struct pcap_pkthdr *header, const u_char *packet){ ether_hdr *etherhdr; tcp_hdr *tcphdr; ipv4_hdr *iphdr; unsigned int size_ip, size_tcp, size_payload; unsigned int flags = 0; ...
<vulnerable_code> * Set netmap mode */ int tcpreplay_set_netmap(tcpreplay_t *ctx, bool value) { assert(ctx); #ifdef HAVE_NETMAP int tcpreplay_replay(tcpreplay_t *ctx) { int rcode, loop, total_loops; char buf[64]; assert(ctx); ++loop; if (ctx->options->stats == 0) { ...
<vulnerable_code> struct tcpr_in6_addr network6; unsigned long mask = ~0; /* turn on all bits */ tcpprep_opt_t *options = tcpprep->options; int i, j, k; dbg(1, "Running: tree_buildcidr()"); network6.tcpr_s6_addr[i] = node->u.ip6.tcpr_s6_addr[i]; if ((k = bcda...
<vulnerable_code> private LikeCondition createLike(Type type, String toMatch) { if (notLike) { return new NotLikeCondition(type, selector, toMatch); } else { return new LikeCondition(type, selector, toMatch); } } <commit_title>[PATCH] Fix issue with like<commit_description><fixed_code> private LikeCondi...
<vulnerable_code> */ package org.torpedoquery.jpa.internal.conditions; import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import org.torpedoquery.jpa.internal.Condition; import org.torpedoquery.jpa.internal.Parameter; import org.torpedoquery.jpa.internal.Selector; ...
<vulnerable_code> */ package org.torpedoquery.jpa.internal.conditions; import org.torpedoquery.jpa.internal.Selector; public class NotLikeCondition extends LikeCondition { /** * <p>Constructor for NotLikeCondition.</p> * @param selector a {@link org.torpedoquery.jpa.internal.Selector} object. * @param toMatch ...
<vulnerable_code> Entity from = from(Entity.class); where(lower(from.getCode())).like().any("test"); Query<Entity> select = select(from); assertEquals("select entity_0 from Entity entity_0 where lower(entity_0.code) like '%test%'", select.getQuery()); } @Test Entity from = from(Entity.class); where(lower...
<vulnerable_code> where(condition); Query<Entity> select = select(entity); assertEquals( "select entity_0 from Entity entity_0 where ( lower(entity_0.code) like '%test%' )", select.getQuery()); } <commit_title>[PATCH] Fix issue with like<commit_description><fixed_code> where(condition); Query<Entity>...
<vulnerable_code> where(from.getCode()).like().any("test"); Query<Entity> select = select(from); assertEquals("select entity_0 from Entity entity_0 where entity_0.code like '%test%'", select.getQuery()); } /** where(from.getCode()).notLike().any("test"); Query<Entity> select = select(from); assertEqual...
<vulnerable_code> import frappe if not getattr(frappe.local, 'jenv', None): from jinja2 import Environment, DebugUndefined # frappe will be loaded last, so app templates will get precedence jenv = Environment(loader = get_jloader(), undefined=DebugUndefined) set_filters(jenv) <commit_title>[PATCH] fix(sec...
<vulnerable_code><commit_title>[PATCH] add rough public key parser<commit_description><fixed_code> from .python_rsakey import Python_RSAKey from .pem import dePem, pemSniff from .asn1parser import ASN1Parser from .cryptomath import bytesToNumber class Python_Key(object): """ Generic methods for parsing priv...
<vulnerable_code> return key generate = staticmethod(generate) def parsePEM(s, passwordCallback=None): """Parse a string containing a PEM-encoded <privateKey>.""" if pemSniff(s, "PRIVATE KEY"): bytes = dePem(s, "PRIVATE KEY") return Python_RSAKey._parsePKCS8(byte...
<vulnerable_code> repr_priv = kzalloc(sizeof(*repr_priv), GFP_KERNEL); if (!repr_priv) { err = -ENOMEM; goto err_reprs_clean; } port = nfp_port_alloc(app, NFP_PORT_PHYS_PORT, repr); if (IS_ERR(port)) { err = PTR_ERR(port); nfp_repr_free(repr); goto err_reprs_clean; } err = nfp_port_init_phy...
<vulnerable_code> {SCMP_SYS (clone), &SCMP_A0 (SCMP_CMP_MASKED_EQ, CLONE_NEWUSER, CLONE_NEWUSER)}, /* Don't allow faking input to the controlling tty (CVE-2017-5226) */ {SCMP_SYS (ioctl), &SCMP_A1(SCMP_CMP_EQ, (int)TIOCSTI)}, }; struct<commit_title>[PATCH] thumbnailer: fix incomplete TIOCSTI filtering<...
<vulnerable_code>import org.xwiki.test.page.HTML50ComponentList; import org.xwiki.test.page.IconSetup; import org.xwiki.test.page.PageTest; import org.xwiki.test.page.XWikiSyntax21ComponentList; import org.xwiki.xml.internal.html.filter.ControlCharactersFilter; <commit_title>[PATCH] XWIKI-20297: Improved DeleteWiki err...
<vulnerable_code>/* * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either ver...
<vulnerable_code> */ package org.xwiki.flamingo; import java.util.Locale; import org.jsoup.nodes.Document; import org.junit.jupiter.api.Test; import org.xwiki.localization.Translation; import org.xwiki.localization.TranslationBundle; import org.xwiki.localization.TranslationBundleContext; import org.xwiki.localizatio...
<vulnerable_code> assertEquals("help.macroList.description", includeMacroRowTds.get(3).text()); assertEquals("help.macroList.visibility", includeMacroRowTds.get(4).text()); assertWikiMacro(trs.get(1), "mymacro", "/xwiki/bin/view/XWiki/MyMacro", "My Macro", Set.of("Category1", "Categor...
<vulnerable_code> */ package org.xwiki.test.page; import java.util.Collection; import java.util.stream.Collectors; import org.mockito.stubbing.Answer; import org.xwiki.localization.script.LocalizationScriptService; import org.xwiki.script.service.ScriptService; import org.xwiki.test.TestComponentManager; import stat...
<vulnerable_code> * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.xwiki.attachment; import java.util.List; import static java.util.Collections.emptyList; /** * This script prints an error log when it is interpreted, mak...
<vulnerable_code> private static final String FIELD_PRETTY_NAME = "Test Field"; private static final String DEFAULT_LABEL = "defaultValue"; private static final String VALUE_1 = "value1"; private static final String DEFAULT_SELECT = "<select id='space.page_0_testField' name='space.page_0_test...
<vulnerable_code><commit_title>[PATCH] XWIKI-20297: Improved DeleteWiki error message escaping<commit_description>- Cleanup the unknown wiki error message in DeleteWiki - Make it easier to use the TestNoScriptMacro by moving it to xwiki-platform-test-page - Make it easier to use the translation macro in page tests<fix...
<vulnerable_code>@ComponentList({ ControlCharactersFilter.class, }) class WikiManagerTest extends PageTest { /** * Verify the resolved configuration of the Live Data macro (stored in the {@code data-config} attribute of the<commit_title>[PATCH] XWIKI-20297: Improved DeleteWiki error message escaping<commit...
<vulnerable_code>#define CHOL(name) cholmod_ ## name #endif PyDoc_STRVAR(cholmod__doc__, "Interface to the CHOLMOD library.\n\n" "Routines for sparse Cholesky factorization.\n\n" "The default values of the control parameters in the CHOLMOD 'Common'\n" } } return (PyObject *) PyCapsule_New((void *) L, S...
<vulnerable_code> function waitForApi() { if (!xdLocalStorage.wasInit()) { throw 'You must init xdLocalStorage in app config before use'; } return apiReady.promise; }<commit_title>[PATCH] If xdLocalstore was not init, throwing an error before return<commit_description><fixed_code> ...
<vulnerable_code> import render_message_inline_image_tooltip from "../templates/message_inline_image_tooltip.hbs"; import render_narrow_to_compose_recipients_tooltip from "../templates/narrow_to_compose_recipients_tooltip.hbs"; import render_tooltip_templates from "../templates/tooltip_templates.hbs"; import * as comp...
<vulnerable_code> } // Remove all ".." strings: ReplaceString(FileURL, "..", ""); // Read the file contents and guess its mime-type, based on the extension: AString Content = "<h2>404 Not Found</h2>"; AString ContentType; AString Path = Printf(FILE_IO_PREFIX "webadmin/files/%s", FileURL.c_str()); if (cFile::Is...
<vulnerable_code> // a valid request for webpack-dev-server should start with '/VAADIN/' String requestFilename = request.getPathInfo(); HttpURLConnection connection = prepareConnection(requestFilename, request.getMethod()); <commit_title>[PATCH] fix: check if Url path is safe in...
<vulnerable_code>package com.vaadin.flow.server; import java.io.Serializable; import java.util.Locale; import java.util.function.BiConsumer; import com.vaadin.flow.component.UI; import com.vaadin.flow.shared.ApplicationConstants; */ static final SystemMessages DEFAULT_SYSTEM_MESSAGES = new SystemMessages(); ...
<vulnerable_code> import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLConnection; import java.net.URLDecoder; import java.nio.charset.StandardCharsets; import java.util.regex.Pattern; import org.slf4j.Logger; + "fixInc...
<vulnerable_code> } if (msl_info.exception->severity == UndefinedException) (void) xmlParseChunk(msl_info.parser," ",1,MagickTrue); xmlFreeParserCtxt(msl_info.parser); (void) LogMagickEvent(CoderEvent,GetMagickModule(),"end SAX"); msl_info.group_info=(MSLGroupInfo *) RelinquishMagickMemory( msl_info.gr...
<vulnerable_code> */ struct urb *curr_urb; enum scheduling_pass sched_pass; struct usb_device *loaded_dev; /* dev that's loaded into the chip */ int loaded_epnum; /* epnum whose toggles are loaded */ int urb_done; /* > 0 -> no errors, < 0: errno */ size_t curr_len; u8 hien; * Caller must NOT hold HCD spinlo...
<vulnerable_code> try { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); final DocumentBuilder builder = factory.newDocumentBuilder(); builder.setEntityResolver(new SVGEntityResolver());<commit_title>[PATCH] fix(svg): fix XXE vulnerability that affect the SVG parser<commit_descri...
<vulnerable_code> h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres)) return -EINVAL; /* Make sure drawing engine can handle the font */ if (!(info->pixmap.blit_x & (1 << (font->width - 1))) || !(info->pixmap.blit_y & (1 << (font->height - 1)))) return -EINVAL; /* Make sure driver can ha...
<vulnerable_code> y = image_ops.pad_to_bounding_box(image, 0, 0, 55, 66) self.assertTrue(y.op.name.startswith("pad_to_bounding_box")) class SelectDistortedCropBoxTest(test_util.TensorFlowTestCase): <commit_title>[PATCH] Fix crash of tf.image.pad_to_bounding_box with large input<commit_description><fixed_co...
<vulnerable_code> lst.append(line) return lst def parse_headers(fp, _class=HTTPMessage): """Parses only RFC2822 headers from a file pointer. email Parser wants to see strings rather than bytes. But a TextIOWrapper around self.rfile would buffer too many bytes from the stream, by...
<vulnerable_code> resp = client.HTTPResponse(FakeSocket(body)) self.assertRaises(client.LineTooLong, resp.begin) def test_overflowing_total_header_size_after_100(self): body = ( 'HTTP/1.1 100 OK\r\n' 'r\n' * 32768 ) resp = client.HTTPResponse(FakeSocke...