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/apt-cacher-ng-3.5/client/client.cc Examining data/apt-cacher-ng-3.5/fs/httpfs.cc Examining data/apt-cacher-ng-3.5/include/acbuf.h Examining data/apt-cacher-ng-3.5/include/acfg.h Examining data/apt-cacher-ng-3.5/include/aclogger.h Examining data/apt-cacher-ng-3.5/include/bgtask.h Examining data/apt-cacher-ng-3.5/include/cacheman.h Examining data/apt-cacher-ng-3.5/include/caddrinfo.h Examining data/apt-cacher-ng-3.5/include/cleaner.h Examining data/apt-cacher-ng-3.5/include/config.h Examining data/apt-cacher-ng-3.5/include/conn.h Examining data/apt-cacher-ng-3.5/include/conserver.h Examining data/apt-cacher-ng-3.5/include/csmapping.h Examining data/apt-cacher-ng-3.5/include/debug.h Examining data/apt-cacher-ng-3.5/include/dirwalk.h Examining data/apt-cacher-ng-3.5/include/dlcon.h Examining data/apt-cacher-ng-3.5/include/dnsiter.h Examining data/apt-cacher-ng-3.5/include/evabase.h Examining data/apt-cacher-ng-3.5/include/evasocket.h Examining data/apt-cacher-ng-3.5/include/expiration.h Examining data/apt-cacher-ng-3.5/include/fileio.h Examining data/apt-cacher-ng-3.5/include/fileitem.h Examining data/apt-cacher-ng-3.5/include/filelocks.h Examining data/apt-cacher-ng-3.5/include/filereader.h Examining data/apt-cacher-ng-3.5/include/header.h Examining data/apt-cacher-ng-3.5/include/job.h Examining data/apt-cacher-ng-3.5/include/lockable.h Examining data/apt-cacher-ng-3.5/include/maintenance.h Examining data/apt-cacher-ng-3.5/include/meta.h Examining data/apt-cacher-ng-3.5/include/mirror.h Examining data/apt-cacher-ng-3.5/include/pkgimport.h Examining data/apt-cacher-ng-3.5/include/showinfo.h Examining data/apt-cacher-ng-3.5/include/sockio.h Examining data/apt-cacher-ng-3.5/include/tcpconnect.h Examining data/apt-cacher-ng-3.5/source/acbuf.cc Examining data/apt-cacher-ng-3.5/source/acfg.cc Examining data/apt-cacher-ng-3.5/source/acfg_defaults.cc Examining data/apt-cacher-ng-3.5/source/aclogger.cc Examining data/apt-cacher-ng-3.5/source/acngtool.cc Examining data/apt-cacher-ng-3.5/source/apt-cacher.cc Examining data/apt-cacher-ng-3.5/source/bgtask.cc Examining data/apt-cacher-ng-3.5/source/cacheman.cc Examining data/apt-cacher-ng-3.5/source/caddrinfo.cc Examining data/apt-cacher-ng-3.5/source/cleaner.cc Examining data/apt-cacher-ng-3.5/source/conn.cc Examining data/apt-cacher-ng-3.5/source/conserver.cc Examining data/apt-cacher-ng-3.5/source/dirwalk.cc Examining data/apt-cacher-ng-3.5/source/dlcon.cc Examining data/apt-cacher-ng-3.5/source/dnsiter.cc Examining data/apt-cacher-ng-3.5/source/evabase.cc Examining data/apt-cacher-ng-3.5/source/evasocket.cc Examining data/apt-cacher-ng-3.5/source/expiration.cc Examining data/apt-cacher-ng-3.5/source/fileio.cc Examining data/apt-cacher-ng-3.5/source/fileitem.cc Examining data/apt-cacher-ng-3.5/source/filelocks.cc Examining data/apt-cacher-ng-3.5/source/filereader.cc Examining data/apt-cacher-ng-3.5/source/header.cc Examining data/apt-cacher-ng-3.5/source/job.cc Examining data/apt-cacher-ng-3.5/source/lockable.cc Examining data/apt-cacher-ng-3.5/source/maintenance.cc Examining data/apt-cacher-ng-3.5/source/meta.cc Examining data/apt-cacher-ng-3.5/source/mirror.cc Examining data/apt-cacher-ng-3.5/source/pkgimport.cc Examining data/apt-cacher-ng-3.5/source/showinfo.cc Examining data/apt-cacher-ng-3.5/source/sockio.cc Examining data/apt-cacher-ng-3.5/source/tcpconnect.cc Examining data/apt-cacher-ng-3.5/test/build/HAVE_DAEMON.cc Examining data/apt-cacher-ng-3.5/test/build/HAVE_DLOPEN.cc Examining data/apt-cacher-ng-3.5/test/build/HAVE_FADVISE.cc Examining data/apt-cacher-ng-3.5/test/build/HAVE_FUSE_25.cc Examining data/apt-cacher-ng-3.5/test/build/HAVE_GLOB.cc Examining data/apt-cacher-ng-3.5/test/build/HAVE_LIBWRAP.cc Examining data/apt-cacher-ng-3.5/test/build/HAVE_LINUX_EVENTFD.cc Examining data/apt-cacher-ng-3.5/test/build/HAVE_LINUX_FALLOCATE.cc Examining data/apt-cacher-ng-3.5/test/build/HAVE_LINUX_SENDFILE.cc Examining data/apt-cacher-ng-3.5/test/build/HAVE_LINUX_SPLICE.cc Examining data/apt-cacher-ng-3.5/test/build/HAVE_LZMA.cc Examining data/apt-cacher-ng-3.5/test/build/HAVE_MADVISE.cc Examining data/apt-cacher-ng-3.5/test/build/HAVE_PREAD.cc Examining data/apt-cacher-ng-3.5/test/build/HAVE_SSL.cc Examining data/apt-cacher-ng-3.5/test/build/HAVE_WORDEXP.cc Examining data/apt-cacher-ng-3.5/test/build/testcxx11.cc Examining data/apt-cacher-ng-3.5/test/build/testpthread.cc FINAL RESULTS: data/apt-cacher-ng-3.5/source/aclogger.cc:113:15: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. auto tpos=readlink(lbuf, buf, _countof(buf)-1); data/apt-cacher-ng-3.5/client/client.cc:92: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(addr.sun_path, argv[1]); data/apt-cacher-ng-3.5/fs/httpfs.cc:241:12: [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. int n=sscanf(p, "bytes " OFF_T_FMT "-" OFF_T_FMT "/" OFF_T_FMT, &myfrom, &myto, &mylen); data/apt-cacher-ng-3.5/fs/httpfs.cc:243: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. If the scanf format is influenceable by an attacker, it's exploitable. n=sscanf(p, "bytes=" OFF_T_FMT "-" OFF_T_FMT "/" OFF_T_FMT, &myfrom, &myto, &mylen); data/apt-cacher-ng-3.5/include/acbuf.h:91:58: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. #define __tss_nbrfmt(x, h, y) { reserve_atleast(22); got(sprintf(wptr(), m_fmtmode == hex ? h : x, y)); return *this; } data/apt-cacher-ng-3.5/source/acfg.cc:635:12: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. else if(system(cmdCon.c_str())) data/apt-cacher-ng-3.5/source/acfg.cc:1308:8: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if(system(hooks.cmdRel.c_str())) data/apt-cacher-ng-3.5/source/acfg.cc:1393:29: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. proxy_failstate = (bool) system(optProxyCheckCmd.c_str()); data/apt-cacher-ng-3.5/source/acngtool.cc:59:42: [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. return s && S_ISSOCK(s.st_mode) && 0 == access(path.c_str(), W_OK); data/apt-cacher-ng-3.5/source/acngtool.cc:580: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(addr.sun_path, cfg::udspath.c_str()); data/apt-cacher-ng-3.5/source/cacheman.cc:1075:18: [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(0 == ::access(SZABSPATH(cand), F_OK)) data/apt-cacher-ng-3.5/source/cacheman.cc:1388:35: [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(!cfg::suppdir.empty() && 0==access(act.c_str(), X_OK)) data/apt-cacher-ng-3.5/source/cacheman.cc:1393:10: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (::system(cmd.c_str())) data/apt-cacher-ng-3.5/source/cacheman.cc:2438: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. return ! ::access(solidPath.c_str(), F_OK); data/apt-cacher-ng-3.5/source/expiration.cc:309:8: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if(system("dpkg --version >/dev/null 2>&1")) data/apt-cacher-ng-3.5/source/expiration.cc:346:15: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. int r=::system((string("dpkg --compare-versions ")+ver+" gt "+other.ver).c_str()); data/apt-cacher-ng-3.5/source/fileitem.cc:459: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. If the scanf format is influenceable by an attacker, it's exploitable. int n=sscanf(p, "bytes " OFF_T_FMT "-" OFF_T_FMT "/" OFF_T_FMT, &myfrom, &myto, &mylen); data/apt-cacher-ng-3.5/source/fileitem.cc:461:6: [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. n=sscanf(p, "bytes=" OFF_T_FMT "-" OFF_T_FMT "/" OFF_T_FMT, &myfrom, &myto, &mylen); data/apt-cacher-ng-3.5/source/filereader.cc:443:22: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. acng::ignore_value(system(cfg::sigbuscmd.c_str())); data/apt-cacher-ng-3.5/source/header.cc:290:10: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. int len=sprintf(buf, OFF_T_FMT, nValue); data/apt-cacher-ng-3.5/source/job.cc:446:21: [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. int nRangeItems = sscanf(pRange, "bytes=" OFF_T_FMT data/apt-cacher-ng-3.5/source/job.cc:451:18: [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. nRangeItems = sscanf(pRange, "bytes " data/apt-cacher-ng-3.5/source/meta.cc:858:10: [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. int len=snprintf(buf, 21, OFF_T_FMT, n); data/apt-cacher-ng-3.5/source/mirror.cc:82:8: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if(::system("dpkg --version")) data/apt-cacher-ng-3.5/source/mirror.cc:87:13: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. else if(::system("debpatch -h")) data/apt-cacher-ng-3.5/source/mirror.cc:305:10: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. int r=::system(string("dpkg --compare-versions "+s1+" lt "+s2).c_str()); data/apt-cacher-ng-3.5/source/mirror.cc:417:17: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (0 == ::system("debpatch \"$delta\" \"$from\" \"$to\"")) data/apt-cacher-ng-3.5/source/pkgimport.cc:310:9: [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(0!=access(sDestHeadAbs.c_str(), F_OK)) data/apt-cacher-ng-3.5/source/showinfo.cc:231:27: [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(cand == path || ::access(SZABSPATH(cand), F_OK)) data/apt-cacher-ng-3.5/source/acfg.cc:1049:6: [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. if(!realpath(szPath, buf)) data/apt-cacher-ng-3.5/source/acngtool.cc:91:18: [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. auto opt_dbg=getenv("ACNGTOOL_DEBUG_DOWNLOAD"); data/apt-cacher-ng-3.5/source/acngtool.cc:140:19: [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. auto opt_dbg = getenv("ACNGTOOL_DEBUG_DOWNLOAD"); data/apt-cacher-ng-3.5/source/acngtool.cc:465:3: [3] (random) srandom: 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. srandom(uint(time(0)) + uint(pval) +uint(getpid())); data/apt-cacher-ng-3.5/source/acngtool.cc:466:8: [3] (random) random: 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. salt=random(); data/apt-cacher-ng-3.5/source/acngtool.cc:470:9: [3] (random) random: 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. salt=random(); data/apt-cacher-ng-3.5/source/acngtool.cc:618:15: [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. LPCSTR req = getenv("ACNGREQ"); data/apt-cacher-ng-3.5/source/acngtool.cc:621:40: [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. auto isInsecForced = []() { auto se = getenv("ACNG_INSECURE"); return se && *se; }; data/apt-cacher-ng-3.5/source/acngtool.cc:959:23: [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. auto ret=wcat(p, getenv("http_proxy"), &fac); data/apt-cacher-ng-3.5/source/acngtool.cc:1167:11: [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. envvar = getenv("PARSEIDX"); data/apt-cacher-ng-3.5/source/acngtool.cc:1174:11: [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. envvar = getenv("GETSUM"); data/apt-cacher-ng-3.5/source/acngtool.cc:1189:12: [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. envvar = getenv("REFSUM"); data/apt-cacher-ng-3.5/source/dlcon.cc:1035: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(getpid()); data/apt-cacher-ng-3.5/source/mirror.cc:414:31: [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. SendFmt << "debpatch " << getenv("delta") << " " << getenv("from") data/apt-cacher-ng-3.5/source/mirror.cc:414:57: [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. SendFmt << "debpatch " << getenv("delta") << " " << getenv("from") data/apt-cacher-ng-3.5/source/mirror.cc:415:17: [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. << " " << getenv("to"); data/apt-cacher-ng-3.5/source/pkgimport.cc:136:8: [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. if (!realpath(from.c_str(), buf)) data/apt-cacher-ng-3.5/client/client.cc:53:2: [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 hbuf[NI_MAXHOST]; data/apt-cacher-ng-3.5/client/client.cc:71: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(hbuf, "localhost"); data/apt-cacher-ng-3.5/fs/httpfs.cc:115:15: [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 *pf = fopen((altPath + m_path).c_str(), "rb"); data/apt-cacher-ng-3.5/fs/httpfs.cc:204: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(pRet+nGot, p, count); data/apt-cacher-ng-3.5/fs/httpfs.cc:409: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(stbuf, &statTempl, sizeof(statTempl)); data/apt-cacher-ng-3.5/fs/httpfs.cc:578: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(stbuf, &stfsTemp, sizeof(*stbuf)); data/apt-cacher-ng-3.5/fs/httpfs.cc:717: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[165536]; data/apt-cacher-ng-3.5/include/acbuf.h:124:26: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. { reserve_atleast(len); memcpy(wptr(), data, len); got(len); return *this;} data/apt-cacher-ng-3.5/include/aclogger.h:57: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). bool ACNG_API open(); data/apt-cacher-ng-3.5/include/csmapping.h:120: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(csum, pData, GetCSTypeLen(eCstype)); data/apt-cacher-ng-3.5/include/header.h:49:7: [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 *h[HEADPOS_MAX] = {0}; data/apt-cacher-ng-3.5/include/header.h:76:44: [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). inline int getStatus() const { int r=atoi(getCodeMessage()); return r ? r : 500; } data/apt-cacher-ng-3.5/include/meta.h:438:2: [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[30]; data/apt-cacher-ng-3.5/source/acbuf.cc:35:11: [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). int fd=::open(szPath, O_RDONLY); data/apt-cacher-ng-3.5/source/acfg.cc:1048:2: [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[PATH_MAX]; data/apt-cacher-ng-3.5/source/acfg.cc:1426: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 buf[1024]; data/apt-cacher-ng-3.5/source/aclogger.cc:50:2: [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[600]; data/apt-cacher-ng-3.5/source/aclogger.cc:55: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(lbuf, CACHE_BASE.data(), CACHE_BASE.size()); data/apt-cacher-ng-3.5/source/aclogger.cc:56: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(lbuf + CACHE_BASE.size(), cfg::privStoreRelQstatsSfx.data(), data/apt-cacher-ng-3.5/source/aclogger.cc:63:15: [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. auto xoff = sprintf(lbuf + xl, "/%c/", foldNam); data/apt-cacher-ng-3.5/source/aclogger.cc:76: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(lptr, ent->d_name, llen + 1); data/apt-cacher-ng-3.5/source/aclogger.cc:88:2: [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[600]; data/apt-cacher-ng-3.5/source/aclogger.cc:93: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(lbuf, CACHE_BASE.data(), CACHE_BASE.size()); data/apt-cacher-ng-3.5/source/aclogger.cc:94: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(lbuf+CACHE_BASE.size(), cfg::privStoreRelQstatsSfx.data(), cfg::privStoreRelQstatsSfx.size()); data/apt-cacher-ng-3.5/source/aclogger.cc:100:14: [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. auto xoff=sprintf(lbuf+xl, "/%c/", foldNam); data/apt-cacher-ng-3.5/source/aclogger.cc:105:4: [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[30]; data/apt-cacher-ng-3.5/source/aclogger.cc:112: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(lptr, ent->d_name, llen+1); data/apt-cacher-ng-3.5/source/aclogger.cc:129:6: [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). bool open() data/apt-cacher-ng-3.5/source/aclogger.cc:148:7: [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). fErr.open(epath.c_str(), ios::out | ios::app); data/apt-cacher-ng-3.5/source/aclogger.cc:149:8: [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). fStat.open(apath.c_str(), ios::out | ios::app); data/apt-cacher-ng-3.5/source/aclogger.cc:219: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. static char buf[32]; data/apt-cacher-ng-3.5/source/aclogger.cc:270:8: [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). log::open(); data/apt-cacher-ng-3.5/source/aclogger.cc:357: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 tbuf[50]; data/apt-cacher-ng-3.5/source/aclogger.cc:430:2: [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/apt-cacher-ng-3.5/source/acngtool.cc:233: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(lineBuf.wptr(), data, consumed); data/apt-cacher-ng-3.5/source/acngtool.cc:1087:7: [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). log::open(); data/apt-cacher-ng-3.5/source/apt-cacher.cc:71:12: [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). int dummy=open("/dev/null", O_RDWR); data/apt-cacher-ng-3.5/source/apt-cacher.cc:198:8: [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). int t=open( buf.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 00644); data/apt-cacher-ng-3.5/source/apt-cacher.cc:266:13: [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(!log::open()) data/apt-cacher-ng-3.5/source/apt-cacher.cc:308:22: [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 *PID_FILE = fopen(cfg::pidfile.c_str(), "w"); data/apt-cacher-ng-3.5/source/bgtask.cc:129:19: [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). m_reportStream.open(logPath.c_str(), ios::out); data/apt-cacher-ng-3.5/source/bgtask.cc:168:13: [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). m_logFd=open(logPath.c_str(), O_RDONLY|O_NONBLOCK); data/apt-cacher-ng-3.5/source/bgtask.cc:385: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 buf[1024]; data/apt-cacher-ng-3.5/source/cacheman.cc:1337: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). pf.p=fopen(sPatchCombinedAbs.c_str(), "w"); data/apt-cacher-ng-3.5/source/cacheman.cc:1426:11: [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). df.p = fopen(sPatchInputAbs.c_str(), "w"); data/apt-cacher-ng-3.5/source/conserver.cc:110: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 hbuf[NI_MAXHOST]; data/apt-cacher-ng-3.5/source/conserver.cc:111: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 pbuf[11]; data/apt-cacher-ng-3.5/source/conserver.cc:396:6: [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 (atoi(cfg::port.c_str()) <= 0) data/apt-cacher-ng-3.5/source/expiration.cc:384:15: [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). f.p = fopen(sDbFileAbs.c_str(), "w"); data/apt-cacher-ng-3.5/source/expiration.cc:390:19: [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). f.p=::fopen(sDbFileAbs.c_str(), "w"); data/apt-cacher-ng-3.5/source/expiration.cc:542: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). m_damageList.open(SZABSPATH(FNAME_DAMAGED), ios::out | ios::trunc); data/apt-cacher-ng-3.5/source/expiration.cc:600:13: [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 *f = fopen(FAIL_INI, "a"); data/apt-cacher-ng-3.5/source/expiration.cc:606: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). f = ::fopen(FAIL_INI, "w"); data/apt-cacher-ng-3.5/source/expiration.cc:870:24: [2] (integer) atol: 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). m_nPrevFailCount += (atol(sTmp.c_str())>0); data/apt-cacher-ng-3.5/source/expiration.cc:918: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 buf[200]; data/apt-cacher-ng-3.5/source/fileio.cc:40:7: [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). in=::open(from.c_str(), O_RDONLY); data/apt-cacher-ng-3.5/source/fileio.cc:60:8: [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). out=open(to.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 00644); data/apt-cacher-ng-3.5/source/fileio.cc:121:2: [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[8192]; data/apt-cacher-ng-3.5/source/fileio.cc:168:11: [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). int fd = open(wanted.c_str(), O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, cfg::fileperms); data/apt-cacher-ng-3.5/source/fileitem.cc:117:9: [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). int fd=open(SZABSPATH(m_sPathRel), O_RDONLY); data/apt-cacher-ng-3.5/source/fileitem.cc:495:11: [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). int fd=open(sPathAbs.c_str(), O_RDONLY); data/apt-cacher-ng-3.5/source/fileitem.cc:574:14: [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). m_filefd = open(sPathAbs.c_str(), flags, cfg::fileperms); data/apt-cacher-ng-3.5/source/fileitem.cc:592: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). m_filefd=open(sPathAbs.c_str(), flags, cfg::fileperms); data/apt-cacher-ng-3.5/source/fileitem.cc:602:14: [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). m_filefd=open(sPathAbs.c_str(), flags, cfg::fileperms); data/apt-cacher-ng-3.5/source/filereader.cc:242:9: [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). m_fd = open(sFilename.c_str(), O_RDONLY); data/apt-cacher-ng-3.5/source/filereader.cc:244:9: [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). m_fd = open(sFilename.c_str(), O_RDWR); data/apt-cacher-ng-3.5/source/filereader.cc:798:20: [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(nullptr !=(f = fopen(pathOut, "w"))) data/apt-cacher-ng-3.5/source/header.cc:194: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(h[lastLineIdx]+xl, szBegin, nlen); data/apt-cacher-ng-3.5/source/header.cc:222: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(h[xh.pos], sep, l); data/apt-cacher-ng-3.5/source/header.cc:269: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(h[i], val, len); data/apt-cacher-ng-3.5/source/header.cc:279: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(h[key], value.c_str(), l); data/apt-cacher-ng-3.5/source/header.cc:289:2: [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[3*sizeof(off_t)]; data/apt-cacher-ng-3.5/source/header.cc:309:9: [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). int fd=open(szPath, O_WRONLY|O_CREAT|O_TRUNC, cfg::fileperms); data/apt-cacher-ng-3.5/source/header.cc:317:6: [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). fd=open(szPath, O_WRONLY|O_CREAT|O_TRUNC, cfg::fileperms); data/apt-cacher-ng-3.5/source/job.cc:349: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 datestr[32]={0}; data/apt-cacher-ng-3.5/source/job.cc:418:11: [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). int fd=open(m_sPathRel.c_str(), O_RDONLY); data/apt-cacher-ng-3.5/source/maintenance.cc:77:2: [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[23]; data/apt-cacher-ng-3.5/source/maintenance.cc:78:10: [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. int l = sprintf(buf, "%x\r\n", (uint) len); data/apt-cacher-ng-3.5/source/maintenance.cc:149: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 hbuf[NI_MAXHOST]; data/apt-cacher-ng-3.5/source/meta.cc:575:4: [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[4] = { '%', h2t_map[uint8_t(c) >> 4], h2t_map[uint8_t(c) & 0x0f],'\0'}; data/apt-cacher-ng-3.5/source/meta.cc:637:4: [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 pct_encoded[4] = { '%', h2t_map[uint8_t(c) >> 4], data/apt-cacher-ng-3.5/source/meta.cc:657:4: [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[4] = { '%', h2t_map[uint8_t(c) >> 4], h2t_map[uint8_t(c) & 0x0f],'\0'}; data/apt-cacher-ng-3.5/source/meta.cc:721:2: [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 alphabet[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; data/apt-cacher-ng-3.5/source/meta.cc:835: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). return atoi(p); data/apt-cacher-ng-3.5/source/meta.cc:836:9: [2] (integer) atol: 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). return atol(p); data/apt-cacher-ng-3.5/source/meta.cc:857:2: [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[21]; data/apt-cacher-ng-3.5/source/meta.cc:864:2: [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[21]; data/apt-cacher-ng-3.5/source/pkgimport.cc:133: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 buf[PATH_MAX+1]; data/apt-cacher-ng-3.5/source/pkgimport.cc:227:8: [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). fList.open(SCACHEFILE.c_str(), ios::out | ios::trunc); data/apt-cacher-ng-3.5/source/pkgimport.cc:232:9: [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). fList.open(SCACHEFILE.c_str(), ios::out| ios::trunc); data/apt-cacher-ng-3.5/source/pkgimport.cc:364:5: [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). in.open(SCACHEFILE.c_str()); data/apt-cacher-ng-3.5/source/showinfo.cc:179: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(&ulen, gzBuf.rptr(), sizeof(unsigned)); data/apt-cacher-ng-3.5/source/showinfo.cc:197: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(&id, buf.rptr(), sizeof(unsigned)); data/apt-cacher-ng-3.5/source/showinfo.cc:199: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(&slen, buf.rptr(), sizeof(unsigned)); data/apt-cacher-ng-3.5/source/sockio.cc:14:1: [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 crapbuf[40]; data/apt-cacher-ng-3.5/source/tcpconnect.cc:871:2: [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[300], pbuf[30]; data/apt-cacher-ng-3.5/client/client.cc:37:14: [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 pLen=strlen(argv[1]); data/apt-cacher-ng-3.5/fs/httpfs.cc:665:4: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0); data/apt-cacher-ng-3.5/include/acbuf.h:126: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). { if(val) return add(val, strlen(val)); else return add("(null)", 6); } data/apt-cacher-ng-3.5/include/maintenance.h:75:56: [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). inline void SendChunk(const char *x) { SendChunk(x, x?strlen(x):0); } data/apt-cacher-ng-3.5/source/acbuf.cc:78:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n=::read(fd, m_buf+w, todo); data/apt-cacher-ng-3.5/source/acfg.cc:1085:17: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). mode_t mask = umask(0); data/apt-cacher-ng-3.5/source/acfg.cc:1086:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(mask); // restore it... data/apt-cacher-ng-3.5/source/acfg.cc:1108:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(nUmask); data/apt-cacher-ng-3.5/source/aclogger.cc:73:16: [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). auto llen = strlen(ent->d_name); data/apt-cacher-ng-3.5/source/aclogger.cc:110: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). auto llen=strlen(ent->d_name); data/apt-cacher-ng-3.5/source/acngtool.cc:919: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(DecodeBase64(p, strlen(p), res)) data/apt-cacher-ng-3.5/source/cacheman.cc:1457: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). auto len=strlen(h.h[header::XORIG]); data/apt-cacher-ng-3.5/source/conserver.cc:380:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(addr_unx.sun_path, sPath.c_str(), sPath.length()); data/apt-cacher-ng-3.5/source/dlcon.cc:785:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). for (char tmp; ::read(m_wakepipe[0], &tmp, 1) > 0;) ; data/apt-cacher-ng-3.5/source/dlcon.cc:1011:14: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(usNext-tv.tv_usec); data/apt-cacher-ng-3.5/source/fileio.cc:135:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). auto readcount=read(in_fd, buf, maxlen); data/apt-cacher-ng-3.5/source/fileitem.cc:501:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(1 == read(fd, &c, 1) && c == *pNextData) data/apt-cacher-ng-3.5/source/header.cc:191: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). auto xl=strlen(h[lastLineIdx]); data/apt-cacher-ng-3.5/source/showinfo.cc:425: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). return SendChunk(m_fmtHelper.wptr(), strlen(m_fmtHelper.wptr())); data/apt-cacher-ng-3.5/source/sockio.cc:67:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int r = read(fd, crapbuf, sizeof(crapbuf)); ANALYSIS SUMMARY: Hits = 162 Lines analyzed = 23482 in approximately 0.51 seconds (45756 lines/second) Physical Source Lines of Code (SLOC) = 18352 Hits@level = [0] 26 [1] 20 [2] 96 [3] 17 [4] 28 [5] 1 Hits@level+ = [0+] 188 [1+] 162 [2+] 142 [3+] 46 [4+] 29 [5+] 1 Hits/KSLOC@level+ = [0+] 10.2441 [1+] 8.82738 [2+] 7.73758 [3+] 2.50654 [4+] 1.58021 [5+] 0.05449 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.