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 |
|---|---|---|---|---|---|---|---|
sudo_passwd_verify(const struct sudoers_context *ctx, struct passwd *pw,
const char *pass, sudo_auth *auth, struct sudo_conv_callback *callback)
{
char des_pass[9], *epass;
char *pw_epasswd = auth->data;
size_t pw_len;
int matched = 0;
debug_decl(sudo_passwd_verify, SUDOERS_DEBUG_AUTH);
/* ... | 0 | C | NVD-CWE-noinfo | null | null | null | vulnerable |
sudo_auth_cleanup(const struct sudoers_context *ctx, struct passwd *pw,
bool force)
{
sudo_auth *auth;
debug_decl(sudo_auth_cleanup, SUDOERS_DEBUG_AUTH);
/* Call cleanup routines. */
for (auth = auth_switch; auth->name; auth++) {
if (auth->cleanup && !IS_DISABLED(auth)) {
int status = (auth->... | 0 | C | NVD-CWE-noinfo | null | null | null | vulnerable |
sudo_auth_begin_session(const struct sudoers_context *ctx, struct passwd *pw,
char **user_env[])
{
sudo_auth *auth;
debug_decl(sudo_auth_begin_session, SUDOERS_DEBUG_AUTH);
for (auth = auth_switch; auth->name; auth++) {
if (auth->begin_session && !IS_DISABLED(auth)) {
int status = (auth->begin_se... | 0 | C | NVD-CWE-noinfo | null | null | null | vulnerable |
sudo_auth_end_session(void)
{
sudo_auth *auth;
int status;
debug_decl(sudo_auth_end_session, SUDOERS_DEBUG_AUTH);
for (auth = auth_switch; auth->name; auth++) {
if (auth->end_session && !IS_DISABLED(auth)) {
status = (auth->end_session)(auth);
if (status == AUTH_ERROR) {
/* Assume error ms... | 0 | C | NVD-CWE-noinfo | null | null | null | vulnerable |
sudoers_lookup(struct sudo_nss_list *snl, struct sudoers_context *ctx,
time_t now, sudoers_lookup_callback_fn_t callback, void *cb_data,
int *cmnd_status, int pwflag)
{
struct defaults_list *defs = NULL;
struct sudoers_parse_tree *parse_tree = NULL;
struct cmndspec *cs = NULL;
struct sudo_nss *n... | 0 | C | NVD-CWE-noinfo | null | null | null | vulnerable |
hostlist_matches_int(const struct sudoers_parse_tree *parse_tree,
const struct passwd *pw, const char *lhost, const char *shost,
const struct member_list *list)
{
struct member *m;
int matched = UNSPEC;
debug_decl(hostlist_matches, SUDOERS_DEBUG_MATCH);
TAILQ_FOREACH_REVERSE(m, list, member_lis... | 0 | C | NVD-CWE-noinfo | null | null | null | vulnerable |
host_matches(const struct sudoers_parse_tree *parse_tree,
const struct passwd *pw, const char *lhost, const char *shost,
const struct member *m)
{
struct alias *a;
int matched = UNSPEC;
debug_decl(host_matches, SUDOERS_DEBUG_MATCH);
switch (m->type) {
case ALL:
matched = m->negated ? DENY... | 0 | C | NVD-CWE-noinfo | null | null | null | vulnerable |
cmnd_matches(const struct sudoers_parse_tree *parse_tree,
const struct member *m, const char *runchroot, struct cmnd_info *info)
{
struct alias *a;
struct sudo_command *c;
int rc, matched = UNSPEC;
debug_decl(cmnd_matches, SUDOERS_DEBUG_MATCH);
switch (m->type) {
case ALL:
case COMMAND:
... | 0 | C | NVD-CWE-noinfo | null | null | null | vulnerable |
cmndlist_matches(const struct sudoers_parse_tree *parse_tree,
const struct member_list *list, const char *runchroot,
struct cmnd_info *info)
{
struct member *m;
int matched = UNSPEC;
debug_decl(cmndlist_matches, SUDOERS_DEBUG_MATCH);
TAILQ_FOREACH_REVERSE(m, list, member_list, entries) {
match... | 0 | C | NVD-CWE-noinfo | null | null | null | vulnerable |
user_matches(const struct sudoers_parse_tree *parse_tree,
const struct passwd *pw, const struct member *m)
{
const struct sudoers_context *ctx = parse_tree->ctx;
const char *lhost = parse_tree->lhost ? parse_tree->lhost : ctx->runas.host;
const char *shost = parse_tree->shost ? parse_tree->shost : ctx->... | 0 | C | NVD-CWE-noinfo | null | null | null | vulnerable |
cmnd_matches_all(const struct sudoers_parse_tree *parse_tree,
const struct member *m, const char *runchroot, struct cmnd_info *info)
{
const bool negated = m->negated;
struct sudo_command *c;
int matched = UNSPEC;
struct alias *a;
debug_decl(cmnd_matches_all, SUDOERS_DEBUG_MATCH);
switch (m... | 0 | C | NVD-CWE-noinfo | null | null | null | vulnerable |
runas_grouplist_matches(const struct sudoers_parse_tree *parse_tree,
const struct member_list *group_list, struct member **matching_group)
{
const struct sudoers_context *ctx = parse_tree->ctx;
int group_matched = UNSPEC;
struct member *m;
struct alias *a;
debug_decl(runas_grouplist_matches, SUD... | 0 | C | NVD-CWE-noinfo | null | null | null | vulnerable |
userlist_matches(const struct sudoers_parse_tree *parse_tree,
const struct passwd *pw, const struct member_list *list)
{
struct member *m;
int matched = UNSPEC;
debug_decl(userlist_matches, SUDOERS_DEBUG_MATCH);
TAILQ_FOREACH_REVERSE(m, list, member_list, entries) {
if ((matched = user_matches(par... | 0 | C | NVD-CWE-noinfo | null | null | null | vulnerable |
int valid_field (const char *field, const char *illegal)
{
const char *cp;
int err = 0;
if (NULL == field) {
return -1;
}
/* For each character of field, search if it appears in the list
* of illegal characters. */
for (cp = field; '\0' != *cp; cp++) {
if (strchr (illegal, *cp) != NULL) {
err = -1;
... | 0 | C | CWE-74 | Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') | The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/74.html | vulnerable |
static u32 crc32sum(u32 crc, u8 * RESTRICT buf, size_t size) {
while (size--) crc = crc32Table[(crc ^ *(buf++)) & 0xff] ^ (crc >> 8);
return crc;
} | 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 void mrled(u8 * RESTRICT in, u8 * RESTRICT out, s32 outlen) {
s32 op = 0, ip = 0;
s32 c, pc = -1;
s32 t[256] = { 0 };
s32 run = 0;
for (s32 i = 0; i < 32; ++i) {
c = in[ip++];
for (s32 j = 0; j < 8; ++j) t[i * 8 + j] = (c >> j) & 1;
}
while (op < outlen) {
c... | 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 |
BZIP3_API struct bz3_state * bz3_new(s32 block_size) {
if (block_size < KiB(65) || block_size > MiB(511)) {
return NULL;
}
struct bz3_state * bz3_state = malloc(sizeof(struct bz3_state));
if (!bz3_state) {
return NULL;
}
bz3_state->cm_state = malloc(sizeof(state));
bz3_st... | 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 dns_add_rr_nested_memcpy(struct dns_rr_nested *rr_nested, void *data, int data_len)
{
if (rr_nested == NULL || data == NULL || data_len <= 0) {
return -1;
}
if (_dns_left_len(&rr_nested->context) < data_len) {
return -1;
}
memcpy(rr_nested->context.ptr, data, data_len);
rr_nested->context.ptr += data_le... | 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 dns_HTTPS_add_ipv4hint(struct dns_rr_nested *svcparam, unsigned char addr[][DNS_RR_A_LEN], int addr_num)
{
if (_dns_left_len(&svcparam->context) < 4 + addr_num * DNS_RR_A_LEN) {
return -1;
}
unsigned short value = DNS_HTTPS_T_IPV4HINT;
dns_add_rr_nested_memcpy(svcparam, &value, 2);
value = addr_num * DNS_R... | 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 dns_HTTPS_add_ipv6hint(struct dns_rr_nested *svcparam, unsigned char addr[][DNS_RR_AAAA_LEN], int addr_num)
{
if (_dns_left_len(&svcparam->context) < 4 + addr_num * DNS_RR_AAAA_LEN) {
return -1;
}
unsigned short value = DNS_HTTPS_T_IPV6HINT;
dns_add_rr_nested_memcpy(svcparam, &value, 2);
value = addr_num *... | 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 _dns_encode_HTTPS(struct dns_context *context, struct dns_rrs *rrs)
{
int ret = 0;
int qtype = 0;
int qclass = 0;
char domain[DNS_MAX_CNAME_LEN];
char target[DNS_MAX_CNAME_LEN] = {0};
unsigned char *rr_len_ptr = NULL;
unsigned char *start = NULL;
unsigned char *rr_start = NULL;
int ttl = 0;
int pri... | 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 dns_add_HTTPS_start(struct dns_rr_nested *svcparam_buffer, struct dns_packet *packet, dns_rr_type type,
const char *domain, int ttl, int priority, const char *target)
{
svcparam_buffer = dns_add_rr_nested_start(svcparam_buffer, packet, type, DNS_T_HTTPS, domain, ttl);
if (svcparam_buffer == NULL) {
return... | 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 |
struct dns_https_param *dns_get_HTTPS_svcparm_start(struct dns_rrs *rrs, char *domain, int maxsize, int *ttl,
int *priority, char *target, int target_size)
{
int qtype = 0;
unsigned char *data = NULL;
int rr_len = 0;
data = dns_get_rr_nested_start(rrs, domain, maxsize, &qtype, ttl, &rr_len);
if (data... | 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 |
PrintBackend *cpdbCreateBackendFromFile(GDBusConnection *connection,
const char *backend_file_name)
{
FILE *file = NULL;
PrintBackend *proxy;
GError *error = NULL;
char *path, *backend_name;
const char *info_dir_name;
char obj_path[CPDB_BSIZE];
ba... | 0 | C | CWE-121 | Stack-based Buffer Overflow | A stack-based buffer overflow condition is a condition where the buffer being overwritten is allocated on the stack (i.e., is a local variable or, rarely, a parameter to a function). | https://cwe.mitre.org/data/definitions/121.html | vulnerable |
int pico_tcp_initconn(struct pico_socket *s)
{
struct pico_socket_tcp *ts = TCP_SOCK(s);
struct pico_frame *syn;
struct pico_tcp_hdr *hdr;
uint16_t mtu, opt_len = tcp_options_size(ts, PICO_TCP_SYN);
syn = s->net->alloc(s->stack, s->net, NULL, (uint16_t)(PICO_SIZE_TCPHDR + opt_len));
if (!syn)
... | 0 | C | CWE-908 | Use of Uninitialized Resource | The product uses or accesses a resource that has not been initialized. | https://cwe.mitre.org/data/definitions/908.html | vulnerable |
struct pico_socket *pico_tcp_open(struct pico_stack *S, uint16_t family)
{
struct pico_socket_tcp *t = PICO_ZALLOC(sizeof(struct pico_socket_tcp));
if (!t)
return NULL;
t->sock.stack = S;
t->sock.timestamp = TCP_TIME;
pico_socket_set_family(&t->sock, family);
t->mss = (uint16_t)(pico_so... | 0 | C | CWE-908 | Use of Uninitialized Resource | The product uses or accesses a resource that has not been initialized. | https://cwe.mitre.org/data/definitions/908.html | vulnerable |
int ipfilter(struct pico_frame *f)
{
struct filter_node temp;
struct pico_ipv4_hdr *ipv4_hdr = (struct pico_ipv4_hdr *) f->net_hdr;
struct pico_trans *trans;
struct pico_icmp4_hdr *icmp_hdr;
memset(&temp, 0u, sizeof(struct filter_node));
temp.fdev = f->dev;
temp.out_addr = ipv4_hdr->dst.ad... | 0 | C | NVD-CWE-noinfo | null | null | null | vulnerable |
_xdr_kadm5_principal_ent_rec(XDR *xdrs, kadm5_principal_ent_rec *objp,
int v)
{
unsigned int n;
if (!xdr_krb5_principal(xdrs, &objp->principal)) {
return (FALSE);
}
if (!xdr_krb5_timestamp(xdrs, &objp->princ_expire_time)) {
return (FALSE);
}
if (!xdr_krb5_timestamp(xdrs, &objp->last_pwd_change)) {
... | 0 | C | CWE-824 | Access of Uninitialized Pointer | The product accesses or uses a pointer that has not been initialized. | https://cwe.mitre.org/data/definitions/824.html | vulnerable |
DltReturnValue dlt_file_message(DltFile *file, int index, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
if (file == NULL)
return DLT_RETURN_WRONG_PARAMETER;
/* check if message is in range */
if (index >= file->counter) {
dlt_vlog(LOG_WARNING, "Message %d out of range!\r\n", index);
... | 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 |
dig_t bn_get_prime(int pos) {
if (pos >= BASIC_TESTS) {
return 0;
}
return primes[pos];
} | 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 benaloh(void) {
int code = RLC_ERR;
bdpe_t pub, prv;
bn_t a, b;
dig_t in, out;
uint8_t buf[RLC_BN_BITS / 8 + 1];
size_t len;
int result;
bn_null(a);
bn_null(b);
bdpe_null(pub);
bdpe_null(prv);
RLC_TRY {
bn_new(a);
bn_new(b);
bdpe_new(pub);
bdpe_new(prv);
result = cp_bdpe_gen(pub, prv... | 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 benaloh(void) {
bdpe_t pub, prv;
dig_t in, new;
uint8_t out[RLC_BN_BITS / 8 + 1];
size_t out_len;
bdpe_null(pub);
bdpe_null(prv);
bdpe_new(pub);
bdpe_new(prv);
BENCH_ONE("cp_bdpe_gen", cp_bdpe_gen(pub, prv, bn_get_prime(47),
RLC_BN_BITS), 1);
BENCH_RUN("cp_bdpe_enc") {
out_len = RLC_BN_BIT... | 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 memory2(void) {
ep2_t a[BENCH];
BENCH_FEW("ep2_null", ep4_null(a[i]), 1);
BENCH_FEW("ep2_new", ep4_new(a[i]), 1);
for (int i = 0; i < BENCH; i++) {
ep2_free(a[i]);
}
for (int i = 0; i < BENCH; i++) {
ep2_new(a[i]);
}
BENCH_FEW("ep2_free", ep4_free(a[i]), 1);
(void)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 |
void bn_make(bn_t a, int digits) {
if (digits < 0) {
RLC_THROW(ERR_NO_VALID);
}
/* Allocate at least one digit. */
digits = RLC_MAX(digits, 1);
#if ALLOC == DYNAMIC
if (digits % RLC_BN_SIZE != 0) {
/* Pad the number of digits to a multiple of the block. */
digits += (RLC_BN_SIZE - digits % RLC_BN_SIZE);
}
... | 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 bn_grow(bn_t a, int digits) {
#if ALLOC == DYNAMIC
dig_t *t;
if (a->alloc < digits) {
/* At least add RLC_BN_SIZE more digits. */
digits += (RLC_BN_SIZE * 2) - (digits % RLC_BN_SIZE);
t = (dig_t *)realloc(a->dp, (RLC_DIG / 8) * digits);
if (t == NULL) {
RLC_THROW(ERR_NO_MEMORY);
return;
}
a->d... | 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 bn_trim(bn_t a) {
if (a->used <= a->alloc) {
while (a->used > 0 && a->dp[a->used - 1] == 0) {
--(a->used);
}
/* Zero can't be negative. */
if (a->used <= 0) {
a->used = 1;
a->dp[0] = 0;
a->sign = RLC_POS;
}
}
} | 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 bn_mxp_slide(bn_t c, const bn_t a, const bn_t b, const bn_t m) {
bn_t tab[RLC_TABLE_SIZE], t, u, r;
int i, j, l, w = 1;
uint8_t *win = RLC_ALLOCA(uint8_t, bn_bits(b));
if (win == NULL) {
RLC_THROW(ERR_NO_MEMORY);
return;
}
if (bn_cmp_dig(m, 1) == RLC_EQ) {
RLC_FREE(win);
bn_zero(c);
return;
}
... | 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 bn_gen_prime_stron(bn_t a, int bits) {
dig_t i, j;
int found, k;
bn_t r, s, t;
bn_null(r);
bn_null(s);
bn_null(t);
RLC_TRY {
bn_new(r);
bn_new(s);
bn_new(t);
do {
do {
/* Generate two large primes r and s. */
bn_rand(s, RLC_POS, bits / 2 - RLC_DIG / 2);
bn_rand(t, RLC_POS, bits / 2... | 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 bn_gen_prime_basic(bn_t a, int bits) {
while (1) {
do {
bn_rand(a, RLC_POS, bits);
} while (bn_bits(a) != bits);
if (bn_is_prime(a)) {
return;
}
}
} | 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 bn_gen_prime_factor(bn_t a, bn_t b, int abits, int bbits) {
bn_t t;
int result = RLC_OK;
if (! (bbits>abits) ) {
return RLC_ERR;
}
bn_null(t);
RLC_TRY {
bn_new(t);
bn_gen_prime(a, abits);
do {
bn_rand(t, RLC_POS, bbits - bn_bits(a));
do {
... | 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 bn_gen_prime_safep(bn_t a, int bits) {
while (1) {
do {
bn_rand(a, RLC_POS, bits);
} while (bn_bits(a) != bits);
/* Check if (a - 1)/2 is prime. */
bn_sub_dig(a, a, 1);
bn_rsh(a, a, 1);
if (bn_is_prime(a)) {
/* Restore a. */
bn_lsh(a, a, 1);
bn_add_dig(a, a, 1);
if (bn_is_prime(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 |
void bn_rec_jsf(int8_t *jsf, int *len, const bn_t k, const bn_t l) {
bn_t n0, n1;
dig_t l0, l1;
int8_t u0, u1, d0, d1;
int i, j, offset;
if (*len < (2 * bn_bits(k) + 1)) {
*len = 0;
RLC_THROW(ERR_NO_BUFFER);
return;
}
bn_null(n0);
bn_null(n1);
RLC_TRY {
bn_new(n0);
bn_new(n1);
bn_abs(n0, k);
... | 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 bn_rec_naf(int8_t *naf, int *len, const bn_t k, int w) {
int i, l;
bn_t t;
dig_t t0, mask;
int8_t u_i;
if (*len < (bn_bits(k) + 1)) {
*len = 0;
RLC_THROW(ERR_NO_BUFFER);
return;
}
bn_null(t);
RLC_TRY {
bn_new(t);
bn_abs(t, k);
mask = RLC_MASK(w);
l = (1 << w);
memset(naf, 0, *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 |
static char get_bits(const bn_t a, int from, int to) {
int f, t;
dig_t mf, mt;
RLC_RIP(from, f, from);
RLC_RIP(to, t, to);
if (f == t) {
/* Same digit. */
mf = RLC_MASK(from);
if (to + 1 >= RLC_DIG) {
mt = RLC_DMASK;
} else {
mt = RLC_MASK(to + 1);
}
mf = mf ^ mt;
return ((a->dp[f] & (mf))... | 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 bn_rec_glv(bn_t k0, bn_t k1, const bn_t k, const bn_t n, const bn_t *v1,
const bn_t *v2) {
bn_t t, b1, b2;
int r1, r2, bits;
bn_null(b1);
bn_null(b2);
bn_null(t);
RLC_TRY {
bn_new(b1);
bn_new(b2);
bn_new(t);
bn_abs(t, k);
bits = bn_bits(n);
bn_mul(b1, t, v1[0]);
r1 = bn_get_bit(b1, bits);... | 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 bn_rec_reg(int8_t *naf, int *len, const bn_t k, int n, int w) {
int i, l;
bn_t t;
dig_t t0, mask;
int8_t u_i;
bn_null(t);
mask = RLC_MASK(w);
l = RLC_CEIL(n, w - 1);
if (*len <= l) {
*len = 0;
RLC_THROW(ERR_NO_BUFFER);
return;
}
RLC_TRY {
bn_new(t);
bn_abs(t, k);
memset(naf, 0, *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 bn_rec_tnaf_mod(bn_t r0, bn_t r1, const bn_t k, int u, int m) {
bn_t t, t0, t1, t2, t3;
bn_null(t);
bn_null(t0);
bn_null(t1);
bn_null(t2);
bn_null(t3);
RLC_TRY {
bn_new(t);
bn_new(t0);
bn_new(t1);
bn_new(t2);
bn_new(t3);
/* (a0, a1) = (1, 0). */
bn_set_dig(t0, 1);
bn_zero(t1);
/* (b0, 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 bn_rec_win(uint8_t *win, int *len, const bn_t k, int w) {
int i, j, l;
l = bn_bits(k);
if (*len < RLC_CEIL(l, w)) {
*len = 0;
RLC_THROW(ERR_NO_BUFFER);
return;
}
memset(win, 0, *len);
j = 0;
for (i = 0; i < l - w; i += w) {
win[j++] = get_bits(k, i, i + w - 1);
}
win[j++] = get_bits(k, i, bn_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 bn_rec_slw(uint8_t *win, int *len, const bn_t k, int w) {
int i, j, l, s;
l = bn_bits(k);
if (*len < l) {
*len = 0;
RLC_THROW(ERR_NO_BUFFER);
return;
}
memset(win, 0, *len);
i = l - 1;
j = 0;
while (i >= 0) {
if (!bn_get_bit(k, i)) {
i--;
win[j++] = 0;
} else {
s = RLC_MAX(i - w + 1,... | 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 bn_rsh(bn_t c, const bn_t a, int bits) {
int digits = 0;
bn_copy(c, a);
if (bits <= 0) {
return;
}
RLC_RIP(bits, digits, bits);
if (digits > 0) {
dv_rshd(c->dp, a->dp, a->used, digits);
}
c->used = a->used - digits;
c->sign = a->sign;
if (c->used > 0 && bits > 0) {
if (digits == 0 && 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 |
void bn_lsh(bn_t c, const bn_t a, int bits) {
int digits;
dig_t carry;
bn_copy(c, a);
if (bits <= 0) {
return;
}
RLC_RIP(bits, digits, bits);
RLC_TRY {
bn_grow(c, c->used + digits + (bits > 0));
c->used = a->used + digits;
c->sign = a->sign;
if (digits > 0) {
dv_lshd(c->dp, a->dp, c->used, digi... | 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 bn_smb_jac(const bn_t a, const bn_t b) {
bn_t t0, t1, r;
int t, h, res;
bn_null(t0);
bn_null(t1);
bn_null(r);
/* Argument b must be odd. */
if (bn_is_even(b) || bn_sign(b) == RLC_NEG) {
RLC_THROW(ERR_NO_VALID);
return 0;
}
RLC_TRY {
bn_new(t0);
bn_new(t1);
bn_new(r);
t = 1;
if (bn_sign(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 |
void bn_srt(bn_t c, bn_t a) {
bn_t h, l, m, t;
int bits, cmp;
if (bn_sign(a) == RLC_NEG) {
RLC_THROW(ERR_NO_VALID);
}
bits = bn_bits(a);
bits += (bits % 2);
bn_null(h);
bn_null(l);
bn_null(m);
bn_null(t);
RLC_TRY {
bn_new(h);
bn_new(l);
bn_new(m);
bn_new(t);
bn_set_2b(h, bits >> 1);
bn_set... | 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 bn_bits(const bn_t a) {
int bits;
if (bn_is_zero(a)) {
return 0;
}
/* Bits in lower digits. */
bits = (a->used - 1) * RLC_DIG;
return bits + util_bits_dig(a->dp[a->used - 1]);
} | 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 bn_write_raw(dig_t *raw, int len, const bn_t a) {
int i, size;
size = a->used;
if (len < size) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
for (i = 0; i < size; i++) {
raw[i] = a->dp[i];
}
for (; i < len; i++) {
raw[i] = 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 bn_set_bit(bn_t a, int bit, int value) {
int d;
if (bit < 0) {
RLC_THROW(ERR_NO_VALID);
return;
}
RLC_RIP(bit, d, bit);
bn_grow(a, d);
if (value == 1) {
a->dp[d] |= ((dig_t)1 << bit);
if ((d + 1) > a->used) {
a->used = d + 1;
}
} else {
a->dp[d] &= ~((dig_t)1 << bit);
bn_trim(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 |
void bn_write_bin(uint8_t *bin, int len, const bn_t a) {
int size, k;
dig_t d;
size = bn_size_bin(a);
if (len < size) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
k = 0;
for (int i = 0; i < a->used - 1; i++) {
d = a->dp[i];
for (int j = 0; j < (int)(RLC_DIG / 8); j++) {
bin[len - 1 - k++] = d & 0xFF;
d... | 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 bn_size_raw(const bn_t a) {
return a->used;
} | 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 bn_size_str(const bn_t a, int radix) {
int digits = 0;
bn_t t;
bn_null(t);
/* Check the radix. */
if (radix < 2 || radix > 64) {
RLC_THROW(ERR_NO_VALID);
return 0;
}
if (bn_is_zero(a)) {
return 2;
}
/* Binary case requires the bits, a sign and the null terminator. */
if (radix == 2) {
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 bn_read_str(bn_t a, const char *str, int len, int radix) {
int sign, i, j;
char c;
bn_zero(a);
if (radix < 2 || radix > 64) {
RLC_THROW(ERR_NO_VALID);
return;
}
j = 0;
if (str[0] == '-') {
j++;
sign = RLC_NEG;
} else {
sign = RLC_POS;
}
RLC_TRY {
bn_grow(a, RLC_CEIL(len * util_bits_dig(ra... | 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 bn_ham(const bn_t a) {
int c = 0;
for (int i = 0; i < bn_bits(a); i++) {
c += bn_get_bit(a, i);
}
return c;
} | 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 bn_set_2b(bn_t a, int b) {
int i, d;
if (b < 0) {
bn_zero(a);
} else {
RLC_RIP(b, d, b);
bn_grow(a, d + 1);
for (i = 0; i < d; i++) {
a->dp[i] = 0;
}
a->used = d + 1;
a->dp[d] = ((dig_t)1 << b);
a->sign = RLC_POS;
}
} | 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 bn_rand(bn_t a, int sign, int bits) {
int digits;
RLC_RIP(bits, digits, bits);
digits += (bits > 0 ? 1 : 0);
bn_grow(a, digits);
rand_bytes((uint8_t *)a->dp, digits * sizeof(dig_t));
a->used = digits;
a->sign = sign;
if (bits > 0) {
dig_t mask = ((dig_t)1 << (dig_t)bits) - 1;
a->dp[a->used - 1] &= ... | 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 bn_size_bin(const bn_t a) {
dig_t d;
int digits;
digits = (a->used - 1) * (RLC_DIG / 8);
d = a->dp[a->used - 1];
while (d != 0) {
d = d >> 8;
digits++;
}
return digits;
} | 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 bn_read_bin(bn_t a, const uint8_t *bin, int len) {
int i, j;
dig_t d = (RLC_DIG / 8);
int digs = (len % d == 0 ? len / d : len / d + 1);
bn_grow(a, digs);
bn_zero(a);
a->used = digs;
for (i = 0; i < digs - 1; i++) {
d = 0;
for (j = (RLC_DIG / 8) - 1; j >= 0; j--) {
d = d << 8;
d |= bin[len - 1 -... | 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 bn_write_str(char *str, int len, const bn_t a, int radix) {
bn_t t;
dig_t d;
int digits, l, i, j;
char c;
bn_null(t);
l = bn_size_str(a, radix);
if (len < l) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
if (radix < 2 || radix > 64) {
RLC_THROW(ERR_NO_VALID);
return;
}
if (bn_is_zero(a) == 1) {
*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 bn_read_raw(bn_t a, const dig_t *raw, int len) {
RLC_TRY {
bn_grow(a, len);
a->used = len;
a->sign = RLC_POS;
dv_copy(a->dp, raw, len);
bn_trim(a);
} RLC_CATCH_ANY {
RLC_THROW(ERR_CAUGHT);
}
} | 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 bn_get_bit(const bn_t a, int bit) {
int d;
if (bit < 0) {
RLC_THROW(ERR_NO_VALID);
return 0;
}
if (bit > bn_bits(a)) {
return 0;
}
RLC_RIP(bit, d, bit);
if (d >= a->used) {
return 0;
} else {
return (a->dp[d] >> bit) & (dig_t)1;
}
} | 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 cp_bls_sig(g1_t s, const uint8_t *msg, int len, const bn_t d) {
g1_t p;
int result = RLC_OK;
g1_null(p);
RLC_TRY {
g1_new(p);
g1_map(p, msg, len);
g1_mul_key(s, p, d);
}
RLC_CATCH_ANY {
result = RLC_ERR;
}
RLC_FINALLY {
g1_free(p);
}
return result;
} | 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 cp_cmlhs_sig(g1_t sig, g2_t z, g1_t a, g1_t c, g1_t r, g2_t s,
const bn_t msg, const char *data, int label, const bn_t x, const g1_t h,
const uint8_t prf[], size_t plen, const bn_t d, const bn_t sk,
int bls) {
bn_t k, m, n;
g1_t t;
uint8_t mac[RLC_MD_LEN];
int len, dlen = strlen(data), result = RLC_OK;
u... | 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 cp_cmlhs_ver(const g1_t r, const g2_t s, const g1_t sig[], const g2_t z[],
const g1_t a[], const g1_t c[], const bn_t msg, const char *data,
const g1_t h, const int label[], const gt_t *hs[], const dig_t *f[],
const size_t flen[], const g2_t y[], const g2_t pk[], size_t slen,
int bls) {
g1_t g1;
g2_t g2;
... | 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 cp_cmlhs_gen(bn_t x[], gt_t hs[], size_t len, uint8_t prf[], size_t plen,
bn_t sk, g2_t pk, bn_t d, g2_t y, int bls) {
g1_t g1;
g2_t g2;
gt_t gt;
bn_t n;
int result = RLC_OK;
g1_null(g1);
g2_null(g2);
gt_null(gt);
bn_null(n);
RLC_TRY {
bn_new(n);
g1_new(g1);
g2_new(g2);
gt_new(gt);
pc_get_o... | 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 cp_cmlhs_onv(const g1_t r, const g2_t s, const g1_t sig[], const g2_t z[],
const g1_t a[], const g1_t c[], const bn_t msg, const char *data,
const g1_t h, const gt_t vk, const g2_t y[], const g2_t pk[],
size_t slen, int bls) {
g1_t g1;
g2_t g2;
gt_t e, u, v;
bn_t k, n;
int len, dlen = strlen(data), resul... | 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 cp_rsa_gen(rsa_t pub, rsa_t prv, int bits) {
bn_t t, r;
int result = RLC_OK;
if (pub == NULL || prv == NULL || bits == 0) {
return RLC_ERR;
}
bn_null(t);
bn_null(r);
RLC_TRY {
bn_new(t);
bn_new(r);
/* Generate different primes p and q. */
do {
bn_gen_prime(prv->crt->p, bits / 2);
bn_gen_p... | 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 cp_sokaka_key(uint8_t *key, size_t key_len, const char *id1,
const sokaka_t k, const char *id2) {
int len1 = strlen(id1), len2 = strlen(id2);
int size, first = 0, result = RLC_OK;
uint8_t *buf;
g1_t p;
g2_t q;
gt_t e;
g1_null(p);
g2_null(q);
gt_null(e);
RLC_TRY {
g1_new(p);
g2_new(q);
gt_new(e);... | 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 cp_vbnn_gen_prv(bn_t sk, ec_t pk, const bn_t msk, const uint8_t *id,
size_t id_len) {
uint8_t hash[RLC_MD_LEN];
int len, result = RLC_OK;
uint8_t *buf = NULL;
bn_t n, r;
/* zero variables */
bn_null(n);
bn_null(r);
RLC_TRY {
/* initialize variables */
bn_new(n);
bn_new(r);
/* get order of ECC g... | 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 cp_vbnn_sig(ec_t r, bn_t z, bn_t h, const uint8_t *id, size_t id_len,
const uint8_t *msg, int msg_len, const bn_t sk, const ec_t pk) {
int len, result = RLC_OK;
uint8_t *buf = NULL, *buf_i, hash[RLC_MD_LEN];
bn_t n, y;
ec_t t;
/* zero variables */
bn_null(n);
bn_null(y);
ec_null(t);
RLC_TRY {
bn_new(... | 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 cp_vbnn_ver(const ec_t r, const bn_t z, const bn_t h, const uint8_t *id,
size_t id_len, const uint8_t *msg, int msg_len, const ec_t mpk) {
int len, result = 0;
uint8_t *buf = NULL, *buf_i, hash[RLC_MD_LEN];
bn_t n, c, _h;
ec_t Z;
ec_t t;
/* zero variables */
bn_null(n);
bn_null(c);
bn_null(_h);
ec_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 |
void eb_map(eb_t p, const uint8_t *msg, int len) {
bn_t k;
fb_t t0, t1;
int i;
uint8_t digest[RLC_MD_LEN];
bn_null(k);
fb_null(t0);
fb_null(t1);
RLC_TRY {
bn_new(k);
fb_new(t0);
fb_new(t1);
md_map(digest, msg, len);
bn_read_bin(k, digest, RLC_MIN(RLC_FB_BYTES, RLC_MD_LEN));
fb_set_dig(p->z, 1);
... | 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 eb_mul_lnaf_imp(eb_t r, const eb_t p, const bn_t k) {
int i, l, n;
int8_t naf[RLC_FB_BITS + 1];
eb_t t[1 << (EB_WIDTH - 2)];
RLC_TRY {
/* Prepare the precomputation table. */
for (i = 0; i < (1 << (EB_WIDTH - 2)); i++) {
eb_null(t[i]);
eb_new(t[i]);
eb_set_infty(t[i]);
fb_set_dig(t[i]->... | 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 eb_mul_ltnaf_imp(eb_t r, const eb_t p, const bn_t k) {
int i, l, n;
int8_t tnaf[RLC_FB_BITS + 8], u;
eb_t t[1 << (EB_WIDTH - 2)];
if (eb_curve_opt_a() == RLC_ZERO) {
u = -1;
} else {
u = 1;
}
RLC_TRY {
/* Prepare the precomputation table. */
for (i = 0; i < (1 << (EB_WIDTH - 2)); i++) {
... | 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 eb_mul_sim_joint(eb_t r, const eb_t p, const bn_t k, const eb_t q,
const bn_t m) {
eb_t t[5];
int i, u_i, len, offset;
int8_t jsf[2 * (RLC_FB_BITS + 1)];
if (bn_is_zero(k) || eb_is_infty(p)) {
eb_mul(r, q, m);
return;
}
if (bn_is_zero(m) || eb_is_infty(q)) {
eb_mul(r, p, k);
return;
}
RLC_TRY {... | 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 eb_mul_sim_trick(eb_t r, const eb_t p, const bn_t k, const eb_t q,
const bn_t m) {
eb_t t0[1 << (EB_WIDTH / 2)], t1[1 << (EB_WIDTH / 2)], t[1 << EB_WIDTH];
int l0, l1, w = EB_WIDTH / 2;
uint8_t w0[RLC_FB_BITS], w1[RLC_FB_BITS];
bn_t n;
bn_null(n);
if (bn_is_zero(k) || eb_is_infty(p)) {
eb_mul(r, q, m);... | 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 eb_mul_sim_plain(eb_t r, const eb_t p, const bn_t k, const eb_t q,
const bn_t m, const eb_t *t) {
int i, l, l0, l1, n0, n1, w, g;
int8_t naf0[RLC_FB_BITS + 1], naf1[RLC_FB_BITS + 1], *_k, *_m;
eb_t t0[1 << (EB_WIDTH - 2)];
eb_t t1[1 << (EB_WIDTH - 2)];
for (i = 0; i < (1 << (EB_WIDTH - 2)); i++) {
... | 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 eb_read_bin(eb_t a, const uint8_t *bin, int len) {
if (len == 1) {
if (bin[0] == 0) {
eb_set_infty(a);
return;
} else {
RLC_THROW(ERR_NO_BUFFER);
return;
}
}
if (len != (RLC_FB_BYTES + 1) && len != (2 * RLC_FB_BYTES + 1)) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
a->coord = BASIC;
fb_set_... | 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 eb_write_bin(uint8_t *bin, int len, const eb_t a, int pack) {
eb_t t;
eb_null(t);
memset(bin, 0, len);
if (eb_is_infty(a)) {
if (len < 1) {
RLC_THROW(ERR_NO_BUFFER);
return;
} else {
return;
}
}
RLC_TRY {
eb_new(t);
eb_norm(t, a);
if (pack) {
if (len < RLC_FB_BYTES + 1) {
RL... | 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 ed_map_dst(ed_t p, const uint8_t *msg, int len, const uint8_t *dst, int dst_len) {
bn_t k;
fp_t t;
ed_t q;
/* enough space for two field elements plus extra bytes for uniformity */
const int len_per_elm = (FP_PRIME + ed_param_level() + 7) / 8;
uint8_t *pseudo_random_bytes = RLC_ALLOCA(uint8_t, 2 * len_per_el... | 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 ed_map(ed_t p, const uint8_t *msg, int len) {
ed_map_dst(p, msg, len, (const uint8_t *)"RELIC", 5);
} | 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 ed_mul_reg_imp(ed_t r, const ed_t p, const bn_t k) {
bn_t _k;
int i, j, l, n;
int8_t s, reg[RLC_CEIL(RLC_FP_BITS + 1, ED_WIDTH - 1)];
ed_t t[1 << (ED_WIDTH - 2)], u, v;
bn_null(_k);
if (bn_is_zero(k)) {
ed_set_infty(r);
return;
}
RLC_TRY {
bn_new(_k);
ed_new(u);
ed_new(v);
/* Prepare t... | 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 ed_mul_slide(ed_t r, const ed_t p, const bn_t k) {
ed_t t[1 << (EP_WIDTH - 1)], q;
int i, j, l;
uint8_t win[RLC_FP_BITS + 1];
ed_null(q);
if (bn_is_zero(k) || ed_is_infty(p)) {
ed_set_infty(r);
return;
}
RLC_TRY {
for (i = 0; i < (1 << (EP_WIDTH - 1)); i ++) {
ed_null(t[i]);
ed_new(t[i]);
}... | 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 ed_mul_dig(ed_t r, const ed_t p, dig_t k) {
ed_t t;
bn_t _k;
int8_t u, naf[RLC_DIG + 1];
int l;
ed_null(t);
bn_null(_k);
if (k == 0 || ed_is_infty(p)) {
ed_set_infty(r);
return;
}
RLC_TRY {
ed_new(t);
bn_new(_k);
bn_set_dig(_k, k);
l = RLC_DIG + 1;
bn_rec_naf(naf, &l, _k, 2);
ed_set_... | 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 ed_mul_naf_imp(ed_t r, const ed_t p, const bn_t k) {
int l, i, n;
int8_t naf[RLC_FP_BITS + 1];
ed_t t[1 << (ED_WIDTH - 2)];
if (bn_is_zero(k)) {
ed_set_infty(r);
return;
}
RLC_TRY {
/* Prepare the precomputation table. */
for (i = 0; i < (1 << (ED_WIDTH - 2)); i++) {
ed_null(t[i]);
ed_... | 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 ed_mul_fix_plain(ed_t r, const ed_t * t, const bn_t k) {
int l, i, n;
int8_t naf[RLC_FP_BITS + 1], *_k;
/* Compute the w-TNAF representation of k. */
l = RLC_FP_BITS + 1;
bn_rec_naf(naf, &l, k, ED_DEPTH);
_k = naf + l - 1;
ed_set_infty(r);
for (i = l - 1; i >= 0; i--, _k--) {
n = *_k;
if (n ==... | 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 ed_mul_sim_lot(ed_t r, const ed_t p[], const bn_t k[], int n) {
int i, j, l, *_l = RLC_ALLOCA(int, n);
ed_t *_p = RLC_ALLOCA(ed_t, n);
int8_t *naf = NULL;
RLC_TRY {
l = 0;
for (i = 0; i < n; i++) {
l = RLC_MAX(l, bn_bits(k[i]) + 1);
}
naf = RLC_ALLOCA(int8_t, n * l);
if (naf == NULL || _p == 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 |
void ed_mul_sim_joint(ed_t r, const ed_t p, const bn_t k, const ed_t q,
const bn_t m) {
ed_t t[5];
int i, l, u_i, offset;
int8_t jsf[2 * (RLC_FP_BITS + 1)];
if (bn_is_zero(k) || ed_is_infty(p)) {
ed_mul(r, q, m);
return;
}
if (bn_is_zero(m) || ed_is_infty(q)) {
ed_mul(r, p, k);
return;
}
RLC_TRY {
... | 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 ed_mul_sim_plain(ed_t r, const ed_t p, const bn_t k, const ed_t q,
const bn_t m, const ed_t *t) {
int i, l, l0, l1, n0, n1, w, gen;
int8_t naf0[RLC_FP_BITS + 1], naf1[RLC_FP_BITS + 1], *_k, *_m;
ed_t t0[1 << (ED_WIDTH - 2)];
ed_t t1[1 << (ED_WIDTH - 2)];
RLC_TRY {
gen = (t == NULL ? 0 : 1);
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 |
void ed_mul_sim_trick(ed_t r, const ed_t p, const bn_t k, const ed_t q,
const bn_t m) {
ed_t t0[1 << (ED_WIDTH / 2)], t1[1 << (ED_WIDTH / 2)], t[1 << ED_WIDTH];
bn_t n;
int l0, l1, w = ED_WIDTH / 2;
uint8_t w0[RLC_FP_BITS + 1], w1[RLC_FP_BITS + 1];
bn_null(n);
if (bn_is_zero(k) || ed_is_infty(p)) {
ed_mul(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 ed_read_bin(ed_t a, const uint8_t *bin, int len) {
if (len == 1) {
if (bin[0] == 0) {
ed_set_infty(a);
return;
} else {
RLC_THROW(ERR_NO_BUFFER);
return;
}
}
if (len != (RLC_FP_BYTES + 1) && len != (2 * RLC_FP_BYTES + 1)) {
RLC_THROW(ERR_NO_BUFFER);
return;
}
a->coord = BASIC;
fp_set_... | 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 ed_write_bin(uint8_t *bin, int len, const ed_t a, int pack) {
ed_t t;
ed_null(t);
memset(bin, 0, len);
if (ed_is_infty(a)) {
if (len < 1) {
RLC_THROW(ERR_NO_BUFFER);
return;
} else {
return;
}
}
RLC_TRY {
ed_new(t);
ed_norm(t, a);
if (pack) {
if (len < RLC_FP_BYTES + 1) {
RL... | 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 ep_map_dst(ep_t p, const uint8_t *msg, int len, const uint8_t *dst,
int dst_len) {
/* enough space for two field elements plus extra bytes for uniformity */
const int len_per_elm = (FP_PRIME + ep_param_level() + 7) / 8;
uint8_t *pseudo_random_bytes = RLC_ALLOCA(uint8_t, 2 * len_per_elm);
RLC_TRY {
/* for... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.