code stringlengths 14 2.05k | label int64 0 1 | programming_language stringclasses 7
values | cwe_id stringlengths 6 14 | cwe_name stringlengths 5 98 ⌀ | description stringlengths 36 379 ⌀ | url stringlengths 36 48 ⌀ | label_name stringclasses 2
values |
|---|---|---|---|---|---|---|---|
void md_map_b2s160(uint8_t *hash, const uint8_t *msg, int len) {
memset(hash, 0, RLC_MD_LEN_B2S160);
blake2s(hash, RLC_MD_LEN_B2S160, msg, len, NULL, 0);
} | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
void md_hmac(uint8_t *mac, const uint8_t *in, int in_len, const uint8_t *key,
int key_len) {
#if MD_MAP == SH224 || MD_MAP == SH256 || MD_MAP == B2S160 || MD_MAP == B2S256
#define block_size 64
#elif MD_MAP == SH384 || MD_MAP == SH512
#define block_size 128
#endif
uint8_t opad[block_size + RLC_MD_LEN];
... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
void md_kdf(uint8_t *key, int key_len, const uint8_t *in,
int in_len) {
uint32_t i, j, d;
uint8_t* buffer = RLC_ALLOCA(uint8_t, in_len + sizeof(uint32_t));
uint8_t* t = RLC_ALLOCA(uint8_t, key_len + RLC_MD_LEN);
if (buffer == NULL || t == NULL) {
RLC_FREE(buffer);
RLC_FREE(t);
RLC_THROW(ERR_NO_MEMORY);
re... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
void md_mgf(uint8_t *key, int key_len, const uint8_t *in,
int in_len) {
uint32_t i, j, d;
uint8_t *buffer = RLC_ALLOCA(uint8_t, in_len + sizeof(uint32_t));
uint8_t *t = RLC_ALLOCA(uint8_t, key_len + RLC_MD_LEN);
if (buffer == NULL || t == NULL) {
RLC_FREE(buffer);
RLC_FREE(t);
RLC_THROW(ERR_NO_MEMORY);
r... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
void md_map_sh224(uint8_t *hash, const uint8_t *msg, int len) {
SHA224Context ctx;
if (SHA224Reset(&ctx) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA224Input(&ctx, msg, len) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA224Result(&ctx, hash) != shaSuccess) {
RLC_THROW(ERR_NO... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
void md_map_sh256(uint8_t *hash, const uint8_t *msg, int len) {
SHA256Context ctx;
if (SHA256Reset(&ctx) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA256Input(&ctx, msg, len) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA256Result(&ctx, hash) != shaSuccess) {
RLC_THROW(ERR_NO... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
void md_map_sh384(uint8_t *hash, const uint8_t *msg, int len) {
SHA384Context ctx;
if (SHA384Reset(&ctx) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA384Input(&ctx, msg, len) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA384Result(&ctx, hash) != shaSuccess) {
RLC_THROW(ERR_NO... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
void md_map_sh512(uint8_t *hash, const uint8_t *msg, int len) {
SHA512Context ctx;
if (SHA512Reset(&ctx) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA512Input(&ctx, msg, len) != shaSuccess) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (SHA512Result(&ctx, hash) != shaSuccess) {
RLC_THROW(ERR_NO... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
static void pp_mil_k12(fp12_t r, ep2_t *t, ep2_t *q, ep_t *p, int m, bn_t a) {
fp12_t l;
ep_t *_p = RLC_ALLOCA(ep_t, m);
ep2_t *_q = RLC_ALLOCA(ep2_t, m);
int i, j, len = bn_bits(a) + 1;
int8_t s[RLC_FP_BITS + 1];
if (m == 0) {
return;
}
fp12_null(l);
RLC_TRY {
fp12_new(l);
if (_p == NULL || _q == NUL... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
static void pp_mil_k24(fp24_t r, ep4_t *t, ep4_t *q, ep_t *p, int m, bn_t a) {
fp24_t l;
ep_t *_p = RLC_ALLOCA(ep_t, m);
ep4_t *_q = RLC_ALLOCA(ep4_t, m);
int i, j, len = bn_bits(a) + 1;
int8_t s[RLC_FP_BITS + 1];
if (m == 0) {
return;
}
fp24_null(l);
RLC_TRY {
fp24_new(l);
if (_p == NULL || _q == NUL... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
static void pp_mil_k48(fp48_t r, const fp8_t qx, const fp8_t qy, const ep_t p,
const bn_t a) {
fp48_t l;
ep_t _p;
fp8_t rx, ry, rz, qn;
int i, len = bn_bits(a) + 1;
int8_t s[RLC_FP_BITS + 1];
fp48_null(l);
ep_null(_p);
fp8_null(rx);
fp8_null(ry);
fp8_null(rz);
fp8_null(qn);
RLC_TRY {
fp48_new(l);
ep... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
static void pp_mil_k8(fp8_t r, ep2_t *t, ep2_t *q, ep_t *p, int m, bn_t a) {
fp8_t l;
ep_t *_p = RLC_ALLOCA(ep_t, m);
ep2_t *_q = RLC_ALLOCA(ep2_t, m);
int i, j, len = bn_bits(a) + 1;
int8_t s[RLC_FP_BITS + 1];
if (m == 0) {
return;
}
fp8_null(l);
RLC_TRY {
fp8_new(l);
if (_p == NULL || _q == NULL) {
... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
int rand_check(uint8_t *buf, int size) {
int count = 0;
for (int i = 1; i < size; i++) {
if (buf[i] == buf[i - 1]) {
count++;
} else {
count = 0;
}
}
if (count > RAND_REP) {
return RLC_ERR;
}
return RLC_OK;
} | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
static int rand_inc(uint8_t *data, int size, int digit) {
int carry = digit;
for (int i = size - 1; i >= 0; i--) {
int16_t s;
s = (data[i] + carry);
data[i] = s & 0xFF;
carry = s >> 8;
}
return carry;
} | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
static void rand_gen(uint8_t *out, int out_len) {
int m = RLC_CEIL(out_len, RLC_MD_LEN);
uint8_t hash[RLC_MD_LEN], data[(RLC_RAND_SIZE - 1)/2];
ctx_t *ctx = core_get();
/* data = V */
memcpy(data, ctx->rand + 1, (RLC_RAND_SIZE - 1)/2);
for (int i = 0; i < m; i++) {
/* w_i = Hash(data) */
md_map(hash, data, s... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
void rand_bytes(uint8_t *buf, int size) {
uint8_t hash[RLC_MD_LEN];
int carry, len = (RLC_RAND_SIZE - 1)/2;
ctx_t *ctx = core_get();
if (sizeof(int) > 2 && size > (1 << 16)) {
RLC_THROW(ERR_NO_VALID);
return;
}
/* buf = hash_gen(size) */
rand_gen(buf, size);
/* H = hash(03 || V) */
ctx->rand[0] = 0x3;
... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
static int rand_add(uint8_t *state, uint8_t *hash, int size) {
int carry = 0;
for (int i = size - 1; i >= 0; i--) {
/* Make sure carries are detected. */
int16_t s;
s = (state[i] + hash[i] + carry);
state[i] = s & 0xFF;
carry = s >> 8;
}
return carry;
} | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
static void rand_hash(uint8_t *out, int out_len, uint8_t *in, int in_len) {
uint32_t j = util_conv_big(8 * out_len);
int len = RLC_CEIL(out_len, RLC_MD_LEN);
uint8_t* buf = RLC_ALLOCA(uint8_t, 1 + sizeof(uint32_t) + in_len);
uint8_t hash[RLC_MD_LEN];
if (buf == NULL) {
RLC_THROW(ERR_NO_MEMORY);
return;
}
b... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
void rand_seed(uint8_t *buf, int size) {
ctx_t *ctx = core_get();
int len = (RLC_RAND_SIZE - 1) / 2;
if (size <= 0) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (sizeof(int) > 4 && size > (1 << 32)) {
RLC_THROW(ERR_NO_VALID);
return;
}
ctx->rand[0] = 0x0;
if (ctx->seeded == 0) {
/* V = hash_df(seed). */... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
int util_bits_dig(dig_t a) {
return RLC_DIG - arch_lzcnt(a);
} | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
static int square_root(void) {
int bits, code = RLC_ERR;
bn_t a, b, c;
bn_null(a);
bn_null(b);
bn_null(c);
RLC_TRY {
bn_new(a);
bn_new(b);
bn_new(c);
TEST_ONCE("square root extraction is correct") {
for (bits = 0; bits < RLC_BN_BITS / 2; bits++) {
bn_rand(a, RLC_POS, bits);
bn_sqr(c, a);
... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
int util(void) {
int l, code = RLC_ERR;
gt_t a, b, c;
uint8_t bin[24 * RLC_PC_BYTES];
gt_null(a);
gt_null(b);
gt_null(c);
RLC_TRY {
gt_new(a);
gt_new(b);
gt_new(c);
TEST_CASE("comparison is consistent") {
gt_rand(a);
gt_rand(b);
TEST_ASSERT(gt_cmp(a, b) != RLC_EQ, end);
}
TEST_END;
TES... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
static int test(void) {
uint8_t out[64];
int len = sizeof(out) / 2, code = RLC_ERR;
TEST_ONCE("rdrand hardware generator is non-trivial") {
memset(out, 0, 2 * len);
rand_bytes(out, len);
/* This fails with negligible probability. */
TEST_ASSERT(memcmp(out, out + len, len) != 0, end);
}
TEST_END;
code = ... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
static int action_getconfig(struct mansession *s, const struct message *m)
{
struct ast_config *cfg;
const char *fn = astman_get_header(m, "Filename");
const char *category = astman_get_header(m, "Category");
const char *filter = astman_get_header(m, "Filter");
const char *category_name;
int catcount = 0;
int li... | 0 | C | CWE-22 | Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') | The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the... | https://cwe.mitre.org/data/definitions/22.html | vulnerable |
static int restrictedFile(const char *filename)
{
if (!live_dangerously && !strncasecmp(filename, "/", 1) &&
strncasecmp(filename, ast_config_AST_CONFIG_DIR, strlen(ast_config_AST_CONFIG_DIR))) {
return 1;
}
return 0;
} | 0 | C | CWE-22 | Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') | The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the... | https://cwe.mitre.org/data/definitions/22.html | vulnerable |
OE_INLINE void _handle_oret(
oe_sgx_td_t* td,
uint16_t func,
uint16_t result,
uint64_t arg)
{
oe_callsite_t* callsite = td->callsites;
if (!callsite)
return;
td->oret_func = func;
td->oret_result = result;
td->oret_arg = arg;
/* Restore the FXSTATE and flags */
asm... | 0 | C | CWE-665 | Improper Initialization | The product does not initialize or incorrectly initializes a resource, which might leave the resource in an unexpected state when it is accessed or used. | https://cwe.mitre.org/data/definitions/665.html | vulnerable |
void _reset_fxsave_state()
{
/* Initialize the FXSAVE state values to Linux x86-64 ABI defined values:
* FCW = 0x037F, MXCSR = 0x1F80, MXCSR mask = 0xFFFF */
static OE_ALIGNED(OE_FXSAVE_ALIGNMENT) const uint64_t
_initial_fxstate[OE_FXSAVE_AREA_SIZE / sizeof(uint64_t)] = {
0x037F, 0, 0, ... | 0 | C | CWE-665 | Improper Initialization | The product does not initialize or incorrectly initializes a resource, which might leave the resource in an unexpected state when it is accessed or used. | https://cwe.mitre.org/data/definitions/665.html | vulnerable |
JSON_read(int fd)
{
uint32_t hsize, nsize;
char *str;
cJSON *json = NULL;
int rc;
/*
* Read a four-byte integer, which is the length of the JSON to follow.
* Then read the JSON into a buffer and parse it. Return a parsed JSON
* structure, NULL if there was an error.
*/
if (... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
static BOOL nsc_rle_decode(BYTE* in, BYTE* out, UINT32 outSize, UINT32 originalSize)
{
UINT32 left = originalSize;
while (left > 4)
{
const BYTE value = *in++;
UINT32 len = 0;
if (left == 5)
{
if (outSize < 1)
return FALSE;
outSize--;
*out++ = value;
left--;
}
else if (value == *in)
... | 0 | C | CWE-125 | Out-of-bounds Read | The product reads data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/125.html | vulnerable |
static BOOL nsc_rle_decompress_data(NSC_CONTEXT* context)
{
if (!context)
return FALSE;
BYTE* rle = context->Planes;
WINPR_ASSERT(rle);
for (size_t i = 0; i < 4; i++)
{
const UINT32 originalSize = context->OrgByteCount[i];
const UINT32 planeSize = context->PlaneByteCount[i];
if (planeSize == 0)
{
i... | 0 | C | CWE-125 | Out-of-bounds Read | The product reads data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/125.html | vulnerable |
_blackbox_vlogger(int32_t target,
struct qb_log_callsite *cs, struct timespec *timestamp, va_list ap)
{
size_t max_size;
size_t actual_size;
uint32_t fn_size;
char *chunk;
char *msg_len_pt;
uint32_t msg_len;
struct qb_log_target *t = qb_log_target_get(target);
if (t->instance == NULL) {
return;
}
fn_s... | 0 | C | CWE-120 | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | https://cwe.mitre.org/data/definitions/120.html | vulnerable |
START_TEST(test_log_long_msg)
{
int lpc;
int rc;
int i, max = 1000;
char *buffer = calloc(1, max);
qb_log_init("test", LOG_USER, LOG_DEBUG);
rc = qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_FALSE);
ck_assert_int_eq(rc, 0);
rc = qb_log_ctl(QB_LOG_BLACKBOX, QB_LOG_CONF_SIZE, 1024);
ck_assert_int_eq(rc, 0)... | 0 | C | CWE-120 | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | https://cwe.mitre.org/data/definitions/120.html | vulnerable |
consume_count(type)
const char **type;
{
int count = 0;
if (!isdigit((unsigned char)**type))
return -1;
while (isdigit((unsigned char)**type)) {
count *= 10;
/* Check for overflow.
We assume that count is represented using two's-complement;
no power of two is divisible by ten, so if an overflow... | 0 | C | CWE-190 | Integer Overflow or Wraparound | The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control. | https://cwe.mitre.org/data/definitions/190.html | vulnerable |
int h1_parse_cont_len_header(struct h1m *h1m, struct ist *value)
{
char *e, *n;
long long cl;
int not_first = !!(h1m->flags & H1_MF_CLEN);
struct ist word;
word.ptr = value->ptr - 1; // -1 for next loop's pre-increment
e = value->ptr + value->len;
while (++word.ptr < e) {
/* skip leading delimiter and blanks... | 0 | C | CWE-444 | Inconsistent Interpretation of HTTP Requests ('HTTP Request/Response Smuggling') | The product acts as an intermediary HTTP agent
(such as a proxy or firewall) in the data flow between two
entities such as a client and server, but it does not
interpret malformed HTTP requests or responses in ways that
are consistent with how the messages will be processed by
... | https://cwe.mitre.org/data/definitions/444.html | vulnerable |
void client_reset(t_client *client)
{
char *hash;
char *msg;
char *cidinfo;
debug(LOG_DEBUG, "Resetting client [%s]", client->mac);
// Reset traffic counters
client->counters.incoming = 0;
client->counters.outgoing = 0;
client->counters.last_updated = time(NULL);
// Reset session time
client->session_start ... | 0 | C | CWE-401 | Missing Release of Memory after Effective Lifetime | The product does not sufficiently track and release allocated memory after it has been used, which slowly consumes remaining memory. | https://cwe.mitre.org/data/definitions/401.html | vulnerable |
static int redirect_to_splashpage(struct MHD_Connection *connection, t_client *client, const char *host, const char *url)
{
char *originurl_raw;
char *originurl;
char *query;
int ret = 0;
const char *separator = "&";
char *querystr;
query = safe_calloc(QUERYMAXLEN);
if (!query) {
ret = send_error(connection... | 0 | C | CWE-401 | Missing Release of Memory after Effective Lifetime | The product does not sufficiently track and release allocated memory after it has been used, which slowly consumes remaining memory. | https://cwe.mitre.org/data/definitions/401.html | vulnerable |
void crypto_bignum_free(struct bignum *a)
{
if (a)
panic();
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static TEE_Result do_allocate_keypair(struct dh_keypair *key, size_t size_bits)
{
DH_TRACE("Allocate Keypair of %zu bits", size_bits);
/* Initialize the key fields to NULL */
memset(key, 0, sizeof(*key));
/* Allocate Generator Scalar */
key->g = crypto_bignum_allocate(size_bits);
if (!key->g)
goto err;
/* A... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static TEE_Result do_allocate_publickey(struct dsa_public_key *key,
size_t l_bits, size_t n_bits)
{
DSA_TRACE("DSA Allocate Public of L=%zu bits and N=%zu bits", l_bits,
n_bits);
/* Initialize the key fields to NULL */
memset(key, 0, sizeof(*key));
/* Allocate Generator Scalar */
key->g = crypto_bignum_... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static TEE_Result do_allocate_keypair(struct dsa_keypair *key, size_t l_bits,
size_t n_bits)
{
DSA_TRACE("DSA allocate Keypair of L=%zu bits and N=%zu bits", l_bits,
n_bits);
/* Initialize the key fields to NULL */
memset(key, 0, sizeof(*key));
/* Allocate Generator Scalar */
key->g = crypto_bignum... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static TEE_Result do_allocate_publickey(struct ecc_public_key *key,
uint32_t type __unused,
size_t size_bits)
{
ECC_TRACE("Allocate Public Key of %zu bits", size_bits);
/* Initialize the key fields to NULL */
memset(key, 0, sizeof(*key));
/* Allocate Public coordinate X */
key->x = crypto_bignum_alloca... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static void do_free_publickey(struct ecc_public_key *key)
{
crypto_bignum_free(key->x);
crypto_bignum_free(key->y);
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static TEE_Result do_allocate_keypair(struct ecc_keypair *key,
uint32_t type __unused,
size_t size_bits)
{
ECC_TRACE("Allocate Keypair of %zu bits", size_bits);
/* Initialize the key fields to NULL */
memset(key, 0, sizeof(*key));
/* Allocate Secure Scalar */
key->d = crypto_bignum_allocate(s... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static void do_free_keypair(struct rsa_keypair *key)
{
crypto_bignum_free(key->e);
crypto_bignum_free(key->d);
crypto_bignum_free(key->n);
crypto_bignum_free(key->p);
crypto_bignum_free(key->q);
crypto_bignum_free(key->qp);
crypto_bignum_free(key->dp);
crypto_bignum_free(key->dq);
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static void do_free_publickey(struct rsa_public_key *key)
{
crypto_bignum_free(key->e);
crypto_bignum_free(key->n);
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static TEE_Result do_allocate_publickey(struct rsa_public_key *key,
size_t size_bits)
{
RSA_TRACE("Allocate Public Key of %zu bits", size_bits);
/* Initialize all input key fields to 0 */
memset(key, 0, sizeof(*key));
/* Allocate the Public Exponent to maximum size */
key->e = crypto_bignum_allocate(MAX_BIT... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static void do_free_publickey(struct ecc_public_key *s)
{
if (!s)
return;
crypto_bignum_free(s->x);
crypto_bignum_free(s->y);
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static TEE_Result do_alloc_publickey(struct ecc_public_key *s, uint32_t type,
size_t size_bits __unused)
{
/* This driver only supports ECDH/ECDSA */
if (type != TEE_TYPE_ECDSA_PUBLIC_KEY &&
type != TEE_TYPE_ECDH_PUBLIC_KEY)
return TEE_ERROR_NOT_IMPLEMENTED;
memset(s, 0, sizeof(*s));
if (!bn_alloc_... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static TEE_Result do_alloc_keypair(struct ecc_keypair *s, uint32_t type,
size_t size_bits __unused)
{
/* This driver only supports ECDH/ECDSA */
if (type != TEE_TYPE_ECDSA_KEYPAIR &&
type != TEE_TYPE_ECDH_KEYPAIR)
return TEE_ERROR_NOT_IMPLEMENTED;
memset(s, 0, sizeof(*s));
if (!bn_alloc_max(&s->d))
... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static TEE_Result do_alloc_keypair(struct rsa_keypair *s,
size_t key_size_bits __unused)
{
memset(s, 0, sizeof(*s));
if (!bn_alloc_max(&s->e))
return TEE_ERROR_OUT_OF_MEMORY;
if (!bn_alloc_max(&s->d))
goto err;
if (!bn_alloc_max(&s->n))
goto err;
if (!bn_alloc_max(&s->p))
goto err;
if (!bn_alloc_ma... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static void do_free_publickey(struct rsa_public_key *s)
{
if (s) {
crypto_bignum_free(s->n);
crypto_bignum_free(s->e);
}
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static void do_free_keypair(struct rsa_keypair *s)
{
sss_status_t st = kStatus_SSS_Fail;
sss_se05x_object_t k_object = { };
uint32_t key_id = 0;
if (!s)
return;
key_id = se050_rsa_keypair_from_nvm(s);
if (key_id) {
st = sss_se05x_key_object_get_handle(&k_object, key_id);
if (st == kStatus_SSS_Success)
... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static TEE_Result do_alloc_publickey(struct rsa_public_key *s,
size_t key_size_bits __unused)
{
memset(s, 0, sizeof(*s));
if (!bn_alloc_max(&s->e))
return TEE_ERROR_OUT_OF_MEMORY;
if (!bn_alloc_max(&s->n)) {
crypto_bignum_free(s->e);
return TEE_ERROR_OUT_OF_MEMORY;
}
return TEE_SUCCESS;
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
TEE_Result crypto_acipher_alloc_dh_keypair(struct dh_keypair *s,
size_t key_size_bits __unused)
{
memset(s, 0, sizeof(*s));
if (!bn_alloc_max(&s->g))
return TEE_ERROR_OUT_OF_MEMORY;
if (!bn_alloc_max(&s->p))
goto err;
if (!bn_alloc_max(&s->y))
goto err;
if (!bn_alloc_max(&s->x))
goto err;
if (!bn_... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
TEE_Result crypto_acipher_alloc_dsa_public_key(struct dsa_public_key *s,
size_t key_size_bits __unused)
{
memset(s, 0, sizeof(*s));
if (!bn_alloc_max(&s->g))
return TEE_ERROR_OUT_OF_MEMORY;
if (!bn_alloc_max(&s->p))
goto err;
if (!bn_alloc_max(&s->q))
goto err;
if (!bn_alloc_max(&s->y))
goto e... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
TEE_Result crypto_acipher_alloc_dsa_keypair(struct dsa_keypair *s,
size_t key_size_bits __unused)
{
memset(s, 0, sizeof(*s));
if (!bn_alloc_max(&s->g))
return TEE_ERROR_OUT_OF_MEMORY;
if (!bn_alloc_max(&s->p))
goto err;
if (!bn_alloc_max(&s->q))
goto err;
if (!bn_alloc_max(&s->y))
goto err;
if (... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
TEE_Result crypto_asym_alloc_ecc_public_key(struct ecc_public_key *s,
uint32_t key_type,
size_t key_size_bits __unused)
{
memset(s, 0, sizeof(*s));
switch (key_type) {
case TEE_TYPE_ECDSA_PUBLIC_KEY:
case TEE_TYPE_ECDH_PUBLIC_KEY:
s->ops = &ecc_public_key_ops;
break;
case TEE_TYPE_SM2_DSA_PU... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
TEE_Result crypto_asym_alloc_ecc_keypair(struct ecc_keypair *s,
uint32_t key_type,
size_t key_size_bits __unused)
{
memset(s, 0, sizeof(*s));
switch (key_type) {
case TEE_TYPE_ECDSA_KEYPAIR:
case TEE_TYPE_ECDH_KEYPAIR:
s->ops = &ecc_keypair_ops;
break;
case TEE_TYPE_SM2_DSA_KEYPAIR:
if (!IS_ENAB... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static void _ltc_ecc_free_public_key(struct ecc_public_key *s)
{
if (!s)
return;
crypto_bignum_free(s->x);
crypto_bignum_free(s->y);
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
void crypto_bignum_free(struct bignum *s)
{
mbedtls_mpi_free((mbedtls_mpi *)s);
free(s);
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
TEE_Result sw_crypto_acipher_alloc_rsa_public_key(struct rsa_public_key *s,
size_t key_size_bits __unused)
{
memset(s, 0, sizeof(*s));
if (!bn_alloc_max(&s->e))
return TEE_ERROR_OUT_OF_MEMORY;
if (!bn_alloc_max(&s->n))
goto err;
return TEE_SUCCESS;
err:
crypto_bignum_free(s->e);
return TEE_ERROR_OUT_O... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
void sw_crypto_acipher_free_rsa_public_key(struct rsa_public_key *s)
{
if (!s)
return;
crypto_bignum_free(s->n);
crypto_bignum_free(s->e);
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
void sw_crypto_acipher_free_rsa_keypair(struct rsa_keypair *s)
{
if (!s)
return;
crypto_bignum_free(s->e);
crypto_bignum_free(s->d);
crypto_bignum_free(s->n);
crypto_bignum_free(s->p);
crypto_bignum_free(s->q);
crypto_bignum_free(s->qp);
crypto_bignum_free(s->dp);
crypto_bignum_free(s->dq);
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static void op_attr_bignum_free(void *attr)
{
struct bignum **bn = attr;
crypto_bignum_free(*bn);
*bn = NULL;
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
void crypto_bignum_free(struct bignum *s)
{
mbedtls_mpi_free((mbedtls_mpi *)s);
free(s);
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
TEE_Result crypto_acipher_alloc_dh_keypair(struct dh_keypair *s,
size_t key_size_bits)
{
memset(s, 0, sizeof(*s));
s->g = crypto_bignum_allocate(key_size_bits);
if (!s->g)
goto err;
s->p = crypto_bignum_allocate(key_size_bits);
if (!s->p)
goto err;
s->y = crypto_bignum_allocate(key_size_bits);
if (!s... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
TEE_Result crypto_asym_alloc_ecc_keypair(struct ecc_keypair *s,
uint32_t key_type,
size_t key_size_bits)
{
memset(s, 0, sizeof(*s));
switch (key_type) {
case TEE_TYPE_ECDSA_KEYPAIR:
case TEE_TYPE_ECDH_KEYPAIR:
s->ops = &ecc_keypair_ops;
break;
case TEE_TYPE_SM2_DSA_KEYPAIR:
if (!IS_ENABLED(CFG_C... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
static void ecc_free_public_key(struct ecc_public_key *s)
{
if (!s)
return;
crypto_bignum_free(s->x);
crypto_bignum_free(s->y);
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
TEE_Result crypto_asym_alloc_ecc_public_key(struct ecc_public_key *s,
uint32_t key_type,
size_t key_size_bits)
{
memset(s, 0, sizeof(*s));
switch (key_type) {
case TEE_TYPE_ECDSA_PUBLIC_KEY:
case TEE_TYPE_ECDH_PUBLIC_KEY:
s->ops = &ecc_public_key_ops;
break;
case TEE_TYPE_SM2_DSA_PUBLIC_KEY:... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
void sw_crypto_acipher_free_rsa_public_key(struct rsa_public_key *s)
{
if (!s)
return;
crypto_bignum_free(s->n);
crypto_bignum_free(s->e);
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
TEE_Result sw_crypto_acipher_alloc_rsa_public_key(struct rsa_public_key *s,
size_t key_size_bits)
{
memset(s, 0, sizeof(*s));
s->e = crypto_bignum_allocate(key_size_bits);
if (!s->e)
return TEE_ERROR_OUT_OF_MEMORY;
s->n = crypto_bignum_allocate(key_size_bits);
if (!s->n)
goto err;
return TEE_SUCCESS;
... | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
void sw_crypto_acipher_free_rsa_keypair(struct rsa_keypair *s)
{
if (!s)
return;
crypto_bignum_free(s->e);
crypto_bignum_free(s->d);
crypto_bignum_free(s->n);
crypto_bignum_free(s->p);
crypto_bignum_free(s->q);
crypto_bignum_free(s->qp);
crypto_bignum_free(s->dp);
crypto_bignum_free(s->dq);
} | 0 | C | CWE-415 | Double Free | The product calls free() twice on the same memory address, potentially leading to modification of unexpected memory locations. | https://cwe.mitre.org/data/definitions/415.html | vulnerable |
int LiSendMouseButtonEvent(char action, int button) {
PPACKET_HOLDER holder;
int err;
if (!initialized) {
return -2;
}
holder = malloc(sizeof(*holder));
if (holder == NULL) {
return -1;
}
holder->packetLength = sizeof(NV_MOUSE_BUTTON_PACKET);
holder->packet.mouseBu... | 0 | C | CWE-120 | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | https://cwe.mitre.org/data/definitions/120.html | vulnerable |
int startInputStream(void) {
int err;
// After Gen 5, we send input on the control stream
if (ServerMajorVersion < 5) {
inputSock = connectTcpSocket(&RemoteAddr, RemoteAddrLen,
35043, INPUT_STREAM_TIMEOUT_SEC);
if (inputSock == INVALID_SOCKET) {
return LastSocketFail... | 0 | C | CWE-120 | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | https://cwe.mitre.org/data/definitions/120.html | vulnerable |
int LiSendScrollEvent(signed char scrollClicks) {
PPACKET_HOLDER holder;
int err;
if (!initialized) {
return -2;
}
holder = malloc(sizeof(*holder));
if (holder == NULL) {
return -1;
}
holder->packetLength = sizeof(NV_SCROLL_PACKET);
holder->packet.scroll.header.pac... | 0 | C | CWE-120 | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | https://cwe.mitre.org/data/definitions/120.html | vulnerable |
int LiSendMouseMoveEvent(short deltaX, short deltaY) {
PPACKET_HOLDER holder;
int err;
if (!initialized) {
return -2;
}
holder = malloc(sizeof(*holder));
if (holder == NULL) {
return -1;
}
holder->packetLength = sizeof(NV_MOUSE_MOVE_PACKET);
holder->packet.mouseMov... | 0 | C | CWE-120 | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | https://cwe.mitre.org/data/definitions/120.html | vulnerable |
static int transactRtspMessage(PRTSP_MESSAGE request, PRTSP_MESSAGE response, int expectingPayload, int* error) {
// Gen 5+ does RTSP over ENet not TCP
if (ServerMajorVersion >= 5) {
return transactRtspMessageEnet(request, response, expectingPayload, error);
}
else {
return transactRtspM... | 0 | C | CWE-120 | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | https://cwe.mitre.org/data/definitions/120.html | vulnerable |
static int setupStream(PRTSP_MESSAGE response, char* target, int* error) {
RTSP_MESSAGE request;
int ret;
char* transportValue;
*error = -1;
ret = initializeRtspRequest(&request, "SETUP", target);
if (ret != 0) {
if (hasSessionId) {
if (!addOption(&request, "Session", sessi... | 0 | C | CWE-120 | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | https://cwe.mitre.org/data/definitions/120.html | vulnerable |
static bool parseUrlAddrFromRtspUrlString(const char* rtspUrlString, char* destination) {
char* rtspUrlScratchBuffer;
char* portSeparator;
char* v6EscapeEndChar;
char* urlPathSeparator;
int prefixLen;
// Create a copy that we can modify
rtspUrlScratchBuffer = strdup(rtspUrlString);
if (... | 0 | C | CWE-120 | Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') | The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow. | https://cwe.mitre.org/data/definitions/120.html | vulnerable |
void track_set_index(Track *track, int i, long ind)
{
if (i > MAXINDEX) {
fprintf(stderr, "too many indexes\n");
return;
}
track->index[i] = ind;
} | 0 | C | CWE-787 | Out-of-bounds Write | The product writes data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/787.html | vulnerable |
void InitCodec(const vpx_codec_iface_t &iface, int width, int height,
vpx_codec_ctx_t *enc, vpx_codec_enc_cfg_t *cfg) {
ASSERT_EQ(vpx_codec_enc_config_default(&iface, cfg, 0), VPX_CODEC_OK);
cfg->g_w = width;
cfg->g_h = height;
cfg->g_lag_in_frames = 0;
cfg->g_pass = VPX_RC_ONE_PASS;
ASSERT_E... | 0 | C | CWE-787 | Out-of-bounds Write | The product writes data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/787.html | vulnerable |
TEST(EncodeAPI, ConfigResizeChangeThreadCount) {
constexpr int kInitWidth = 1024;
constexpr int kInitHeight = 1024;
for (const auto *iface : kCodecIfaces) {
SCOPED_TRACE(vpx_codec_iface_name(iface));
if (!IsVP9(iface)) {
GTEST_SKIP() << "TODO(https://crbug.com/1486441) remove this condition "
... | 0 | C | CWE-787 | Out-of-bounds Write | The product writes data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/787.html | vulnerable |
int vp9_alloc_context_buffers(VP9_COMMON *cm, int width, int height) {
int new_mi_size;
vp9_set_mb_mi(cm, width, height);
new_mi_size = cm->mi_stride * calc_mi_size(cm->mi_rows);
if (cm->mi_alloc_size < new_mi_size) {
cm->free_mi(cm);
if (cm->alloc_mi(cm, new_mi_size)) goto fail;
}
if (cm->seg_map... | 0 | C | CWE-755 | Improper Handling of Exceptional Conditions | The product does not handle or incorrectly handles an exceptional condition. | https://cwe.mitre.org/data/definitions/755.html | vulnerable |
int vp9_alloc_context_buffers(VP9_COMMON *cm, int width, int height) {
int new_mi_size;
vp9_set_mb_mi(cm, width, height);
new_mi_size = cm->mi_stride * calc_mi_size(cm->mi_rows);
if (cm->mi_alloc_size < new_mi_size) {
cm->free_mi(cm);
if (cm->alloc_mi(cm, new_mi_size)) goto fail;
}
if (cm->seg_map... | 0 | C | CWE-755 | Improper Handling of Exceptional Conditions | The product does not handle or incorrectly handles an exceptional condition. | https://cwe.mitre.org/data/definitions/755.html | vulnerable |
static int handle_dot_dotdot_filename(struct exfat_de_iter *iter,
struct exfat_dentry *dentry,
int strm_name_len)
{
char *filename;
char error_msg[150];
int num;
if (!memcmp(dentry->name_unicode, MSDOS_DOT, strm_name_len * 2))
filename = ".";
else if (!memcmp(dentry->name_unicode, MSDOS_DOTD... | 0 | C | CWE-125 | Out-of-bounds Read | The product reads data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/125.html | vulnerable |
static int read_file_dentry_set(struct exfat_de_iter *iter,
struct exfat_inode **new_node, int *skip_dentries)
{
struct exfat_dentry *file_de, *stream_de, *dentry;
struct exfat_inode *node = NULL;
int i, ret;
ret = exfat_de_iter_get(iter, 0, &file_de);
if (ret || file_de->type != EXFAT_FILE) {
exfat_debug("... | 0 | C | CWE-125 | Out-of-bounds Read | The product reads data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/125.html | vulnerable |
static int ksu_sha256(const unsigned char *data, unsigned int datalen,
unsigned char *digest)
{
struct crypto_shash *alg;
char *hash_alg_name = "sha256";
int ret;
alg = crypto_alloc_shash(hash_alg_name, 0, 0);
if (IS_ERR(alg)) {
pr_info("can't alloc alg %s\n", hash_alg_name);
return PTR_ERR(alg);
}
ret = ... | 0 | C | CWE-863 | Incorrect Authorization | The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions. | https://cwe.mitre.org/data/definitions/863.html | vulnerable |
static bool check_block(struct file *fp, u32 *size4, loff_t *pos, u32 *offset,
unsigned expected_size, const char* expected_sha256)
{
ksu_kernel_read_compat(fp, size4, 0x4, pos); // signer-sequence length
ksu_kernel_read_compat(fp, size4, 0x4, pos); // signer length
ksu_kernel_read_compat(fp, size4, 0x4, pos); //... | 0 | C | CWE-863 | Incorrect Authorization | The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions. | https://cwe.mitre.org/data/definitions/863.html | vulnerable |
static int ref_pic_list_struct(GetBitContext *gb, RefPicListStruct *rpl)
{
uint32_t delta_poc_st, strp_entry_sign_flag = 0;
rpl->ref_pic_num = get_ue_golomb_long(gb);
if (rpl->ref_pic_num > 0) {
delta_poc_st = get_ue_golomb_long(gb);
rpl->ref_pics[0] = delta_poc_st;
if (rpl->ref_pic... | 0 | C | CWE-787 | Out-of-bounds Write | The product writes data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/787.html | vulnerable |
static int _process_request_metaflags(mcp_parser_t *pr, int token) {
if (pr->ntokens <= token) {
pr->t.meta.flags = 0; // no flags found.
return 0;
}
const char *cur = pr->request + pr->tokens[token];
const char *end = pr->request + pr->reqlen - 2;
// We blindly convert flags into b... | 0 | C | CWE-193 | Off-by-one Error | A product calculates or uses an incorrect maximum or minimum value that is 1 more, or 1 less, than the correct value. | https://cwe.mitre.org/data/definitions/193.html | vulnerable |
static int _process_tokenize(mcp_parser_t *pr, const size_t max) {
const char *s = pr->request;
int len = pr->reqlen - 2;
// since multigets can be huge, we can't purely judge reqlen against this
// limit, but we also can't index past it since the tokens are shorts.
if (len > PARSER_MAXLEN) {
... | 0 | C | CWE-193 | Off-by-one Error | A product calculates or uses an incorrect maximum or minimum value that is 1 more, or 1 less, than the correct value. | https://cwe.mitre.org/data/definitions/193.html | vulnerable |
size_t _process_request_next_key(mcp_parser_t *pr) {
const char *cur = pr->request + pr->parsed;
int remain = pr->reqlen - pr->parsed - 2;
// chew off any leading whitespace.
while (remain) {
if (*cur == ' ') {
remain--;
cur++;
pr->parsed++;
} else {
... | 0 | C | CWE-193 | Off-by-one Error | A product calculates or uses an incorrect maximum or minimum value that is 1 more, or 1 less, than the correct value. | https://cwe.mitre.org/data/definitions/193.html | vulnerable |
static void ClearMetadata(VP8LMetadata* const hdr) {
assert(hdr != NULL);
WebPSafeFree(hdr->huffman_image_);
WebPSafeFree(hdr->huffman_tables_);
VP8LHtreeGroupsFree(hdr->htree_groups_);
VP8LColorCacheClear(&hdr->color_cache_);
VP8LColorCacheClear(&hdr->saved_color_cache_);
InitMetadata(hdr);
} | 0 | C | CWE-787 | Out-of-bounds Write | The product writes data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/787.html | vulnerable |
int VP8LDecodeImage(VP8LDecoder* const dec) {
VP8Io* io = NULL;
WebPDecParams* params = NULL;
if (dec == NULL) return 0;
assert(dec->hdr_.huffman_tables_ != NULL);
assert(dec->hdr_.htree_groups_ != NULL);
assert(dec->hdr_.num_htree_groups_ > 0);
io = dec->io_;
assert(io != NULL);
params = (WebPDecP... | 0 | C | CWE-787 | Out-of-bounds Write | The product writes data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/787.html | vulnerable |
static int ReadHuffmanCodeLengths(
VP8LDecoder* const dec, const int* const code_length_code_lengths,
int num_symbols, int* const code_lengths) {
int ok = 0;
VP8LBitReader* const br = &dec->br_;
int symbol;
int max_symbol;
int prev_code_len = DEFAULT_CODE_LENGTH;
HuffmanCode table[1 << LENGTHS_TABLE... | 0 | C | CWE-787 | Out-of-bounds Write | The product writes data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/787.html | vulnerable |
static int ReadHuffmanCode(int alphabet_size, VP8LDecoder* const dec,
int* const code_lengths, HuffmanCode* const table) {
int ok = 0;
int size = 0;
VP8LBitReader* const br = &dec->br_;
const int simple_code = VP8LReadBits(br, 1);
memset(code_lengths, 0, alphabet_size * sizeof(*cod... | 0 | C | CWE-787 | Out-of-bounds Write | The product writes data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/787.html | vulnerable |
int VP8LBuildHuffmanTable(HuffmanCode* const root_table, int root_bits,
const int code_lengths[], int code_lengths_size) {
int total_size;
assert(code_lengths_size <= MAX_CODE_LENGTHS_SIZE);
if (root_table == NULL) {
total_size = BuildHuffmanTable(NULL, root_bits,
... | 0 | C | CWE-787 | Out-of-bounds Write | The product writes data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/787.html | vulnerable |
int jvp_number_cmp(jv a, jv b) {
assert(JVP_HAS_KIND(a, JV_KIND_NUMBER));
assert(JVP_HAS_KIND(b, JV_KIND_NUMBER));
#ifdef USE_DECNUM
if (JVP_HAS_FLAGS(a, JVP_FLAGS_NUMBER_LITERAL) && JVP_HAS_FLAGS(b, JVP_FLAGS_NUMBER_LITERAL)) {
decNumber res;
decNumberCompare(&res,
jvp_dec_number_pt... | 0 | C | CWE-787 | Out-of-bounds Write | The product writes data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/787.html | vulnerable |
static const char* jvp_literal_number_literal(jv n) {
assert(JVP_HAS_FLAGS(n, JVP_FLAGS_NUMBER_LITERAL));
decNumber *pdec = jvp_dec_number_ptr(n);
jvp_literal_number* plit = jvp_literal_number_ptr(n);
if (decNumberIsNaN(pdec)) {
return "null";
}
if (decNumberIsInfinite(pdec)) {
// We cannot preser... | 0 | C | CWE-787 | Out-of-bounds Write | The product writes data past the end, or before the beginning, of the intended buffer. | https://cwe.mitre.org/data/definitions/787.html | vulnerable |
comics_document_save (EvDocument *document,
const char *uri,
GError **error)
{
ComicsDocument *comics_document = COMICS_DOCUMENT (document);
return ev_xfer_uri_simple (comics_document->archive, uri, error);
} | 0 | C | CWE-78 | Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') | The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/78.html | vulnerable |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.