Skip to content

Comments

Update intcheck_op.c#910

Merged
ddpbsd merged 3 commits intoossec:masterfrom
bryonglodencissp:patch-1
Aug 4, 2016
Merged

Update intcheck_op.c#910
ddpbsd merged 3 commits intoossec:masterfrom
bryonglodencissp:patch-1

Conversation

@bryonglodencissp
Copy link

@bryonglodencissp bryonglodencissp commented Aug 1, 2016

Checking ./ossec-hids-master/src/client-agent/intcheck_op.c...
[./ossec-hids-master/src/client-agent/intcheck_op.c:65]: (error) Uninitialized variable: mf_sum
[./ossec-hids-master/src/client-agent/intcheck_op.c:66]: (error) Uninitialized variable: sf_sum
Checking ./ossec-hids-master/src/client-agent/intcheck_op.c: WIN32...

It's always good to initialize the elements of a char array, at least to "", because if you try to retrieve an element before it gets assigned any actual (non-garbage) value, then you run the risk of retrieving a garbage value that might cause your program to crash, or worse, might corrupt memory.

Found by https://github.com/bryongloden/cppcheck

Bryon Gloden, CISSP® added 3 commits August 1, 2016 16:04
(error) Uninitialized variables: mf_sum and sf_sum

It's always good to initialize integer variables, at least to 0, because if you try to retrieve the variable before it gets assigned any actual (non-garbage) value, then you run the risk of retrieving a garbage value that might cause your program to crash, or worse, might corrupt memory.

Found by https://github.com/bryongloden/cppcheck
Changed initialized value from 0 to NULL
Changed initialized value from NULL to ""

REF: http://stackoverflow.com/a/18688992
@bryonglodencissp
Copy link
Author

Commits 546188b and 3c6a63b fixed with 4f6cf20, thank youuuuuu

@ddpbsd ddpbsd merged commit 4d541fa into ossec:master Aug 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants