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/slirp4netns-1.0.1/api.c
Examining data/slirp4netns-1.0.1/api.h
Examining data/slirp4netns-1.0.1/main.c
Examining data/slirp4netns-1.0.1/sandbox.c
Examining data/slirp4netns-1.0.1/sandbox.h
Examining data/slirp4netns-1.0.1/seccompfilter.c
Examining data/slirp4netns-1.0.1/seccompfilter.h
Examining data/slirp4netns-1.0.1/slirp4netns.c
Examining data/slirp4netns-1.0.1/slirp4netns.h
Examining data/slirp4netns-1.0.1/vendor/parson/parson.c
Examining data/slirp4netns-1.0.1/vendor/parson/parson.h

FINAL RESULTS:

data/slirp4netns-1.0.1/main.c:508:17:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
            if (access(optarg_userns_path, F_OK) == -1) {
data/slirp4netns-1.0.1/main.c:566:13:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
        if (access(options->netns_path, F_OK) == -1) {
data/slirp4netns-1.0.1/vendor/parson/parson.c:42:9:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
#define sscanf THINK_TWICE_ABOUT_USING_SSCANF
data/slirp4netns-1.0.1/vendor/parson/parson.c:996:23:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
            written = sprintf(num_buf, FLOAT_FORMAT, num);
data/slirp4netns-1.0.1/vendor/parson/parson.c:1095:12:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
    return sprintf(buf, "%s", string);
data/slirp4netns-1.0.1/main.c:445:19:  [3] (buffer) getopt_long:
  Some older implementations do not protect against internal buffer overflows
  (CWE-120, CWE-20). Check implementation on installation, or limit the size
  of all string inputs.
    while ((opt = getopt_long(argc, argv, "ce:r:m:a:6hv", longopts, NULL)) !=
data/slirp4netns-1.0.1/sandbox.c:53:15:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
    char *p = realpath("/etc/resolv.conf", NULL);
data/slirp4netns-1.0.1/api.c:98: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 idbuf[64];
data/slirp4netns-1.0.1/api.c:188: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 host_addr[INET_ADDRSTRLEN], guest_addr[INET_ADDRSTRLEN];
data/slirp4netns-1.0.1/main.c:53:36:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    if (!only_userns && (netnsfd = open(netns, O_RDONLY)) < 0) {
data/slirp4netns-1.0.1/main.c:57:31:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    if (userns && (usernsfd = open(userns, O_RDONLY)) < 0) {
data/slirp4netns-1.0.1/main.c:82:15:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    if ((fd = open("/dev/net/tun", O_RDWR)) < 0) {
data/slirp4netns-1.0.1/main.c:102: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 cmsgbuf[CMSG_SPACE(sizeof(fd))];
data/slirp4netns-1.0.1/main.c:116: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(CMSG_DATA(cmsg), &fd, sizeof(fd));
data/slirp4netns-1.0.1/main.c:228: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 cmsgbuf[CMSG_SPACE(sizeof(fd))];
data/slirp4netns-1.0.1/main.c:599: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 snetwork[16], sprefix[16];
data/slirp4netns-1.0.1/vendor/parson/parson.c:159: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(output_string, string, n);
data/slirp4netns-1.0.1/vendor/parson/parson.c:279:16:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    FILE *fp = fopen(filename, "r");
data/slirp4netns-1.0.1/vendor/parson/parson.c:411:9:  [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(temp_names, object->names, object->count * sizeof(char*));
data/slirp4netns-1.0.1/vendor/parson/parson.c:412:9:  [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(temp_values, object->values, object->count * sizeof(JSON_Value*));
data/slirp4netns-1.0.1/vendor/parson/parson.c:521:9:  [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(new_items, array->items, array->count * sizeof(JSON_Value*));
data/slirp4netns-1.0.1/vendor/parson/parson.c:666: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(resized_output, output, final_size);
data/slirp4netns-1.0.1/vendor/parson/parson.c:1497: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 num_buf[NUM_BUF_SIZE]; /* recursively allocating buffer on stack is a bad idea, so let's do it only once */
data/slirp4netns-1.0.1/vendor/parson/parson.c:1522:10:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    fp = fopen(filename, "w");
data/slirp4netns-1.0.1/vendor/parson/parson.c:1557: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 num_buf[NUM_BUF_SIZE]; /* recursively allocating buffer on stack is a bad idea, so let's do it only once */
data/slirp4netns-1.0.1/vendor/parson/parson.c:1582:10:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
    fp = fopen(filename, "w");
data/slirp4netns-1.0.1/api.c:24:9:  [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).
    if (strlen(api_socket) >= sizeof(addr.sun_path)) {
data/slirp4netns-1.0.1/api.c:29:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(addr.sun_path, api_socket, sizeof(addr.sun_path) - 1);
data/slirp4netns-1.0.1/api.c:118:30:  [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).
        wrc = write(fd, err, strlen(err));
data/slirp4netns-1.0.1/api.c:128:30:  [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).
        wrc = write(fd, err, strlen(err));
data/slirp4netns-1.0.1/api.c:136:30:  [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).
        wrc = write(fd, err, strlen(err));
data/slirp4netns-1.0.1/api.c:146:30:  [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).
        wrc = write(fd, err, strlen(err));
data/slirp4netns-1.0.1/api.c:155:30:  [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).
        wrc = write(fd, err, strlen(err));
data/slirp4netns-1.0.1/api.c:164:30:  [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).
        wrc = write(fd, err, strlen(err));
data/slirp4netns-1.0.1/api.c:176:28:  [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).
    wrc = write(fd, idbuf, strlen(idbuf));
data/slirp4netns-1.0.1/api.c:229:40:  [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).
    wrc = write(fd, serialized_string, strlen(serialized_string));
data/slirp4netns-1.0.1/api.c:257:30:  [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).
        wrc = write(fd, err, strlen(err));
data/slirp4netns-1.0.1/api.c:265:34:  [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).
            wrc = write(fd, err, strlen(err));
data/slirp4netns-1.0.1/api.c:269:37:  [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).
            wrc = write(fd, api_ok, strlen(api_ok));
data/slirp4netns-1.0.1/api.c:284:30:  [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).
        wrc = write(fd, err, strlen(err));
data/slirp4netns-1.0.1/api.c:290:30:  [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).
        wrc = write(fd, err, strlen(err));
data/slirp4netns-1.0.1/api.c:297:30:  [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).
        wrc = write(fd, err, strlen(err));
data/slirp4netns-1.0.1/api.c:309:30:  [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).
        wrc = write(fd, err, strlen(err));
data/slirp4netns-1.0.1/api.c:335:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
    if ((len = read(fd, ctx->buf, ctx->buflen)) < 0) {
data/slirp4netns-1.0.1/api.c:344:30:  [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).
        wrc = write(fd, err, strlen(err));
data/slirp4netns-1.0.1/main.c:88:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(ifr.ifr_name, tapname, sizeof(ifr.ifr_name) - 1);
data/slirp4netns-1.0.1/main.c:148:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(ifr.ifr_name, tapname, sizeof(ifr.ifr_name) - 1);
data/slirp4netns-1.0.1/main.c:587:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(buf, &orig[match.rm_so], len);
data/slirp4netns-1.0.1/slirp4netns.c:368:26:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
            ssize_t rc = read(tapfd, buf, ETH_BUF_SIZE);
data/slirp4netns-1.0.1/vendor/parson/parson.c:164:35:  [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 parson_strndup(string, strlen(string));
data/slirp4netns-1.0.1/vendor/parson/parson.c:315:30:  [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).
    size_t start_token_len = strlen(start_token);
data/slirp4netns-1.0.1/vendor/parson/parson.c:316:28:  [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).
    size_t end_token_len = strlen(end_token);
data/slirp4netns-1.0.1/vendor/parson/parson.c:364:43:  [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 json_object_addn(object, name, strlen(name), value);
data/slirp4netns-1.0.1/vendor/parson/parson.c:425:23:  [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).
        name_length = strlen(object->names[i]);
data/slirp4netns-1.0.1/vendor/parson/parson.c:1016:25:  [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).
    size_t i = 0, len = strlen(string);
data/slirp4netns-1.0.1/vendor/parson/parson.c:1093:21:  [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 (int)strlen(string);
data/slirp4netns-1.0.1/vendor/parson/parson.c:1155:49:  [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 json_object_getn_value(object, name, strlen(name));
data/slirp4netns-1.0.1/vendor/parson/parson.c:1366:18:  [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).
    string_len = strlen(string);

ANALYSIS SUMMARY:

Hits = 58
Lines analyzed = 4134 in approximately 0.14 seconds (30600 lines/second)
Physical Source Lines of Code (SLOC) = 3569
Hits@level = [0]  98 [1]  32 [2]  19 [3]   2 [4]   5 [5]   0
Hits@level+ = [0+] 156 [1+]  58 [2+]  26 [3+]   7 [4+]   5 [5+]   0
Hits/KSLOC@level+ = [0+] 43.7097 [1+] 16.2511 [2+] 7.28495 [3+] 1.96133 [4+] 1.40095 [5+]   0
Dot directories skipped = 2 (--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.