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/cvsd-1.0.24/log.h Examining data/cvsd-1.0.24/xmalloc.c Examining data/cvsd-1.0.24/daemon.c Examining data/cvsd-1.0.24/reslimit.c Examining data/cvsd-1.0.24/getopt_long.h Examining data/cvsd-1.0.24/cfg.h Examining data/cvsd-1.0.24/getinfos.c Examining data/cvsd-1.0.24/getopt_long.c Examining data/cvsd-1.0.24/cfg.c Examining data/cvsd-1.0.24/xmalloc.h Examining data/cvsd-1.0.24/cfgfile.h Examining data/cvsd-1.0.24/cvsd.c Examining data/cvsd-1.0.24/daemon.h Examining data/cvsd-1.0.24/cfgfile.c Examining data/cvsd-1.0.24/reslimit.h Examining data/cvsd-1.0.24/log.c Examining data/cvsd-1.0.24/getinfos.h FINAL RESULTS: data/cvsd-1.0.24/cfgfile.c:325:7: [4] (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). strcat(tmp,opts[1]); data/cvsd-1.0.24/cfgfile.c:387:9: [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(tmp,opts[i]); data/cvsd-1.0.24/cvsd.c:889:3: [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(cvs_cmdline,cfg->cvscmd); data/cvsd-1.0.24/cvsd.c:893:5: [4] (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). strcat(cvs_cmdline,cfg->cvsargs[i]); data/cvsd-1.0.24/log.c:126:7: [4] (format) vsnprintf: 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. res=vsnprintf(buffer,maxbufferlen,format,ap); data/cvsd-1.0.24/cvsd.c:163:16: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((optc=getopt_long(argc,argv,CVSD_OPTIONSTRING,cvsd_options,NULL))!=-1) data/cvsd-1.0.24/cvsd.c:786:9: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. if (chroot(cfg->rootjail)!=0) data/cvsd-1.0.24/getopt_long.c:34:5: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. int getopt_long(int argc,char * const argv[], data/cvsd-1.0.24/getopt_long.c:91:10: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. return getopt(argc,argv,optstring); data/cvsd-1.0.24/getopt_long.h:45:5: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. int getopt_long(int argc,char * const argv[], data/cvsd-1.0.24/cfg.c:92: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(tmp,cfg->cvsargs,sz*sizeof(char *)); data/cvsd-1.0.24/cfgfile.c:96:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char *retv[MAX_LINE_OPTIONS]; data/cvsd-1.0.24/cfgfile.c:160: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 line[MAX_LINE_LENGTH]; data/cvsd-1.0.24/cfgfile.c:170: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). if ((fp=fopen(filename,"r"))==NULL) data/cvsd-1.0.24/cfgfile.c:324:7: [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(tmp,"--allow-root="); data/cvsd-1.0.24/cfgfile.c:386:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. tmp=(char *)xmalloc((strlen(opts[i])+1)*sizeof(char)); data/cvsd-1.0.24/cvsd.c:374: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 host[80],serv[40]; data/cvsd-1.0.24/cvsd.c:529: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 hostbuf[80],serv[40]; data/cvsd-1.0.24/cvsd.c:642: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). if ((fp=fopen(filename,"w"))==NULL) data/cvsd-1.0.24/daemon.c:67: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). open("/dev/null",O_RDWR); /* stdin, fd=0 */ data/cvsd-1.0.24/getinfos.c:60: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(&addr->sin_addr.s_addr,hent->h_addr,4); data/cvsd-1.0.24/log.c:79:6: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fp=fopen(filename,"a"); data/cvsd-1.0.24/log.c:122: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 buffer[maxbufferlen]; data/cvsd-1.0.24/cfg.h:91:10: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). mode_t umask; data/cvsd-1.0.24/cfgfile.c:181: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). i=(int)strlen(line); data/cvsd-1.0.24/cfgfile.c:323: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). tmp=(char *)xmalloc((13+strlen(opts[1])+1)*sizeof(char)); data/cvsd-1.0.24/cfgfile.c:386: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). tmp=(char *)xmalloc((strlen(opts[i])+1)*sizeof(char)); data/cvsd-1.0.24/cfgfile.c:485:31: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). if ((*tmp!='\0')||(cfg->umask<0000)||(cfg->umask>0777)) data/cvsd-1.0.24/cfgfile.c:485:50: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). if ((*tmp!='\0')||(cfg->umask<0000)||(cfg->umask>0777)) data/cvsd-1.0.24/cvsd.c:393:9: [1] (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 character. strcpy(host,"?"); data/cvsd-1.0.24/cvsd.c:394:9: [1] (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 character. strcpy(serv,"?"); data/cvsd-1.0.24/cvsd.c:398:9: [1] (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 character. strcpy(host,"?"); data/cvsd-1.0.24/cvsd.c:399:9: [1] (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 character. strcpy(serv,"?"); data/cvsd-1.0.24/cvsd.c:641:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0022); data/cvsd-1.0.24/cvsd.c:725:64: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). i=snprintf(cfg->cvsenv[CVSUMASK_IDX],13,"CVSUMASK=%03o",cfg->umask); data/cvsd-1.0.24/cvsd.c:763:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(cfg->umask); data/cvsd-1.0.24/cvsd.c:763:14: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(cfg->umask); data/cvsd-1.0.24/cvsd.c:885:5: [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). j=strlen(cfg->cvscmd)+1; data/cvsd-1.0.24/cvsd.c:887: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). j+=strlen(cfg->cvsargs[i])+1; data/cvsd-1.0.24/cvsd.c:892:5: [1] (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 character. strcat(cvs_cmdline," "); data/cvsd-1.0.24/getopt_long.c:50: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). l=strlen(longopts[i].name); data/cvsd-1.0.24/xmalloc.c:52:5: [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(s); data/cvsd-1.0.24/xmalloc.c:54:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(tmp,s,l); ANALYSIS SUMMARY: Hits = 43 Lines analyzed = 2834 in approximately 0.13 seconds (22384 lines/second) Physical Source Lines of Code (SLOC) = 1860 Hits@level = [0] 21 [1] 20 [2] 13 [3] 5 [4] 5 [5] 0 Hits@level+ = [0+] 64 [1+] 43 [2+] 23 [3+] 10 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 34.4086 [1+] 23.1183 [2+] 12.3656 [3+] 5.37634 [4+] 2.68817 [5+] 0 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.