Exploit database

GH-a7883118b07d6b016ba101c8b172f55f

alikarimi999/cve-2021-40346

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2021-40346

6 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files196
alikarimi999/cve-2021-40346Revision eb4156546a2c
Next files →

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

haproxy/include/haproxy/shctx-t.h

Text · 1,908 bytes
/*
 * include/haproxy/shctx-t.h - shared context management functions for SSL
 *
 * Copyright (C) 2011-2012 EXCELIANCE
 *
 * Author: Emeric Brun - [email protected]
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */

#ifndef __HAPROXY_SHCTX_T_H
#define __HAPROXY_SHCTX_T_H

#if !defined (USE_PRIVATE_CACHE) && defined(USE_PTHREAD_PSHARED)
#include <pthread.h>
#endif
#include <haproxy/api-t.h>
#include <haproxy/thread-t.h>

#ifndef SHSESS_BLOCK_MIN_SIZE
#define SHSESS_BLOCK_MIN_SIZE 128
#endif

#ifndef SHSESS_MAX_DATA_LEN
#define SHSESS_MAX_DATA_LEN 4096
#endif

#ifndef SHCTX_APPNAME
#define SHCTX_APPNAME "haproxy"
#endif

#define SHCTX_E_ALLOC_CACHE -1
#define SHCTX_E_INIT_LOCK   -2

#define SHCTX_F_REMOVING 0x1      /* Removing flag, does not accept new */

/* generic shctx struct */
struct shared_block {
	struct list list;
	unsigned int len;          /* data length for the row */
	unsigned int block_count;  /* number of blocks */
	unsigned int refcount;
	struct shared_block *last_reserved;
	struct shared_block *last_append;
	unsigned char data[VAR_ARRAY];
};

struct shared_context {
#ifndef USE_PRIVATE_CACHE
#ifdef USE_PTHREAD_PSHARED
	pthread_mutex_t mutex;
#else
	unsigned int waiters;
#endif
#else
	__decl_thread(HA_SPINLOCK_T lock);  // used when USE_PRIVATE_CACHE=1
#endif
	struct list avail;  /* list for active and free blocks */
	struct list hot;     /* list for locked blocks */
	unsigned int nbav;  /* number of available blocks */
	unsigned int max_obj_size;   /* maximum object size (in bytes). */
	void (*free_block)(struct shared_block *first, struct shared_block *block);
	short int block_size;
	unsigned char data[VAR_ARRAY];
};

#endif /* __HAPROXY_SHCTX_T_H */