Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler.
Number of rules (primarily dangerous function names) in C/C++ ruleset: 223
Examining data/asyncpg-0.21.0/asyncpg/pgproto/debug.h
Examining data/asyncpg-0.21.0/asyncpg/pgproto/hton.h
Examining data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c
Examining data/asyncpg-0.21.0/asyncpg/pgproto/tohex.h
Examining data/asyncpg-0.21.0/asyncpg/protocol/protocol.c
Examining data/asyncpg-0.21.0/asyncpg/protocol/record/recordobj.c
Examining data/asyncpg-0.21.0/asyncpg/protocol/record/recordobj.h

FINAL RESULTS:

data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:811:5:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:24947:14:  [4] (format) snprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
      (void)(snprintf(__pyx_v_bufptr, (((size_t)__pyx_v_exponent_chars) + 1), ((char const *)"%d"), ((int)__pyx_v_abs_exponent)));
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:811:5:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:39509:18:  [3] (random) setstate:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
            if (!setstate) PyErr_Clear();
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:39510:18:  [3] (random) setstate:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:39510:58:  [3] (random) setstate:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:39515:29:  [3] (random) setstate:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
                } else if (!setstate || PyErr_Occurred()) {
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:39535:16:  [3] (random) setstate:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    Py_XDECREF(setstate);
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:86407:18:  [3] (random) setstate:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
            if (!setstate) PyErr_Clear();
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:86408:18:  [3] (random) setstate:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:86408:58:  [3] (random) setstate:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:86413:29:  [3] (random) setstate:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
                } else if (!setstate || PyErr_Occurred()) {
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:86433:16:  [3] (random) setstate:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
    Py_XDECREF(setstate);
data/asyncpg-0.21.0/asyncpg/pgproto/hton.h:129:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(buf, &nx, sizeof(uint16_t));
data/asyncpg-0.21.0/asyncpg/pgproto/hton.h:137:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(buf, &nx, sizeof(uint32_t));
data/asyncpg-0.21.0/asyncpg/pgproto/hton.h:145:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy(buf, &nx, sizeof(uint64_t));
data/asyncpg-0.21.0/asyncpg/pgproto/hton.h:154:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy((char *)&nx, buf, sizeof(uint16_t));
data/asyncpg-0.21.0/asyncpg/pgproto/hton.h:170:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy((char *)&nx, buf, sizeof(uint32_t));
data/asyncpg-0.21.0/asyncpg/pgproto/hton.h:185:5:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    memcpy((char *)&nx, buf, sizeof(uint64_t));
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:764:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char ascii_chars[128];
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:973:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char _smallbuf[0x400];
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:1042:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char _data[16];
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:1976:8:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static char __pyx_v_7asyncpg_7pgproto_7pgproto__hextable[0x100];
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:3423:12:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    (void)(memcpy(__pyx_v_new_buf, __pyx_v_self->_buf, ((size_t)__pyx_v_self->_size)));
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:4025:10:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  (void)(memcpy((__pyx_v_self->_buf + __pyx_v_self->_length), ((void *)__pyx_v_buf->_buf), ((size_t)__pyx_v_buf->_length)));
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:4567:10:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  (void)(memcpy((__pyx_v_self->_buf + __pyx_v_self->_length), ((void *)__pyx_v_data), ((size_t)__pyx_v_len)));
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:6386:14:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
      (void)(memcpy(__pyx_v_buf, (__pyx_v_buf0 + __pyx_v_self->_pos0), ((size_t)__pyx_v_nread)));
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:6454:14:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
      (void)(memcpy(__pyx_v_buf, (__pyx_v_buf0 + __pyx_v_self->_pos0), ((size_t)__pyx_v_nbytes)));
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:12032:10:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  (void)(memcpy(__pyx_v_u->_data, __pyx_v_buf, 16));
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:12274:12:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
    (void)(memcpy(__pyx_v_self->_data, __pyx_v_buf, 16));
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:12673:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char __pyx_v_out[36];
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:12754:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char __pyx_v_out[32];
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:16130:97:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    __pyx_t_6 = PyUnicode_AsUTF8AndSize(__pyx_v_obj, __pyx_v_size); if (unlikely(__pyx_t_6 == ((char const *)NULL))) __PYX_ERR(7, 15, __pyx_L1_error)
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:22878:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char __pyx_v_buf[16];
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:24063:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char __pyx_v_smallbuf[0x100];
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:35733:10:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  static char __pyx_t_3[256];
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:36186:3:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
  memcpy(&(__pyx_v_7asyncpg_7pgproto_7pgproto__hextable[0]), __pyx_t_3, sizeof(__pyx_v_7asyncpg_7pgproto_7pgproto__hextable[0]) * (256));
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:37065:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static const char DIGIT_PAIRS_10[2*10*10+1] = {
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:37077:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static const char DIGIT_PAIRS_8[2*8*8+1] = {
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:37087:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static const char DIGITS_HEX[2*16+1] = {
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:37182:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char digits[sizeof(Py_ssize_t)*3+2];
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:37290:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind));
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:39557:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char warning[200];
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:42111:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char ctversion[4], rtversion[4];
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:42115:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char message[200];
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:764:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char ascii_chars[128];
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:1265:3:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
  char _smallbuf[0x400];
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:25099:106:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    __pyx_t_1 = __pyx_f_7asyncpg_7pgproto_7pgproto_frb_read(__pyx_v_buf, 4); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(5, 300, __pyx_L1_error)
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:82925:13:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
            memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind));
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:83505:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static const char DIGIT_PAIRS_10[2*10*10+1] = {
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:83517:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static const char DIGIT_PAIRS_8[2*8*8+1] = {
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:83527:14:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
static const char DIGITS_HEX[2*16+1] = {
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:83622:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char digits[sizeof(enum __pyx_t_7asyncpg_8protocol_8protocol_ProtocolState)*3+2];
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:86455:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char warning[200];
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:89998:5:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
    char ctversion[4], rtversion[4];
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:90002:9:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
        char message[200];
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:688:87:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:809:52:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
data/asyncpg-0.21.0/asyncpg/pgproto/pgproto.c:42196:65:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:688:87:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:809:52:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
data/asyncpg-0.21.0/asyncpg/protocol/protocol.c:90131:65:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));

ANALYSIS SUMMARY:

Hits = 62
Lines analyzed = 134082 in approximately 3.40 seconds (39417 lines/second)
Physical Source Lines of Code (SLOC) = 80931
Hits@level = [0]   0 [1]   6 [2]  43 [3]  10 [4]   3 [5]   0
Hits@level+ = [0+]  62 [1+]  62 [2+]  56 [3+]  13 [4+]   3 [5+]   0
Hits/KSLOC@level+ = [0+] 0.766085 [1+] 0.766085 [2+] 0.691947 [3+] 0.160631 [4+] 0.0370686 [5+]   0
Dot directories skipped = 1 (--followdotdir overrides)
Minimum risk level = 1
Not every hit is necessarily a security vulnerability.
There may be other security vulnerabilities; review your code!
See 'Secure Programming HOWTO'
(https://dwheeler.com/secure-programs) for more information.