Commit Graph

115 Commits

Author SHA1 Message Date
David A. Wheeler d42ecdba1d Fix indentation (pylint)
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2019-02-25 23:33:57 -05:00
Markus Elfring 3b8ca7b34a Usage of augmented assignment statements
Source code like “var = var + X” was specified at some places so far.
Use augmented assignment statements instead because they are succinct
and can be more efficient.
https://docs.python.org/3/reference/simple_stmts.html#augmented-assignment-statements

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2019-02-25 21:55:06 +01:00
David A. Wheeler e4f4d4a34b Set version number for next release (2.0.9)
Change the version number *now*, before release, so that we won't
accidentally release software with a duplicate version number later.
Also, tweak the release_process.md documentation to clarify a few things.

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2019-01-21 18:54:01 -05:00
David A. Wheeler 49a2289fe3 _ftcsat should be _ftcscat. Thanks to Lucas Ramage
Fix typo in name of "banned" function.  Thanks to Lucas Ramage,
who reported this January 2019.

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2019-01-12 11:53:27 -05:00
Michael Clark 3c9bf48736 Fixes #19 - don't warn if memcpy call includes sizeof(first arg)
Also fixes for the test output, comprising the bulk of the patch.
2018-12-19 08:07:47 -05:00
David A. Wheeler fccc59cdcb Update for next version (2.0.8)
Change the version number NOW, so we won't forget later.

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2018-10-08 18:55:52 -04:00
David A. Wheeler 6abb7c524b Fix SourceForge bug #14 No special warning for filename with long dash
This was reported by philipp. After some tweaking I got the warning
to work on both Python 2 and Python 3.

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2018-10-06 19:11:21 -04:00
David A. Wheeler da8b2016e0 Change vesion number to 2.0.7
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2018-09-30 21:42:56 -04:00
David A. Wheeler 530a88a395 Change www.dwheeler.com to dwheeler.com
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2018-09-30 21:35:11 -04:00
David A. Wheeler 3021892deb Halt if --listrules and --html are invoked simultaneously
We don't currently support this combination, so error out if it's attempted.
Fixes SourceForge bug report #15 "Incomplete HTML output for list of rules".

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2018-09-30 21:20:48 -04:00
David A. Wheeler 0eed96c22d Remove unused global variables
This fixes bug report #13, "Unused global variables" from philipp.
Thanks!

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2018-09-30 21:08:48 -04:00
David A. Wheeler fdd8a3bf47 Do not halt on unterminated parameter list in C code
If we see an unterminated parameter list in the code being analyzed,
continue to warn, but treat it as an empty list and continue.
That say, we can try to process at least some of the code.

This fixes bug report #12 TypeError raised for incomplete source code
from philipp created: 2018-03-10.

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2018-09-30 20:43:13 -04:00
nickthetait 8e12d79029 Fix a comment
Signed-off-by: nickthetait <nicholas.tait@ieee.org>
2018-05-01 21:57:54 -06:00
nickthetait cda1b97c2e Standardize membership checking style
Reported as E713 by pycodestyle

Signed-off-by: nickthetait <nicholas.tait@ieee.org>
2018-03-15 22:49:45 -06:00
nickthetait 7e5531da5b Standardize whitespace between functions
Reported as E305 and E305 by pycodestyle

Signed-off-by: nickthetait <nicholas.tait@ieee.org>
2018-03-15 22:49:22 -06:00
nickthetait aeac180dbb Fix leading whitespace before comments
reported as E261 by pycodestyle
2018-03-15 22:46:01 -06:00
David A. Wheeler d7ce082024 Add "--error-level" option for continuous integration systems
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2018-01-27 18:11:52 -05:00
David A. Wheeler 34a58911d3 Update version numbers
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2018-01-26 00:24:39 -05:00
David A. Wheeler 2691ac6de5 Use https:, not http:, for cwe.mitre.org
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2018-01-25 23:52:35 -05:00
David A. Wheeler 6380038c34 Fix CWE hyperlinks with trailing ! or /
This fixes SF bug #9.

Thanks to philipp for reporting it!

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2018-01-25 23:48:05 -05:00
David A. Wheeler 9d1378e110 Fix typo in gsignal|ssignal rule
Fix a typo in the gsignal|ssignal rule.
This fixes SF bug #8.

My thanks to philipp for reporting this!

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2018-01-25 23:29:37 -05:00
David A. Wheeler 5aa1dec7f7 Update www.dwheeler.com URLs to use https
The www.dwheeler.com site has long supported https, but I forgot
to change these URLs. Fix that, so that people will use https.

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-09-23 20:45:03 -04:00
David A. Wheeler 4d589859dc Change array to tuple
Change possible_levels to a tuple.  Arrays are mutable,
but we never want to mutate this value, so changing it
to a tuple reduces the risk of accidentally mutating it.

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-09-23 20:41:45 -04:00
David A. Wheeler 6f513af900 Always report hit counts correctly, even if ignored using -m
This commit means that the output provides useful summary data,
even if the lower-level hits are suppressed.

