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/liblopsub-1.0.3/lopsub-internal.h Examining data/liblopsub-1.0.3/lopsub.c Examining data/liblopsub-1.0.3/lopsubex.c Examining data/liblopsub-1.0.3/lsg.c Examining data/liblopsub-1.0.3/lsg.h FINAL RESULTS: data/liblopsub-1.0.3/lopsub.c:159:25: [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. __attribute__ ((format (printf, 2, 0))) data/liblopsub-1.0.3/lopsub.c:174:8: [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. ret = vsnprintf(*result, size, fmt, aq); data/liblopsub-1.0.3/lopsub.c:187:8: [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. ret = vsnprintf(*result, size, fmt, aq); data/liblopsub-1.0.3/lopsub.c:194:25: [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. __attribute__ ((format (printf, 2, 3))) data/liblopsub-1.0.3/lopsub.c:982:16: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. p = *result + sprintf(*result, "%.*s%s", indent_len, space, pfx); data/liblopsub-1.0.3/lopsub.c:988:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. p += sprintf(p, data/liblopsub-1.0.3/lopsub.c:1192:4: [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(result + nbytes, lpr->inputs[i]); data/liblopsub-1.0.3/lopsub.c:1210:6: [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(result + nbytes, data/liblopsub-1.0.3/lsg.c:598:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(result, "%s/%s", output_dir, arg); data/liblopsub-1.0.3/lsg.c:606:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(result, "%s/%s.lsg.%s", output_dir, suite.name.orig, suffix); data/liblopsub-1.0.3/lsg.c:781:10: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. ret += sprintf(cmdline + ret, "%s ", argv[i]); data/liblopsub-1.0.3/lsg.c:637:30: [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. char *source_date_epoch = getenv("SOURCE_DATE_EPOCH"); data/liblopsub-1.0.3/lopsub.c:868: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. static const char space[MAX_OPTION_LEN + 1] = " "; data/liblopsub-1.0.3/lopsub.c:1186: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(result, &lpr->num_inputs, 4); data/liblopsub-1.0.3/lopsub.c:1202: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(result + nbytes, &lor->given, 4); data/liblopsub-1.0.3/lopsub.c:1220:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(result + nbytes, p, bytes); data/liblopsub-1.0.3/lopsub.c:1267: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(&lpr->num_inputs, p, 4); data/liblopsub-1.0.3/lopsub.c:1289: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(&lor->given, p, 4); data/liblopsub-1.0.3/lopsub.c:1313: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(q, p, bytes); data/liblopsub-1.0.3/lsg.c:347:14: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *out = fopen(outpath, "w"); data/liblopsub-1.0.3/lsg.c:396:14: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *out = fopen(outpath, "w"); data/liblopsub-1.0.3/lsg.c:451: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 suffix[20] = ""; data/liblopsub-1.0.3/lsg.c:453:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(suffix, "%d", j); data/liblopsub-1.0.3/lsg.c:619: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). out = fopen(outpath, "w"); data/liblopsub-1.0.3/lsg.c:627: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 date[200]; data/liblopsub-1.0.3/lsg.c:727: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). atoi(opt->default_val) : 0; data/liblopsub-1.0.3/lopsub.c:489:7: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen(opt->name) == len) { /* exact match */ data/liblopsub-1.0.3/lopsub.c:968:20: [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 val_len = strlen(val); data/liblopsub-1.0.3/lopsub.c:985:20: [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 val_len = strlen(val); data/liblopsub-1.0.3/lopsub.c:1111: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). size_t arglen = strlen(arg); data/liblopsub-1.0.3/lopsub.c:1193:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nbytes += strlen(lpr->inputs[i]) + 1; data/liblopsub-1.0.3/lopsub.c:1212: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). nbytes += strlen(lor->value[j].string_val) + 1; data/liblopsub-1.0.3/lopsub.c:1279: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). p += strlen(p) + 1; data/liblopsub-1.0.3/lopsub.c:1306:10: [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). p += strlen(lor->value[j].string_val) + 1; data/liblopsub-1.0.3/lopsub.c:1551: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). line = malloc(2 * strlen(s) + 3); data/liblopsub-1.0.3/lsg.c:206: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(cmd->name.orig) + 8; data/liblopsub-1.0.3/lsg.c:226:10: [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(cmd->non_opts_name); data/liblopsub-1.0.3/lsg.c:595: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). len = strlen(output_dir) + strlen(arg) + 1; data/liblopsub-1.0.3/lsg.c:595: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). len = strlen(output_dir) + strlen(arg) + 1; data/liblopsub-1.0.3/lsg.c:602: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(output_dir) + 1 /* slash */ + strlen(suite.name.orig) data/liblopsub-1.0.3/lsg.c:602:45: [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(output_dir) + 1 /* slash */ + strlen(suite.name.orig) data/liblopsub-1.0.3/lsg.c:603:49: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). + 1 /* dot */ + 3 /* "lsg" */ + 1 /* dot */ + strlen(suffix); data/liblopsub-1.0.3/lsg.c:777:10: [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). ret += strlen(argv[i]) + 1; ANALYSIS SUMMARY: Hits = 43 Lines analyzed = 3058 in approximately 0.12 seconds (25877 lines/second) Physical Source Lines of Code (SLOC) = 2558 Hits@level = [0] 213 [1] 17 [2] 14 [3] 1 [4] 11 [5] 0 Hits@level+ = [0+] 256 [1+] 43 [2+] 26 [3+] 12 [4+] 11 [5+] 0 Hits/KSLOC@level+ = [0+] 100.078 [1+] 16.81 [2+] 10.1642 [3+] 4.69116 [4+] 4.30023 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.