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/puf-1.0.0/src/puf.c Examining data/puf-1.0.0/src/puf.h Examining data/puf-1.0.0/src/util_date.c Examining data/puf-1.0.0/src/recurse.c Examining data/puf-1.0.0/src/getopts.c Examining data/puf-1.0.0/src/http_rsp.c Examining data/puf-1.0.0/src/http_conn.c Examining data/puf-1.0.0/src/http_req.c Examining data/puf-1.0.0/src/fetch.c Examining data/puf-1.0.0/src/hostlist.c Examining data/puf-1.0.0/src/url.c FINAL RESULTS: data/puf-1.0.0/src/getopts.c:159:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, va); data/puf-1.0.0/src/getopts.c:533:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(ona, "%s %s", options[i].opt, onams[options[i].todo]); data/puf-1.0.0/src/http_req.c:23:5: [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. snprintf(http_agent, SHORTSTR, PACKAGE "/" VERSION " (%s %s; %s)", data/puf-1.0.0/src/http_req.c:121:5: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(tmp, au->url->port == 80 ? "%s" : "%s:%hi", data/puf-1.0.0/src/http_req.c:127:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. pos = sprintf(buf, "GET http://%s/%s HTTP/1.0\r\nHost: %s\r\n", data/puf-1.0.0/src/http_req.c:130:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. pos += sprintf(buf + pos, "Proxy-Authorization: Basic %s\r\n", data/puf-1.0.0/src/http_req.c:134:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. pos = sprintf(buf, "GET /%s HTTP/1.0\r\nHost: %s\r\n", data/puf-1.0.0/src/http_req.c:152:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. pos += sprintf(buf + pos, "User-Agent: %s\r\n", agnt); data/puf-1.0.0/src/http_req.c:158:9: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. pos += sprintf(buf + pos, au->url->parm->opt->max_bytes ? data/puf-1.0.0/src/http_req.c:173:9: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. pos += sprintf(buf + pos, topo, tmp); data/puf-1.0.0/src/http_req.c:178:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. pos += sprintf(buf + pos, "Referer: %s\r\n", tmp); data/puf-1.0.0/src/http_req.c:183:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf + pos, "Authorization: Basic %s\r\n", data/puf-1.0.0/src/http_req.c:214:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. pos += sprintf(buf + pos, "%s\r\n", data/puf-1.0.0/src/http_rsp.c:527:7: [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. If the scanf format is influenceable by an attacker, it's exploitable. sscanf(bufp + o, SOFFT, &(au->size_total)); data/puf-1.0.0/src/http_rsp.c:557:10: [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. If the scanf format is influenceable by an attacker, it's exploitable. if(sscanf(bufp + o, "bytes "SOFFT"-"SOFFT"/"SOFFT, data/puf-1.0.0/src/puf.c:55:2: [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(buf + fl, pt + 2); data/puf-1.0.0/src/puf.c:83:2: [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. snprintf(fmt, sizeof(fmt), data/puf-1.0.0/src/puf.c:86:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, expand_url(tbuf, u, fmt), va); data/puf-1.0.0/src/puf.c:112:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, va); data/puf-1.0.0/src/puf.c:122:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, msg, va); data/puf-1.0.0/src/puf.c:134:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, expand_url(tbuf, u, fmt), va); data/puf-1.0.0/src/puf.c:145:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, expand_url(tbuf, u, msg), va); data/puf-1.0.0/src/puf.c:160:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, va); data/puf-1.0.0/src/puf.c:174:2: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, expand_url(tbuf, u, fmt), va); data/puf-1.0.0/src/puf.c:188:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, fmt, va); data/puf-1.0.0/src/puf.c:304:2: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(PACKAGE " v" VERSION data/puf-1.0.0/src/getopts.c:377:41: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (!lopt->proxies->nents && (ptr = getenv("http_proxy")) && data/puf-1.0.0/src/puf.c:317:5: [3] (random) srand: 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. srand(time(0)); data/puf-1.0.0/src/fetch.c:83:2: [2] (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). Risk is low because the source is a constant string. strcpy(d, "??:??"); data/puf-1.0.0/src/fetch.c:85:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(d, "%02d:%02d", ti / 60, ti % 60); data/puf-1.0.0/src/fetch.c:87:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(d, "%02dh%02d", ti / 3600, ti / 60 % 60); data/puf-1.0.0/src/fetch.c:89:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(d, "%dd%02d", ti / 86400, ti / 3600 % 24); data/puf-1.0.0/src/fetch.c:91:2: [2] (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). Risk is low because the source is a constant string. strcpy(d, "> 99d"); data/puf-1.0.0/src/fetch.c:318:6: [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 estts[10], totts[10]; data/puf-1.0.0/src/getopts.c:146: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 fmt[SHORTSTR], qargfn[SHORTSTR]; data/puf-1.0.0/src/getopts.c:219:2: [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(narr->ents, (*arr)->ents, narr->nents * sz); data/puf-1.0.0/src/getopts.c:295: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(parm, lparm, sizeof(*parm)); data/puf-1.0.0/src/getopts.c:310: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(opt, lopt, sizeof(*opt)); data/puf-1.0.0/src/getopts.c:346: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 (&lopt->disp_path->path, path, len); data/puf-1.0.0/src/getopts.c:361: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(parm->disposition->disp, dbuf, len + 1); data/puf-1.0.0/src/getopts.c:372: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 buf[SHORTSTR], dbuf[20]; data/puf-1.0.0/src/getopts.c:414:23: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. set_disp(parm, dbuf, sprintf(dbuf, "%d.puf", data/puf-1.0.0/src/getopts.c:474:10: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). ratio = atoi(ptr + 1); data/puf-1.0.0/src/getopts.c:511: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(ag->agent, agent, len); data/puf-1.0.0/src/getopts.c:528: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 ona[SHORTSTR]; data/puf-1.0.0/src/getopts.c:637: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 buf[SHORTSTR], cbuf[SHORTSTR]; data/puf-1.0.0/src/getopts.c:747:6: [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 **)options[i].argptr = argfn ? istrdup(arg2) : arg2; data/puf-1.0.0/src/getopts.c:785:14: [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). if (!(f = fopen(arg2, "r"))) data/puf-1.0.0/src/getopts.c:798:14: [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). if (!(f = fopen(arg2, "r"))) data/puf-1.0.0/src/getopts.c:811:14: [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). if (!(f = fopen(arg2, "r"))) data/puf-1.0.0/src/getopts.c:822:18: [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). if (!(f = fopen(arg2, "r"))) data/puf-1.0.0/src/getopts.c:847:4: [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(filter->data, arg2, i + 1); data/puf-1.0.0/src/hostlist.c:33:2: [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(h->name, name, len); data/puf-1.0.0/src/hostlist.c:243: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 buf[1024]; data/puf-1.0.0/src/hostlist.c:306:7: [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 + cp, he->h_addr_list[na], he->h_length); data/puf-1.0.0/src/http_conn.c:97: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 buf[SHORTSTR]; data/puf-1.0.0/src/http_conn.c:254: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(buf, buf + ql, dl); data/puf-1.0.0/src/http_conn.c:277:6: [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 + dl, PART_EXT, sizeof(PART_EXT)); data/puf-1.0.0/src/http_conn.c:302: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(au->disposition, buf, dl); data/puf-1.0.0/src/http_conn.c:303: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(au->disposition + dl, PART_EXT, sizeof(PART_EXT)); data/puf-1.0.0/src/http_req.c:20: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 http_agent[SHORTSTR]; data/puf-1.0.0/src/http_req.c:34:12: [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 tbl[64] = { data/puf-1.0.0/src/http_req.c:70:12: [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 tbl[128] = { data/puf-1.0.0/src/http_req.c:106: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 buf[MAXBUFSIZE], tmp[SHORTSTR]; data/puf-1.0.0/src/http_req.c:165:13: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. pos += sprintf(buf + pos, "Range: bytes=0-"SOFFT"\r\n", data/puf-1.0.0/src/http_req.c:219:12: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. pos += sprintf(buf + pos, "Connection: close\r\n\r\n"); data/puf-1.0.0/src/http_rsp.c:48: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 ((fi = open(name, flags, 0666)) < 0) { data/puf-1.0.0/src/http_rsp.c:118:2: [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(bp, buf, len); data/puf-1.0.0/src/http_rsp.c:124:2: [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(au->buffer, buf, len); data/puf-1.0.0/src/http_rsp.c:158: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 buf[SHORTSTR]; data/puf-1.0.0/src/http_rsp.c:213: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 buf[SHORTSTR]; data/puf-1.0.0/src/http_rsp.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 buf[64]; data/puf-1.0.0/src/http_rsp.c:241:22: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. safe_write(fi, buf, sprintf(buf, "Status: %d\n\n", sts)); data/puf-1.0.0/src/http_rsp.c:251: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 buf[64]; data/puf-1.0.0/src/http_rsp.c:258:22: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. safe_write(fi, buf, sprintf(buf, "Status: %d\n\n", sts)); data/puf-1.0.0/src/http_rsp.c:282: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 buf[SHORTSTR]; data/puf-1.0.0/src/http_rsp.c:308: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 databuf[OVERLAPLEN + MAXBUFSIZE], buf[SHORTSTR]; data/puf-1.0.0/src/http_rsp.c:328:7: [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(nbuf + au->offset, bufp, orglen); data/puf-1.0.0/src/http_rsp.c:334: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(bufp, au->buffer, au->offset); data/puf-1.0.0/src/http_rsp.c:368:30: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). au->http_result_code = atoi(bufp + a + 9); data/puf-1.0.0/src/http_rsp.c:461:4: [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(au->headers + au->hdrslen, bufp + a, e - a); data/puf-1.0.0/src/http_rsp.c:517:8: [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(au->auth_chall, bufp + o + j, e - j - o); data/puf-1.0.0/src/http_rsp.c:705: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(buffe->data, bufp, alen); data/puf-1.0.0/src/http_rsp.c:719:2: [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(buffe->data, bufp, alen); data/puf-1.0.0/src/http_rsp.c:736:22: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. safe_write(fi, buf, sprintf(buf, "Content-Length: %lu\n\n", data/puf-1.0.0/src/http_rsp.c:744: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, au->disposition, au->displen); data/puf-1.0.0/src/http_rsp.c:755:2: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(buf, ".hdr"); data/puf-1.0.0/src/puf.c:29:2: [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(rt, s, l); data/puf-1.0.0/src/puf.c:45:6: [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 + 2 * SHORTSTR + FMTLEN - 4, "...", 4); data/puf-1.0.0/src/puf.c:49:2: [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, msg, fl); data/puf-1.0.0/src/puf.c:65: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 tbuf[2 * SHORTSTR + FMTLEN], fmt[SHORTSTR]; data/puf-1.0.0/src/puf.c:108: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 fmt[SHORTSTR]; data/puf-1.0.0/src/puf.c:130: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 tbuf[2 * SHORTSTR + FMTLEN], fmt[SHORTSTR]; data/puf-1.0.0/src/puf.c:142: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 tbuf[2 * SHORTSTR + FMTLEN]; data/puf-1.0.0/src/puf.c:155: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 fmt[SHORTSTR]; data/puf-1.0.0/src/puf.c:169: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 tbuf[2 * SHORTSTR + FMTLEN], fmt[SHORTSTR]; data/puf-1.0.0/src/puf.c:183: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 fmt[SHORTSTR]; data/puf-1.0.0/src/puf.h:140: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 name[0]; data/puf-1.0.0/src/puf.h:151: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 cgi_path[0]; /* Only for "cgi-proxies" */ data/puf-1.0.0/src/puf.h:170: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 agent[0]; data/puf-1.0.0/src/puf.h:184: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 path[0]; data/puf-1.0.0/src/puf.h:193: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 data[0]; data/puf-1.0.0/src/puf.h:246: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 disp[0]; data/puf-1.0.0/src/puf.h:278: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 local_part[0]; /* Variable length local part */ data/puf-1.0.0/src/puf.h:293: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 data[0]; data/puf-1.0.0/src/puf.h:341: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 disposition[0]; /* Local file name */ data/puf-1.0.0/src/puf.h:572:46: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #define cat_mem(b,l,ml,m) do { int _ml = ml; memcpy(b + l, m, _ml); l += _ml; } while(0) data/puf-1.0.0/src/puf.h:576:68: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #define lcat_mem(b,bl,l,ml,m) do { int _ml = ml; if (l + _ml < bl) memcpy(b + l, m, _ml); l += _ml; } while(0) data/puf-1.0.0/src/recurse.c:91: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 lbuf[MAXBUFSIZE + OVERLAPLEN]; data/puf-1.0.0/src/recurse.c:122: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 buf[MAXBUFSIZE]; data/puf-1.0.0/src/recurse.c:143:2: [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, buf + MAXBUFSIZE - OVERLAPLEN, off = OVERLAPLEN); data/puf-1.0.0/src/recurse.c:150:2: [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(*bupo, buf + off, len); data/puf-1.0.0/src/url.c:141: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 abuf[SHORTSTR]; data/puf-1.0.0/src/url.c:151:26: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. lcat_mem(buf, bufl, dl, sprintf(abuf, ":%d", u->port), abuf); data/puf-1.0.0/src/url.c:163: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 fmt[128]; data/puf-1.0.0/src/url.c:192:2: [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(b + pu->lpartlen, aoff, alen); data/puf-1.0.0/src/url.c:301:19: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). if (!(pu->port = atoi(url + po + 1))) { data/puf-1.0.0/src/url.c:399:6: [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(lpbuf, ref->local_part, oplen); data/puf-1.0.0/src/url.c:480: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 hostbuf[SHORTSTR], lpbuf[SHORTSTR]; data/puf-1.0.0/src/url.c:518: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(prox->cgi_path, pu->lpart, pu->lpartlen); data/puf-1.0.0/src/url.c:521: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(pt, authbuf, len_auth); data/puf-1.0.0/src/url.c:602: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 abuf[32], buf[SHORTSTR]; data/puf-1.0.0/src/url.c:616:30: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. lcat_mem(buf, SHORTSTR, dl, sprintf(abuf, ":%d", pu->port), abuf); data/puf-1.0.0/src/url.c:631: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(au->headers + au->hdrslen, buf, dl); data/puf-1.0.0/src/url.c:647: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 hostbuf[SHORTSTR], lpbuf[SHORTSTR]; data/puf-1.0.0/src/url.c:719: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(u->local_part, pu->lpart, pu->lpartlen); data/puf-1.0.0/src/url.c:873:2: [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(parm, u->parm, sizeof(*parm)); data/puf-1.0.0/src/getopts.c:343:11: [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). len = strlen(path) + 1; data/puf-1.0.0/src/getopts.c:418: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). dplen = lopt->disp_path->path[0] ? strlen(lopt->disp_path->path) + 1 : 0; data/puf-1.0.0/src/getopts.c:420: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). if (dplen + strlen(parm->disposition->disp) > data/puf-1.0.0/src/getopts.c:456: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). if (!parse_add_url(srct, buf, strlen(buf), 0, 0, parm, 0, 0, 0, 0)) { data/puf-1.0.0/src/getopts.c:506:15: [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). int len = strlen(agent) + 1; data/puf-1.0.0/src/getopts.c:655:13: [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). olen = strlen(arg1 + 1); data/puf-1.0.0/src/getopts.c:662: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). if (options[i].opt && strlen(options[i].opt) == olen && data/puf-1.0.0/src/getopts.c:840:8: [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). i = strlen(arg2); data/puf-1.0.0/src/getopts.c:860: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). set_disp(lparm, arg2, strlen(arg2)); data/puf-1.0.0/src/hostlist.c:104:13: [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). int l = strlen(proc->whost->host->name) + 1; data/puf-1.0.0/src/hostlist.c:284:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fds[1], buf, sizeof(buf)) <= 0) { data/puf-1.0.0/src/http_req.c:131:26: [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). au->proxy->cgi_path + strlen(au->proxy->cgi_path) + 1); data/puf-1.0.0/src/http_rsp.c:317:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((orglen = read(au->socket, bufp, MAXBUFSIZE)) < 0) data/puf-1.0.0/src/http_rsp.c:449: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). strlen(((char **)sh->ents)[u]))) { data/puf-1.0.0/src/http_rsp.c:543: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). strlen(au->url->local_part), data/puf-1.0.0/src/http_rsp.c:587:11: [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). strlen(au->url->local_part), data/puf-1.0.0/src/puf.c:26:13: [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). int l = strlen(s) + 1; data/puf-1.0.0/src/puf.c:206:10: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (getchar() != 'y') data/puf-1.0.0/src/puf.h:573:63: [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 cat_str(b,l,s) do { const char *_s = s; cat_mem(b, l, strlen(_s), _s); } while(0) data/puf-1.0.0/src/puf.h:577:72: [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 lcat_str(b,bl,l,s) do { const char *_s = s; lcat_mem(b, bl, l, strlen(_s), _s); } while(0) data/puf-1.0.0/src/recurse.c:127:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((len = read(fi, buf, MAXBUFSIZE)) > 0) data/puf-1.0.0/src/recurse.c:140:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((len = read(fi, buf + off, MAXBUFSIZE - off) + off) == data/puf-1.0.0/src/url.c:60:11: [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). l = strlen(host->info->name); data/puf-1.0.0/src/url.c:63:13: [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). ml = strlen(((char **)sh->ents)[u]); data/puf-1.0.0/src/url.c:482:32: [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 (parse_url(srct, proxy, strlen(proxy), 0, 0, data/puf-1.0.0/src/url.c:570:12: [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). len = strlen(path); data/puf-1.0.0/src/url.c:584:7: [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). l = strlen(pat); data/puf-1.0.0/src/url.c:785:31: [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 (find_url(u->local_part, strlen(u->local_part), ANALYSIS SUMMARY: Hits = 155 Lines analyzed = 5585 in approximately 0.19 seconds (30123 lines/second) Physical Source Lines of Code (SLOC) = 4523 Hits@level = [0] 20 [1] 28 [2] 99 [3] 2 [4] 26 [5] 0 Hits@level+ = [0+] 175 [1+] 155 [2+] 127 [3+] 28 [4+] 26 [5+] 0 Hits/KSLOC@level+ = [0+] 38.6911 [1+] 34.2693 [2+] 28.0787 [3+] 6.19058 [4+] 5.7484 [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.