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/dicomnifti-2.33.1/include/dinifti.h Examining data/dicomnifti-2.33.1/include/dicomInfo.h Examining data/dicomnifti-2.33.1/include/niftiout.h Examining data/dicomnifti-2.33.1/include/dicomhead.h Examining data/dicomnifti-2.33.1/src/niftiout.cc Examining data/dicomnifti-2.33.1/src/dicomhead.cc Examining data/dicomnifti-2.33.1/src/dinifti.cc Examining data/dicomnifti-2.33.1/src/dicomInfo.cc FINAL RESULTS: data/dicomnifti-2.33.1/src/dinifti.cc:98: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(fname, outFileName.str().c_str()); data/dicomnifti-2.33.1/src/dinifti.cc:287: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(opts.nameFormat, &(argv[parseArg][7])); data/dicomnifti-2.33.1/src/dicomInfo.cc:273: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). repTime_ = atoi(data); data/dicomnifti-2.33.1/src/dicomInfo.cc:522:26: [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). acqDatTime.tm_mday = atoi(&(strn[6])); data/dicomnifti-2.33.1/src/dicomInfo.cc:524:25: [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). acqDatTime.tm_mon = atoi(&(strn[4])) - 1; data/dicomnifti-2.33.1/src/dicomInfo.cc:526:26: [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). acqDatTime.tm_year = atoi(strn) - 1900; data/dicomnifti-2.33.1/src/dicomInfo.cc:549:26: [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). acqDatTime.tm_sec = atoi(dec); data/dicomnifti-2.33.1/src/dicomInfo.cc:552:26: [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). acqDatTime.tm_min = atoi(dec); data/dicomnifti-2.33.1/src/dicomInfo.cc:555:27: [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). acqDatTime.tm_hour = atoi(dec); data/dicomnifti-2.33.1/src/dicomInfo.cc:791: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). imageNum_ = atoi(strn); data/dicomnifti-2.33.1/src/dicomInfo.cc:859: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). acqNum_ = atoi(strn); data/dicomnifti-2.33.1/src/dicomInfo.cc:894:19: [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). acqEchoNum_ = atoi(strn); data/dicomnifti-2.33.1/src/dicomInfo.cc:1366: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(shadowSet_, strn, sizeof(char)*(len)); data/dicomnifti-2.33.1/src/dicomInfo.cc:1375: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(retValue, shadowSet_, sizeof(char)*(len)); data/dicomnifti-2.33.1/src/dicomInfo.cc:1552:17: [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). numSlices_ = atoi(strn); data/dicomnifti-2.33.1/src/dicomInfo.cc:1931: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((void *)data, (const void *)volumeData_, columns_ * rows_ * sizeof(U16)); data/dicomnifti-2.33.1/src/dinifti.cc:300:21: [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). opts.numSlices = atoi(argv[parseArg]); data/dicomnifti-2.33.1/src/dicomInfo.cc:1372: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(shadowSet_); data/dicomnifti-2.33.1/src/dinifti.cc:286: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). opts.nameFormat = new char [strlen(argv[parseArg]) - 6]; data/dicomnifti-2.33.1/src/dinifti.cc:456:41: [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 ( (opts.nameFormat != NULL) && (strlen(opts.nameFormat) > 0) ) data/dicomnifti-2.33.1/src/dinifti.cc:467: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). if (outName[strlen(outName)-1] != '/') data/dicomnifti-2.33.1/src/dinifti.cc:485: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). else if ( (opts.nameFormat != NULL) && (strlen(opts.nameFormat) > 0) ) data/dicomnifti-2.33.1/src/niftiout.cc:276:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(hdr.descrip, image->ACQDescription().c_str(), 79); ANALYSIS SUMMARY: Hits = 23 Lines analyzed = 3675 in approximately 0.10 seconds (37826 lines/second) Physical Source Lines of Code (SLOC) = 2130 Hits@level = [0] 9 [1] 6 [2] 15 [3] 0 [4] 2 [5] 0 Hits@level+ = [0+] 32 [1+] 23 [2+] 17 [3+] 2 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 15.0235 [1+] 10.7981 [2+] 7.98122 [3+] 0.938967 [4+] 0.938967 [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.