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/uptimed-0.4.2/libuptimed/milestone.c Examining data/uptimed-0.4.2/libuptimed/milestone.h Examining data/uptimed-0.4.2/libuptimed/misc.c Examining data/uptimed-0.4.2/libuptimed/misc.h Examining data/uptimed-0.4.2/libuptimed/urec.c Examining data/uptimed-0.4.2/libuptimed/urec.h Examining data/uptimed-0.4.2/src/getopt.c Examining data/uptimed-0.4.2/src/getopt.h Examining data/uptimed-0.4.2/src/sd-daemon.c Examining data/uptimed-0.4.2/src/sd-daemon.h Examining data/uptimed-0.4.2/src/uprecords.c Examining data/uptimed-0.4.2/src/uprecords.h Examining data/uptimed-0.4.2/src/uptimed.c Examining data/uptimed-0.4.2/src/uptimed.h FINAL RESULTS: data/uptimed-0.4.2/src/uptimed.c:444:2: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(str, buf, sizeof(str)-1); data/uptimed-0.4.2/src/uptimed.c:451:3: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(str, buf, sizeof(str)-1); data/uptimed-0.4.2/src/uptimed.c:462:3: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(str, buf, sizeof(str)-1); data/uptimed-0.4.2/src/uptimed.c:466:2: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(str, "\nCongratulations!\n\nUptimed author,\nRob Kaper <rob@unixcode.org>\n-- \nThis message was automatically generated by Uptimed.\nUptimed e-mail notifications can be configured from the uptimed.conf file.\n", sizeof(str)-1); data/uptimed-0.4.2/libuptimed/milestone.h:42:13: [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. extern void snprintf(char *,...); data/uptimed-0.4.2/libuptimed/urec.h:46:13: [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. extern void snprintf(char *, ...); data/uptimed-0.4.2/src/sd-daemon.h:72:55: [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. #define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b))) data/uptimed-0.4.2/src/uprecords.c:121:3: [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(CLS); data/uptimed-0.4.2/src/uprecords.c:396: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(timebuf, time2uptime(utime)); data/uptimed-0.4.2/src/uprecords.c:397: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(dtimebuf, time2uptime(dtime)); data/uptimed-0.4.2/src/uptimed.c:87:3: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. syslog(LOG_INFO, SYSLOG_PREFIX "created bootid: %d", readbootid()); data/uptimed-0.4.2/src/uptimed.c:232:4: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. syslog(LOG_INFO, SYSLOG_PREFIX "new uptime record: %s", time2uptime(u_current->utime)); data/uptimed-0.4.2/src/uptimed.c:235:4: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. syslog(LOG_INFO, SYSLOG_PREFIX "moving up to position %d: %s", position, time2uptime(u_current->utime)); data/uptimed-0.4.2/src/uptimed.c:240:3: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. syslog(LOG_INFO, SYSLOG_PREFIX "milestone: %s (%s)", time2uptime(milestone->time), milestone->desc); data/uptimed-0.4.2/src/uptimed.c:361: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(email, optarg); data/uptimed-0.4.2/src/uptimed.c:365: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(pidfile, optarg); data/uptimed-0.4.2/src/uptimed.c:471:2: [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. system(cmd); data/uptimed-0.4.2/libuptimed/misc.c:42:14: [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. strncpy(hd, getenv("HOME"), sizeof(hd)-1); data/uptimed-0.4.2/src/getopt.c:211:9: [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. #ifndef getenv data/uptimed-0.4.2/src/getopt.c:212:14: [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. extern char *getenv (); data/uptimed-0.4.2/src/getopt.c:397:21: [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. posixly_correct = getenv ("POSIXLY_CORRECT"); data/uptimed-0.4.2/src/getopt.c:972:1: [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. getopt (argc, argv, optstring) data/uptimed-0.4.2/src/getopt.c:1002:11: [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. c = getopt (argc, argv, "abc:d:0123456789"); data/uptimed-0.4.2/src/getopt.h:145:12: [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. extern int getopt (int __argc, char *const *__argv, const char *__shortopts); data/uptimed-0.4.2/src/getopt.h:147:12: [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. extern int getopt (); data/uptimed-0.4.2/src/getopt.h:151:12: [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. extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, data/uptimed-0.4.2/src/getopt.h:164:12: [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. extern int getopt (); data/uptimed-0.4.2/src/getopt.h:166:12: [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. extern int getopt_long (); data/uptimed-0.4.2/src/sd-daemon.c:74:13: [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. e = getenv("LISTEN_PID"); data/uptimed-0.4.2/src/sd-daemon.c:99:13: [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. e = getenv("LISTEN_FDS"); data/uptimed-0.4.2/src/sd-daemon.c:428:13: [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. e = getenv("NOTIFY_SOCKET"); data/uptimed-0.4.2/src/uprecords.c:492:13: [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. while((i = getopt(argc, argv, "i:m:?acbdBkKfsMwv")) != EOF) data/uptimed-0.4.2/src/uptimed.c:344:17: [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. while((index = getopt(argc, argv, "e:i:m:p:t:?bfv")) != EOF) data/uptimed-0.4.2/libuptimed/milestone.c:139: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(str)*multiplier; data/uptimed-0.4.2/libuptimed/milestone.h:56: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 desc[SYSMAX+1]; /* little description */ data/uptimed-0.4.2/libuptimed/misc.c:20: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 hd[256]; data/uptimed-0.4.2/libuptimed/misc.c:24: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 timebuf[21] = ""; data/uptimed-0.4.2/libuptimed/misc.c:55: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 str[512]; data/uptimed-0.4.2/libuptimed/misc.c:57:4: [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(filename, "r"); data/uptimed-0.4.2/libuptimed/urec.c:88: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 sys[SYSMAX+1]; data/uptimed-0.4.2/libuptimed/urec.c:131:4: [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("/proc/uptime", "r"); data/uptimed-0.4.2/libuptimed/urec.c:181: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). fd = open(UTMPX_FILE, O_RDONLY); data/uptimed-0.4.2/libuptimed/urec.c:241: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 str[256]; data/uptimed-0.4.2/libuptimed/urec.c:244: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[256], sys[SYSMAX+1]; data/uptimed-0.4.2/libuptimed/urec.c:260:8: [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(FILE_RECORDS, "r"); data/uptimed-0.4.2/libuptimed/urec.c:263:8: [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(FILE_RECORDS".old", "r"); data/uptimed-0.4.2/libuptimed/urec.c:305: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). f = fopen(FILE_RECORDS".tmp", "w"); data/uptimed-0.4.2/libuptimed/urec.c:342: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). fd = open (UTMPX_FILE, O_RDONLY); data/uptimed-0.4.2/libuptimed/urec.c:356: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). f = fopen(FILE_BOOTID, "w"); data/uptimed-0.4.2/libuptimed/urec.c:373:4: [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(FILE_BOOTID, "w"); data/uptimed-0.4.2/libuptimed/urec.c:391: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). f = fopen(FILE_BOOTID, "w"); data/uptimed-0.4.2/libuptimed/urec.c:419: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 str[256]; data/uptimed-0.4.2/libuptimed/urec.c:422:4: [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("/proc/stat", "r"); data/uptimed-0.4.2/libuptimed/urec.c:430:12: [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). bootid=atoi(str+6); data/uptimed-0.4.2/libuptimed/urec.c:444: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 str[256]; data/uptimed-0.4.2/libuptimed/urec.c:446:4: [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(FILE_BOOTID, "r"); data/uptimed-0.4.2/libuptimed/urec.c:453:9: [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(str); data/uptimed-0.4.2/libuptimed/urec.h:69: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 sys[SYSMAX+1]; /* system type */ data/uptimed-0.4.2/src/sd-daemon.c:389:17: [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 fpath[PATH_MAX]; data/uptimed-0.4.2/src/uprecords.c:268: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 str[256]; data/uptimed-0.4.2/src/uprecords.c:272:4: [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(FILE_CONFIG, "r"); data/uptimed-0.4.2/src/uprecords.c:292: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 str[256]; data/uptimed-0.4.2/src/uprecords.c:294:4: [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("/etc/uprecords-cgi/uprecords.conf", "r"); data/uptimed-0.4.2/src/uprecords.c:311:13: [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). show_max=atoi(str+9); data/uptimed-0.4.2/src/uprecords.c:394: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 timebuf[20] = "", dtimebuf[20] = ""; data/uptimed-0.4.2/src/uprecords.c:544:23: [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). update_interval=atoi(optarg); data/uptimed-0.4.2/src/uprecords.c:554:16: [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). show_max=atoi(optarg); data/uptimed-0.4.2/src/uptimed.c:41: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 email[EMAIL+1], sendmail[EMAIL+1], pidfile[EMAIL+1]; data/uptimed-0.4.2/src/uptimed.c:69: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). pidf = fopen(pidfile, "r"); data/uptimed-0.4.2/src/uptimed.c:118: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). pidf = fopen(pidfile, "w"); data/uptimed-0.4.2/src/uptimed.c:266: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 str[256]; data/uptimed-0.4.2/src/uptimed.c:270:4: [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(FILE_CONFIG, "r"); data/uptimed-0.4.2/src/uptimed.c:277:20: [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). update_interval=atoi(str+16); data/uptimed-0.4.2/src/uptimed.c:279:22: [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). log_max_entries = atoi(str+12); /* MAX_ENTRIES is deprecated now, keep for backward compat */ data/uptimed-0.4.2/src/uptimed.c:281:22: [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). log_max_entries = atoi(str+20); data/uptimed-0.4.2/src/uptimed.c:288:15: [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). send_email=atoi(str+11); data/uptimed-0.4.2/src/uptimed.c:372:22: [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). update_interval=atoi(optarg); data/uptimed-0.4.2/src/uptimed.c:381:24: [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). log_max_entries = atoi(optarg); data/uptimed-0.4.2/src/uptimed.c:434: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[256], str[2048], cmd[2048], hostname[256]; data/uptimed-0.4.2/libuptimed/milestone.c:38:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(m->desc, desc, SYSMAX); data/uptimed-0.4.2/libuptimed/milestone.c:95: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). len = strlen(str); data/uptimed-0.4.2/libuptimed/misc.c:42:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(hd, getenv("HOME"), sizeof(hd)-1); data/uptimed-0.4.2/libuptimed/urec.c:41:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(u->sys, sys, SYSMAX); data/uptimed-0.4.2/libuptimed/urec.c:184:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &ut, sizeof(ut)) < 0) { data/uptimed-0.4.2/libuptimed/urec.c:289:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sys, buf, SYSMAX); data/uptimed-0.4.2/libuptimed/urec.c:345:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, &ut, sizeof(ut)) < 0) { data/uptimed-0.4.2/src/getopt.c:234:51: [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 (!defined __STDC__ || !__STDC__) && !defined strlen data/uptimed-0.4.2/src/getopt.c:237: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). extern int strlen (const char *); data/uptimed-0.4.2/src/getopt.c:428:44: [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 = nonoption_flags_max_len = strlen (orig_str); data/uptimed-0.4.2/src/getopt.c:656:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). == (unsigned int) strlen (p->name)) data/uptimed-0.4.2/src/getopt.c:683: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). nextchar += strlen (nextchar); data/uptimed-0.4.2/src/getopt.c:715:17: [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). nextchar += strlen (nextchar); data/uptimed-0.4.2/src/getopt.c:731:17: [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). nextchar += strlen (nextchar); data/uptimed-0.4.2/src/getopt.c:736: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). nextchar += strlen (nextchar); data/uptimed-0.4.2/src/getopt.c:847:51: [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 ((unsigned int) (nameend - nextchar) == strlen (p->name)) data/uptimed-0.4.2/src/getopt.c:870: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). nextchar += strlen (nextchar); data/uptimed-0.4.2/src/getopt.c:890:19: [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). nextchar += strlen (nextchar); data/uptimed-0.4.2/src/getopt.c:904:19: [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). nextchar += strlen (nextchar); data/uptimed-0.4.2/src/getopt.c:908: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). nextchar += strlen (nextchar); data/uptimed-0.4.2/src/sd-daemon.c:355:34: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). length = strlen(path); data/uptimed-0.4.2/src/sd-daemon.c:398:17: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(stpcpy(fpath, "/dev/mqueue"), path, sizeof(fpath) - 12); data/uptimed-0.4.2/src/sd-daemon.c:446:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path)); data/uptimed-0.4.2/src/sd-daemon.c:453: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). iovec.iov_len = strlen(state); data/uptimed-0.4.2/src/sd-daemon.c:457:71: [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). msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(e); data/uptimed-0.4.2/src/uprecords.c:381:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (!wide_out && strlen(sys) > SYSWIDTH) data/uptimed-0.4.2/src/uptimed.c:61:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy(pidfile, "/var/run/uptimed", EMAIL); data/uptimed-0.4.2/src/uptimed.c:284:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(email, strtok(str+6, "\n"), EMAIL); data/uptimed-0.4.2/src/uptimed.c:291:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(sendmail, strtok(str+9, "\n"), EMAIL); data/uptimed-0.4.2/src/uptimed.c:309:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(pidfile, strtok(str+8, "\n"), EMAIL); ANALYSIS SUMMARY: Hits = 109 Lines analyzed = 4142 in approximately 0.14 seconds (29310 lines/second) Physical Source Lines of Code (SLOC) = 2656 Hits@level = [0] 143 [1] 30 [2] 46 [3] 16 [4] 13 [5] 4 Hits@level+ = [0+] 252 [1+] 109 [2+] 79 [3+] 33 [4+] 17 [5+] 4 Hits/KSLOC@level+ = [0+] 94.8795 [1+] 41.0392 [2+] 29.744 [3+] 12.4247 [4+] 6.4006 [5+] 1.50602 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.