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/ruby-grib-0.4.0/ext/grib.c FINAL RESULTS: data/ruby-grib-0.4.0/ext/grib.c:238: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(var_new->gtype, gtype); data/ruby-grib-0.4.0/ext/grib.c:246: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(var_new->vname, vname); data/ruby-grib-0.4.0/ext/grib.c:252: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(var_new->ltype, vname); data/ruby-grib-0.4.0/ext/grib.c:263:7: [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(var_new->ltype, vname); data/ruby-grib-0.4.0/ext/grib.c:404: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(gfile->fname, fname); data/ruby-grib-0.4.0/ext/grib.c:433:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s_level%ld", var->vname, var->ltype_id); data/ruby-grib-0.4.0/ext/grib.c:435:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s_%s", var->vname, var->ltype); data/ruby-grib-0.4.0/ext/grib.c:436:8: [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(var->vname, buf); data/ruby-grib-0.4.0/ext/grib.c:442:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s_level%ld", var2->vname, var2->ltype_id); data/ruby-grib-0.4.0/ext/grib.c:444:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s_%s", var2->vname, var2->ltype); data/ruby-grib-0.4.0/ext/grib.c:445: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(var2->vname, buf); data/ruby-grib-0.4.0/ext/grib.c:449:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s_%s", var->vname, var->gtype); data/ruby-grib-0.4.0/ext/grib.c:450: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(var->vname, buf); data/ruby-grib-0.4.0/ext/grib.c:453:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s_%s", var2->vname, var2->gtype); data/ruby-grib-0.4.0/ext/grib.c:454: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(var2->vname, buf); data/ruby-grib-0.4.0/ext/grib.c:457:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s_%d", var->vname, i); data/ruby-grib-0.4.0/ext/grib.c:458: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(var->vname, buf); data/ruby-grib-0.4.0/ext/grib.c:461:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s_%d", var2->vname, i); data/ruby-grib-0.4.0/ext/grib.c:462: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(var2->vname, buf); data/ruby-grib-0.4.0/ext/grib.c:163: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 vname[MAX_VALUE_LENGTH]; data/ruby-grib-0.4.0/ext/grib.c:181: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 gtype[MAX_VALUE_LENGTH]; data/ruby-grib-0.4.0/ext/grib.c:244: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(vname, "id%ld", pnum); data/ruby-grib-0.4.0/ext/grib.c:396:16: [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 *file = fopen(fname, mode); data/ruby-grib-0.4.0/ext/grib.c:418: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[MAX_VALUE_LENGTH]; data/ruby-grib-0.4.0/ext/grib.c:651: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 value[MAX_VALUE_LENGTH]; data/ruby-grib-0.4.0/ext/grib.c:662:16: [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. unsigned char value[MAX_VALUE_LENGTH]; data/ruby-grib-0.4.0/ext/grib.c:674: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 value[MAX_VALUE_LENGTH]; data/ruby-grib-0.4.0/ext/grib.c:679:10: [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). if (atol(value) == l) data/ruby-grib-0.4.0/ext/grib.c:256: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). for (i=1,j=1; i<strlen(vname); i++) { data/ruby-grib-0.4.0/ext/grib.c:403:32: [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). gfile->fname = ALLOC_N(char, strlen(fname)+1); ANALYSIS SUMMARY: Hits = 30 Lines analyzed = 819 in approximately 0.04 seconds (19624 lines/second) Physical Source Lines of Code (SLOC) = 708 Hits@level = [0] 0 [1] 2 [2] 9 [3] 0 [4] 19 [5] 0 Hits@level+ = [0+] 30 [1+] 30 [2+] 28 [3+] 19 [4+] 19 [5+] 0 Hits/KSLOC@level+ = [0+] 42.3729 [1+] 42.3729 [2+] 39.548 [3+] 26.8362 [4+] 26.8362 [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.