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/sac2mseed-1.12+ds1/src/sac2mseed.c Examining data/sac2mseed-1.12+ds1/src/sacformat.h FINAL RESULTS: data/sac2mseed-1.12+ds1/src/sac2mseed.c:1322:13: [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. fields = sscanf (lastfield, "%s", filename); data/sac2mseed-1.12+ds1/src/sac2mseed.c:102:24: [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). else if ( (ofp = fopen (outputfile, "wb")) == NULL ) data/sac2mseed-1.12+ds1/src/sac2mseed.c:117:24: [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). else if ( (mfp = fopen (metafile, "wb")) == NULL ) data/sac2mseed-1.12+ds1/src/sac2mseed.c:219: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). if ( (ifp = fopen (sacfile, "rb")) == NULL ) data/sac2mseed-1.12+ds1/src/sac2mseed.c:237: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 mseedoutputfile[1024]; data/sac2mseed-1.12+ds1/src/sac2mseed.c:254:7: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat (mseedoutputfile, ".mseed"); data/sac2mseed-1.12+ds1/src/sac2mseed.c:256: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). if ( (ofp = fopen (mseedoutputfile, "wb")) == NULL ) data/sac2mseed-1.12+ds1/src/sac2mseed.c:469: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 fourc[4]; data/sac2mseed-1.12+ds1/src/sac2mseed.c:645: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 (&hdrver, &sh->nvhdr, 4); data/sac2mseed-1.12+ds1/src/sac2mseed.c:730: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[1025]; data/sac2mseed-1.12+ds1/src/sac2mseed.c:784: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 (cp, line, 24); data/sac2mseed-1.12+ds1/src/sac2mseed.c:845: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[1025]; data/sac2mseed-1.12+ds1/src/sac2mseed.c:946: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 string[50]; data/sac2mseed-1.12+ds1/src/sac2mseed.c:996: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 (string, sh->kinst, 8); string[8] = '\0'; data/sac2mseed-1.12+ds1/src/sac2mseed.c:1026: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 (string, sh->kevnm, 16); string[16] = '\0'; data/sac2mseed-1.12+ds1/src/sac2mseed.c:1033: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 (string, sh->kuser0, 8); string[8] = '\0'; data/sac2mseed-1.12+ds1/src/sac2mseed.c:1040: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 (string, sh->kuser1, 8); string[8] = '\0'; data/sac2mseed-1.12+ds1/src/sac2mseed.c:1047: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 (string, sh->kuser2, 8); string[8] = '\0'; data/sac2mseed-1.12+ds1/src/sac2mseed.c:1258: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[1024]; data/sac2mseed-1.12+ds1/src/sac2mseed.c:1262: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 filename[1024]; data/sac2mseed-1.12+ds1/src/sac2mseed.c:1268:14: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ( (fp = fopen (listfile, "rb")) == NULL ) data/sac2mseed-1.12+ds1/src/sacformat.h:135: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 kstnm[8]; /* F station name */ data/sac2mseed-1.12+ds1/src/sacformat.h:136: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 kevnm[16]; /* event name */ data/sac2mseed-1.12+ds1/src/sacformat.h:137: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 khole[8]; /* man-made event name */ data/sac2mseed-1.12+ds1/src/sacformat.h:138: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 ko[8]; /* event origin time id */ data/sac2mseed-1.12+ds1/src/sacformat.h:139: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 ka[8]; /* 1st arrival time ident */ data/sac2mseed-1.12+ds1/src/sacformat.h:140: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 kt0[8]; /* time pick 0 ident */ data/sac2mseed-1.12+ds1/src/sacformat.h:141: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 kt1[8]; /* time pick 1 ident */ data/sac2mseed-1.12+ds1/src/sacformat.h:142: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 kt2[8]; /* time pick 2 ident */ data/sac2mseed-1.12+ds1/src/sacformat.h:143: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 kt3[8]; /* time pick 3 ident */ data/sac2mseed-1.12+ds1/src/sacformat.h:144: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 kt4[8]; /* time pick 4 ident */ data/sac2mseed-1.12+ds1/src/sacformat.h:145: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 kt5[8]; /* time pick 5 ident */ data/sac2mseed-1.12+ds1/src/sacformat.h:146: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 kt6[8]; /* time pick 6 ident */ data/sac2mseed-1.12+ds1/src/sacformat.h:147: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 kt7[8]; /* time pick 7 ident */ data/sac2mseed-1.12+ds1/src/sacformat.h:148: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 kt8[8]; /* time pick 8 ident */ data/sac2mseed-1.12+ds1/src/sacformat.h:149: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 kt9[8]; /* time pick 9 ident */ data/sac2mseed-1.12+ds1/src/sacformat.h:150: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 kf[8]; /* end of event ident */ data/sac2mseed-1.12+ds1/src/sacformat.h:151: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 kuser0[8]; /* available to user */ data/sac2mseed-1.12+ds1/src/sacformat.h:152: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 kuser1[8]; /* available to user */ data/sac2mseed-1.12+ds1/src/sacformat.h:153: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 kuser2[8]; /* available to user */ data/sac2mseed-1.12+ds1/src/sacformat.h:154: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 kcmpnm[8]; /* F component name */ data/sac2mseed-1.12+ds1/src/sacformat.h:155: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 knetwk[8]; /* network name */ data/sac2mseed-1.12+ds1/src/sacformat.h:156: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 kdatrd[8]; /* date data read */ data/sac2mseed-1.12+ds1/src/sacformat.h:157: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 kinst[8]; /* instrument name */ data/sac2mseed-1.12+ds1/src/sac2mseed.c:239:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (mseedoutputfile, sacfile, sizeof(mseedoutputfile)-6 ); data/sac2mseed-1.12+ds1/src/sac2mseed.c:240: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). namelen = strlen (sacfile); data/sac2mseed-1.12+ds1/src/sac2mseed.c:1140:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). strlen (argvec[optind]) > 1 ) ANALYSIS SUMMARY: Hits = 47 Lines analyzed = 1762 in approximately 0.07 seconds (25309 lines/second) Physical Source Lines of Code (SLOC) = 1285 Hits@level = [0] 100 [1] 3 [2] 43 [3] 0 [4] 1 [5] 0 Hits@level+ = [0+] 147 [1+] 47 [2+] 44 [3+] 1 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 114.397 [1+] 36.5759 [2+] 34.2412 [3+] 0.77821 [4+] 0.77821 [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.