Note that this does use a little more memory when some hits
are supressed, since the hitlist is fully created even
if only parts are displayed.  However, modern systems have
lots of memory. Hopefully we'll never analyze software
with so many problems that this is a problem itself :-).
If someone ever has that problem, they can output everything
and filter it separately.

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-09-23 20:36:50 -04:00
Jon Hood e06e2ba3df update CWE, risk, and discussion for C++14 STL functions 2017-09-14 13:16:22 -05:00
David A. Wheeler 05ad330a53 Merge /u/squinky86/flawfinder-2/ branch master into master
https://sourceforge.net/p/flawfinder/code/merge-requests/2/
2017-09-10 00:45:36 +00:00
Jon Hood 1b7199ea16 add detection of errant equal, mismatch, and is_permutation 2017-09-08 13:20:28 -05:00
Jon Hood e522ea7291 add detection of crypt_r function 2017-09-07 13:47:10 -05:00
David A. Wheeler 24992c0f08 Update version to 2.0.4
My upload intended for pypitest appears to have gone to pypi instead.
To eliminate confusion, I'm bumping the version number so that
any single version number always refers to exactly one program version.

This was done with:
sed -i.bak -e 's/2\.0\.3/2.0.4/g' \
  ChangeLog correct-results.* flawfinder makefile setup.py

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-09-02 20:46:45 -04:00
David A. Wheeler ec31c822dd Mark version as 2.0.3
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-09-02 20:03:44 -04:00
David A. Wheeler d38535419f Update version number to 2.0.2
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-26 17:56:29 -04:00
David A. Wheeler 339763c644 Add test for saving/loading hitlist, add Python3 fixes for it
Test the saving and loading of hitlists.
This detected a Python3 problem, which was easily corrected by
saving and loading in binary "b" format instead of text format.

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-26 16:15:17 -04:00
David A. Wheeler 203115edc3 Update book title
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-26 15:28:22 -04:00
David A. Wheeler a19a2bb694 Don't output "saving hitlist..." if quiet
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-26 15:13:35 -04:00
David A. Wheeler 62c1db1141 Rename "input" to avoid redefining built-in
We formerly used a variable named "input".  This is legal in Python,
but potentially confusing since there's a built-in named "input"
that this shadows in that scope.  Rename the variable, to
avoid that confusion.  This fixes the following pylint warning:
W:1440, 8: Redefining built-in 'input' (redefined-builtin)

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-26 11:00:04 -04:00
David A. Wheeler ad0d06cced Remove unnecessary import of os.path
We import os, so there's no need to import os.path.
This fixes the following pylint warning:
C: 53, 0: Imports from package os are not grouped (ungrouped-imports)

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-26 10:55:02 -04:00
David A. Wheeler 57929a1c60 Fix some Python3 stragglers, so flawfinder runs on Python 2 or 3
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-23 22:01:34 -04:00
David A. Wheeler cdea1a214a Update comments
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-23 21:55:35 -04:00
David A. Wheeler 48a6b3982b Modify flawfinder to work in Python 2 *and* Python 3 - this passes tests
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-23 21:45:22 -04:00
David A. Wheeler 0a1761b10b Replace some string.find/rfind for Python 2/3 compatibility
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-13 10:11:58 -04:00
David A. Wheeler 94164014da Change string.join => "".join for simultaneous Python 2/3 support
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-12 21:18:11 -04:00
David A. Wheeler 05c238acc6 Modify find/split operations to work on Python 2 and 3
Python 3 only accepts certain syntaxes for find & split.
Thankfully, it's possible to use them in Python 2, so rework
it so we can use the same syntax for both.
This is not detected or fixed by futurize, sadly
(a problem true for many other situations).

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-12 21:12:54 -04:00
David A. Wheeler 8fee8a34bd Remove another use of range (Python 2/3 difference)
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-12 21:01:11 -04:00
David A. Wheeler c2ecdcf89b Remove many uses of range(), a Python 2/3 difference
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-12 20:58:19 -04:00
David A. Wheeler 0f4deebe00 Remove some Python 2/3 inconsistencies
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-12 20:45:05 -04:00
David A. Wheeler 6bb9c5d3c7 Tweak code to eliminate pylint warning
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-12 20:34:04 -04:00
David A. Wheeler eb3631d839 Remove use of Python 2-only __cmp__
Remove use of __cmp__, which is in Python 2 but not in Python 3.
Instead, use sort keys, which work in Python 2 and 3.

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-12 20:31:41 -04:00
David A. Wheeler ea67f5dbca Switch all print statements to print() functions
Switch all print statements to print() functions per PEP 3105.
Python 3 *only* supports print() functions, so this begins to
move the code towards simultaneously supporting python 2 and 3.

This implements "stage1" of futurize.  In theory, "stage1" is
supposed to be "low risk", but in fact a *large* number of
manual fixes had to be made to make the program work again.

Python 2's traditional print statement includes the "softspace"
feature. This is "a semi-secret attribute on files currently used to tell
print whether to insert a space before the first item".  The print()
function does not have the "softspace" feature, so there is no direct
translation for any situation that depended on softspaces.
Flawfinder used softspaces extensively, as they were convenient,
so it took a little work to make print() functions work.

Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-08-12 19:33:49 -04:00
David A. Wheeler d5c4af4be1 Add "fingerprint" to CSV output
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-07-30 23:50:52 -04:00
David A. Wheeler 310f850d5b Update version number to 2.0.1
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
2017-07-30 23:15:56 -04:00