7613 Commits

Author SHA1 Message Date
Rainer Gerhards
1303d5aea1 Merge branch 'v8-stable' 2014-07-25 09:36:13 +02:00
Rainer Gerhards
b668bf01e0 Merge branch 'v7-stable' into v8-stable 2014-07-25 09:36:03 +02:00
Rainer Gerhards
7e8d14a922 maintain ChangeLog 2014-07-25 09:08:56 +02:00
Tomas Heinrich
be45099574 bugfix: plug a memleak in imuxsock
Hash table and rate limiter for the system socket weren't freed.

A side-effect was that the "Last message repeated..." notice didn't
get printed if rsyslog was shut down before the repetition was broken.
2014-07-25 09:07:08 +02:00
Tomas Heinrich
7a2e247347 bugfix: plug a memleak in imuxsock
The hash table for the system socket was allocated twice. The other
one being in activateListeners().

This commit practically reverts: 34a77cde2423303da72ab773128a2ddcf41
The issue seems to be that the hash table is not initialized (to NULL)
rather then not being allocated.
2014-07-25 09:06:10 +02:00
Rainer Gerhards
8a0cf248d3 Merge branch 'v8-stable' 2014-07-22 22:52:46 +02:00
Rainer Gerhards
4b1964712c Merge branch 'v7-stable' into v8-stable
Conflicts:
	runtime/ruleset.c
2014-07-22 22:52:29 +02:00
Rainer Gerhards
a811e3386c fix regression (mem leak during normal operations) from commit b7a34ab022b4f427d0a73fc6ac37230e1ca29a84 2014-07-22 22:45:44 +02:00
Rainer Gerhards
0152b9f221 fix regression from commit a955a9900629e2065e3ed1dd9d8f5a94e6faa7f0 2014-07-22 22:11:34 +02:00
Tomas Heinrich
19aa27d3aa bugfix: plug a memleak in rulesetProcessCnf()
Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/ruleset.c:984: alloc_arg: "rulesetConstruct(ruleset_t **)" allocates memory that is stored into "pRuleset".
rsyslog-7.4.10/runtime/ruleset.c:729:1: alloc_fn: Storage is returned from allocation function "calloc(size_t, size_t)".
rsyslog-7.4.10/runtime/ruleset.c:729:1: var_assign: Assigning: "pThis" = "calloc(1UL, 56UL)".
rsyslog-7.4.10/runtime/ruleset.c:729:1: noescape: Resource "pThis" is not freed or pointed-to in function "rulesetInitialize(ruleset_t *)".
rsyslog-7.4.10/runtime/ruleset.c:726:1: noescape: "rulesetInitialize(ruleset_t *)" does not free or save its pointer parameter "pThis".
rsyslog-7.4.10/runtime/ruleset.c:729:1: var_assign: Assigning: "*ppThis" = "pThis".
rsyslog-7.4.10/runtime/ruleset.c:985: noescape: Resource "pRuleset" is not freed or pointed-to in function "rulesetSetName(ruleset_t *, uchar *)".
rsyslog-7.4.10/runtime/ruleset.c:638:43: noescape: "rulesetSetName(ruleset_t *, uchar *)" does not free or save its pointer parameter "pThis".
rsyslog-7.4.10/runtime/ruleset.c:1011: leaked_storage: Variable "pRuleset" going out of scope leaks the storage it points to.
2014-07-22 18:30:01 +02:00
Rainer Gerhards
2c0c0a752a Merge branch 'v8-stable-rg-merge' into master-rg-merge 2014-07-22 18:23:38 +02:00
Rainer Gerhards
c8f3f193dd Merge branch 'v7-stable-rg-merges' into v8-stable-rg-merge
Conflicts:
	runtime/ruleset.c
2014-07-22 18:23:18 +02:00
Tomas Heinrich
b46d1765ef bugfix: don't leak memory returned by newActive()
Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/ruleset.c:506: alloc_fn: Storage is returned from allocation function "newActive(batch_t *)".
rsyslog-7.4.10/runtime/ruleset.c:220:2: alloc_fn: Storage is returned from allocation function "malloc(size_t)".
rsyslog-7.4.10/runtime/ruleset.c:220:2: return_alloc_fn: Directly returning storage allocated by "malloc(size_t)".
rsyslog-7.4.10/runtime/ruleset.c:506: var_assign: Assigning: "thenAct" = storage returned from "newActive(pBatch)".
rsyslog-7.4.10/runtime/ruleset.c:509: leaked_storage: Variable "thenAct" going out of scope leaks the storage it points to.
2014-07-22 17:57:25 +02:00
Tomas Heinrich
029cf3e1b4 bugfix: don't leak memory returned by newActive()
Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/ruleset.c:326: alloc_fn: Storage is returned from allocation function "newActive(batch_t *)".
rsyslog-7.4.10/runtime/ruleset.c:220:2: alloc_fn: Storage is returned from allocation function "malloc(size_t)".
rsyslog-7.4.10/runtime/ruleset.c:220:2: return_alloc_fn: Directly returning storage allocated by "malloc(size_t)".
rsyslog-7.4.10/runtime/ruleset.c:326: var_assign: Assigning: "newAct" = storage returned from "newActive(pBatch)".
rsyslog-7.4.10/runtime/ruleset.c:362: leaked_storage: Variable "newAct" going out of scope leaks the storage it points to.

Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/ruleset.c:373: alloc_fn: Storage is returned from allocation function "newActive(batch_t *)".
rsyslog-7.4.10/runtime/ruleset.c:220:2: alloc_fn: Storage is returned from allocation function "malloc(size_t)".
rsyslog-7.4.10/runtime/ruleset.c:220:2: return_alloc_fn: Directly returning storage allocated by "malloc(size_t)".
rsyslog-7.4.10/runtime/ruleset.c:373: var_assign: Assigning: "newAct" = storage returned from "newActive(pBatch)".
rsyslog-7.4.10/runtime/ruleset.c:376: leaked_storage: Variable "newAct" going out of scope leaks the storage it points to.
2014-07-22 17:57:08 +02:00
Tomas Heinrich
e0d7c95cd7 don't allocate a 0B chunk of memory
Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/ruleset.c:220:9: warning: Call to 'malloc' has an allocation size of 0 bytes
2014-07-22 17:52:00 +02:00
Rainer Gerhards
20705d1b83 Merge branch 'v8-stable' 2014-07-22 17:48:42 +02:00
Rainer Gerhards
979d36a08b Merge branch 'v7-stable' into v8-stable 2014-07-22 17:48:30 +02:00
Tomas Heinrich
081840c875 bugfix: always initialize an output parameter
Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/ratelimit.c:255:13: warning: The left operand of '!=' is a garbage value
2014-07-22 17:47:16 +02:00
Tomas Heinrich
a955a99006 bugfix: check return value of malloc()
Error: NULL_RETURNS (CWE-476):
rsyslog-7.4.10/runtime/queue.c:2126: returned_null: Function "malloc(size_t)" returns null (checked 140 out of 168 times).
rsyslog-7.4.10/action.c:1197: example_checked: Example 1: "malloc(batchNumMsgs(pBatch) * 1UL)" has its value checked in "(active = malloc(batchNumMsgs(pBatch) * 1UL)) == NULL".
rsyslog-7.4.10/grammar/lexer.l:302: example_checked: Example 2: "malloc(40UL)" has its value checked in "(bs = malloc(40UL)) == NULL".
rsyslog-7.4.10/grammar/rainerscript.c:2483: example_checked: Example 3: "malloc(8UL)" has its value checked in "(ar->arr = malloc(8UL)) == NULL".
rsyslog-7.4.10/plugins/imklog/bsd.c:221: example_checked: Example 4: "malloc(1UL * (iMaxLine + 1))" has its value checked in "(pRcv = (uchar *)malloc(1UL * (iMaxLine + 1))) == NULL".
rsyslog-7.4.10/plugins/imuxsock/imuxsock.c:968: example_checked: Example 5: "malloc(1UL * (iMaxLine + 1))" has its value checked in "(pRcv = (uchar *)malloc(1UL * (iMaxLine + 1))) == NULL".
rsyslog-7.4.10/runtime/queue.c:2126: var_assigned: Assigning: "pThis->mut" = null return value from "malloc(size_t)".
rsyslog-7.4.10/runtime/queue.c:2127: dereference: Dereferencing a pointer that might be null "pThis->mut" when calling "pthread_mutex_init(pthread_mutex_t *, pthread_mutexattr_t const *)".
2014-07-22 17:45:49 +02:00
Tomas Heinrich
232b9c976b bugfix: check return codes
Error: FORWARD_NULL (CWE-476):
rsyslog-7.4.10/runtime/prop.c:171: var_compare_op: Comparing "*ppThis" to null implies that "*ppThis" might be null.
rsyslog-7.4.10/runtime/prop.c:173: var_deref_model: Passing "ppThis" to function "CreateStringProp(prop_t **, uchar *, int)", which dereferences null "*ppThis".
rsyslog-7.4.10/runtime/prop.c:149:2: deref_parm_in_call: Function "SetString(prop_t *, uchar *, int)" dereferences "*ppThis".
rsyslog-7.4.10/runtime/prop.c:80:2: deref_parm: Directly dereferencing parameter "pThis".

Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/prop.c:80:5: warning: Access to field 'len' results in a dereference of a null pointer (loaded from variable 'pThis')
2014-07-22 17:45:01 +02:00
Tomas Heinrich
04bf9d5d81 bugfix: don't leak an open FD
Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/nsd_gtls.c:120: open_fn: Returning handle opened by function "open(char const *, int, ...)".
rsyslog-7.4.10/runtime/nsd_gtls.c:120: var_assign: Assigning: "fd" = handle returned from "open((char *)pszFile, 0)".
rsyslog-7.4.10/runtime/nsd_gtls.c:126: noescape: Resource "fd" is not freed or pointed-to in function "fstat(int, struct stat *)".
rsyslog-7.4.10/runtime/nsd_gtls.c:139: noescape: Resource "fd" is not freed or pointed-to in function "read(int, void *, size_t)".
rsyslog-7.4.10/runtime/nsd_gtls.c:154: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
2014-07-22 17:44:01 +02:00
Tomas Heinrich
33205a6d9c bugfix: don't leak memory when realloc() fails
Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/net.c:1168:2: warning: Potential leak of memory pointed to by 'buf'
rsyslog-7.4.10/runtime/rsyslog.h:445:40: note: expanded from macro 'RETiRet'
2014-07-22 17:42:38 +02:00
Tomas Heinrich
9283a201bc bugfix: use sockaddr_storage to store sockaddr_in6
Error: COMPILER_WARNING:
rsyslog-7.4.10/runtime/net.c: scope_hint: In function 'debugListenInfo'
rsyslog-7.4.10/runtime/net.c:1101: warning: dereferencing pointer 'ipv6' does break strict-aliasing rules
rsyslog-7.4.10/runtime/net.c:1100: note: initialized from here
2014-07-22 17:38:15 +02:00
Tomas Heinrich
e14a3d06f1 bugfix: plug a memleak in parsAddrWithBits()
Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/net.c:876: alloc_arg: "parsAddrWithBits(rsParsObj *, struct NetAddr **, int *)" allocates memory that is stored into "uIP".
rsyslog-7.4.10/parse.c:419:2: alloc_fn: Storage is returned from allocation function "calloc(size_t, size_t)".
rsyslog-7.4.10/parse.c:419:2: var_assign: Assigning: "*pIP" = "calloc(1UL, 16UL)".
rsyslog-7.4.10/runtime/net.c:880: leaked_storage: Variable "uIP" going out of scope leaks the storage it points to.
2014-07-22 17:37:27 +02:00
Tomas Heinrich
0a712f1025 bugfix: plug a memleak in addAllowedSenderLine()
Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/net.c:876: alloc_arg: "parsAddrWithBits(rsParsObj *, struct NetAddr **, int *)" allocates memory that is stored into "uIP".
rsyslog-7.4.10/parse.c:419:2: alloc_fn: Storage is returned from allocation function "calloc(size_t, size_t)".
rsyslog-7.4.10/parse.c:419:2: var_assign: Assigning: "*pIP" = "calloc(1UL, 16UL)".
rsyslog-7.4.10/runtime/net.c:882: noescape: Resource "uIP" is not freed or pointed-to in function "AddAllowedSender(struct AllowedSenders **, struct AllowedSenders **, struct NetAddr *, uint8_t)".
rsyslog-7.4.10/runtime/net.c:619:27: noescape: "AddAllowedSender(struct AllowedSenders **, struct AllowedSenders **, struct NetAddr *, uint8_t)" does not free or save its pointer parameter "iAllow".
rsyslog-7.4.10/runtime/net.c:890: leaked_storage: Variable "uIP" going out of scope leaks the storage it points to.
2014-07-22 17:37:05 +02:00
Tomas Heinrich
2943602d8f bugfix: plug a memleak in AddAllowedSender()
Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/net.c:771:2: warning: Potential leak of memory pointed to by 'allowIP.addr.NetAddr'
rsyslog-7.4.10/runtime/rsyslog.h:445:40: note: expanded from macro 'RETiRet'
2014-07-22 17:36:23 +02:00
Tomas Heinrich
c3c00ffaf2 Cast a value to make an analyzer happy
Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/net.c:725:34: warning: Result of 'malloc' is converted to a pointer of type 'struct sockaddr', which is incompatible with sizeof operand type 'struct sockaddr_in'
rsyslog-7.4.10/runtime/debug.h:146:20: note: expanded from macro 'MALLOC'
2014-07-22 16:30:18 +02:00
Tomas Heinrich
bcfe52349a bugfix: allocate correct object type
Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/net.c:178:19: warning: Result of 'calloc' is converted to a pointer of type 'permittedPeerWildcard_t', which is incompatible with sizeof operand type 'permittedPeers_t'
rsyslog-7.4.10/runtime/rsyslog.h:441:34: note: expanded from macro 'CHKmalloc'
2014-07-22 16:29:53 +02:00
Rainer Gerhards
5158095113 Merge branch 'v8-stable' 2014-07-22 16:21:49 +02:00
Rainer Gerhards
b038fe58cc Merge branch 'v7-stable' into v8-stable 2014-07-22 16:21:34 +02:00
Tomas Heinrich
a9c89d08d2 Use uchar instead of char for type size reference
Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/msg.c:3102:23: warning: Result of 'malloc' is converted to a pointer of type 'uchar', which is incompatible with sizeof operand type 'char'
rsyslog-7.4.10/runtime/debug.h:146:20: note: expanded from macro 'MALLOC'

Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/msg.c:3280:23: warning: Result of 'malloc' is converted to a pointer of type 'uchar', which is incompatible with sizeof operand type 'char'
rsyslog-7.4.10/runtime/debug.h:146:20: note: expanded from macro 'MALLOC'

Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/msg.c:3334:19: warning: Result of 'malloc' is converted to a pointer of type 'uchar', which is incompatible with sizeof operand type 'char'
rsyslog-7.4.10/runtime/debug.h:146:20: note: expanded from macro 'MALLOC'
2014-07-22 16:20:51 +02:00
Tomas Heinrich
54212d06cf bugfix: prevent an invalid free() and plug a memleak
pbMustBeFreed must not be set when returning a constant.
2014-07-22 16:20:18 +02:00
Tomas Heinrich
ad74e8589e Remove dead code 2014-07-22 16:18:09 +02:00
Tomas Heinrich
558c9ae9f1 bugfix: escape '/' in JSON strings
Error: DEADCODE (CWE-561):
rsyslog-7.4.10/runtime/msg.c:2602: cond_at_most: Condition "c >= 35", taking false branch. Now the value of "c" is at most 34.
rsyslog-7.4.10/runtime/msg.c:2602: cond_at_most: Condition "c >= 93", taking false branch. Now the value of "c" is at most 34.
rsyslog-7.4.10/runtime/msg.c:2602: cond_at_least: Condition "c >= 35", taking true branch. Now the value of "c" is at least 35.
rsyslog-7.4.10/runtime/msg.c:2602: cond_at_least: Condition "c <= 91", taking false branch. Now the value of "c" is at least 92.
rsyslog-7.4.10/runtime/msg.c:2602: cond_const: Condition "c >= 93", taking false branch. Now the value of "c" is equal to 92.
rsyslog-7.4.10/runtime/msg.c:2621: intervals: When switching on "c", the value of "c" must be in one of the following intervals: {(-inf,34], [92,92]}.
rsyslog-7.4.10/runtime/msg.c:2628: dead_error_condition: The switch value "c" cannot be "47".
rsyslog-7.4.10/runtime/msg.c:2628: dead_error_begin: Execution cannot reach this statement "case 47:".
2014-07-22 16:16:35 +02:00
Tomas Heinrich
257d035029 Remove dead code
Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/modules.c:1133:4: warning: Value stored to 'iPathLen' is never read
2014-07-22 16:15:33 +02:00
Tomas Heinrich
b0ec251528 Use uchar instead of char for type size reference
Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/modules.c:1086:26: warning: Result of 'malloc' is converted to a pointer of type 'uchar', which is incompatible with sizeof operand type 'char'
rsyslog-7.4.10/runtime/rsyslog.h:441:34: note: expanded from macro 'CHKmalloc'

Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/modules.c:1109:26: warning: Result of 'malloc' is converted to a pointer of type 'uchar', which is incompatible with sizeof operand type 'char'
rsyslog-7.4.10/runtime/rsyslog.h:441:34: note: expanded from macro 'CHKmalloc'
2014-07-22 16:15:06 +02:00
Tomas Heinrich
7528e7ac1c bugfix: prevent a potential memleak
Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/modules.c:394: alloc_fn: Storage is returned from allocation function "malloc(size_t)".
rsyslog-7.4.10/runtime/modules.c:394: var_assign: Assigning: "pNew" = storage returned from "malloc(32UL)".
rsyslog-7.4.10/runtime/modules.c:406: leaked_storage: Variable "pNew" going out of scope leaks the storage it points to.
2014-07-22 16:14:34 +02:00
Tomas Heinrich
85ba90da09 Prevent dereferencing a NULL pointer
Error: NULL_RETURNS (CWE-476):
rsyslog-7.4.10/runtime/debug.c:698: returned_null: Function "calloc(size_t, size_t)" returns null (checked 107 out of 123 times).
rsyslog-7.4.10/action.c:333: example_checked: Example 1: "calloc(1UL, 264UL)" has its value checked in "(pThis = (action_t *)calloc(1UL, 264UL)) == NULL".
rsyslog-7.4.10/grammar/rainerscript.c:932: example_checked: Example 2: "calloc(params->nParams, 24UL)" has its value checked in "(vals = calloc(params->nParams, 24UL)) == NULL".
rsyslog-7.4.10/outchannel.c:47: example_checked: Example 3: "calloc(1UL, 48UL)" has its value checked in "(pOch = calloc(1UL, 48UL)) == NULL".
rsyslog-7.4.10/parse.c:75: example_checked: Example 4: "calloc(1UL, 16UL)" has its value checked in "(pThis = (rsParsObj *)calloc(1UL, 16UL)) == NULL".
rsyslog-7.4.10/plugins/imfile/imfile.c:496: example_checked: Example 5: "calloc(1UL, 40UL)" has its value checked in "(pModConf = calloc(1UL, 40UL)) == NULL".
rsyslog-7.4.10/runtime/debug.c:698: var_assigned: Assigning: "pThrd" = null return value from "calloc(size_t, size_t)".
rsyslog-7.4.10/runtime/debug.c:699: dereference: Dereferencing a null pointer "pThrd".
2014-07-22 16:13:42 +02:00
Tomas Heinrich
b057301028 bugfix: check return value
Error: CLANG_WARNING:
rsyslog-7.4.10/runtime/cfsysline.c:918:2: warning: Value stored to 'iRet' is never read
2014-07-22 16:13:13 +02:00
Tomas Heinrich
ac18efa34e bugfix: don't leak memory when realloc() fails
Error: CPPCHECK_WARNING:
rsyslog-7.4.10/runtime/cfsysline.c:368: error[memleakOnRealloc]: Common realloc mistake: 'stringBuf' nulled but not freed upon failure
2014-07-22 16:12:27 +02:00
Tomas Heinrich
3cde17dbf0 Remove unused variable
Error: COMPILER_WARNING:
rsyslog-7.4.10/plugins/pmaixforwardedfrom/pmaixforwardedfrom.c: scope_hint: In function 'parse'
rsyslog-7.4.10/plugins/pmaixforwardedfrom/pmaixforwardedfrom.c:72: warning: unused variable 'opening'
2014-07-22 16:11:54 +02:00
Tomas Heinrich
fee75d299b bugfix: check return value of malloc()
Error: NULL_RETURNS (CWE-476):
rsyslog-7.4.10/plugins/omsnmp/omsnmp.c:264: returned_null: Function "malloc(size_t)" returns null (checked 140 out of 168 times).
rsyslog-7.4.10/action.c:1197: example_checked: Example 1: "malloc(batchNumMsgs(pBatch) * 1UL)" has its value checked in "(active = malloc(batchNumMsgs(pBatch) * 1UL)) == NULL".
rsyslog-7.4.10/grammar/lexer.l:302: example_checked: Example 2: "malloc(40UL)" has its value checked in "(bs = malloc(40UL)) == NULL".
rsyslog-7.4.10/grammar/rainerscript.c:2483: example_checked: Example 3: "malloc(8UL)" has its value checked in "(ar->arr = malloc(8UL)) == NULL".
rsyslog-7.4.10/plugins/imklog/bsd.c:221: example_checked: Example 4: "malloc(1UL * (iMaxLine + 1))" has its value checked in "(pRcv = (uchar *)malloc(1UL * (iMaxLine + 1))) == NULL".
rsyslog-7.4.10/plugins/imuxsock/imuxsock.c:968: example_checked: Example 5: "malloc(1UL * (iMaxLine + 1))" has its value checked in "(pRcv = (uchar *)malloc(1UL * (iMaxLine + 1))) == NULL".
rsyslog-7.4.10/plugins/omsnmp/omsnmp.c:264: var_assigned: Assigning: "pdu->enterprise" = null return value from "malloc(size_t)".
rsyslog-7.4.10/plugins/omsnmp/omsnmp.c:265: dereference: Dereferencing a pointer that might be null "pdu->enterprise" when calling "memcpy(void * restrict, void const * restrict, size_t)".
2014-07-22 16:11:35 +02:00
Tomas Heinrich
fb172d5ec0 Prevent passing null to putenv()
Replace putenv() with setenv() which handles memory allocation by itself.

Error: CLANG_WARNING:
rsyslog-7.4.10/plugins/omsnmp/omsnmp.c:206:2: warning: Null pointer passed as an argument to a 'nonnull' parameter
2014-07-22 16:11:03 +02:00
Tomas Heinrich
e5ef86334c Remove dead code
Error: DEADCODE (CWE-561):
rsyslog-7.4.10/plugins/ommail/ommail.c:143: cond_null: Condition "(pNew = calloc(1UL, 16UL)) == NULL", taking true branch. Now the value of "pNew" is NULL.
rsyslog-7.4.10/plugins/ommail/ommail.c:153: null: At condition "pNew != NULL", the value of "pNew" must be NULL.
rsyslog-7.4.10/plugins/ommail/ommail.c:153: dead_error_condition: The condition "pNew != NULL" cannot be true.
rsyslog-7.4.10/plugins/ommail/ommail.c:154: dead_error_line: Execution cannot reach this statement "free(pNew);".
2014-07-22 16:10:24 +02:00
Tomas Heinrich
2ccc99eee8 Don't assign unused value
Error: CLANG_WARNING:
rsyslog-7.4.10/plugins/omelasticsearch/omelasticsearch.c:368:14: warning: Value stored to 'r' is never read
2014-07-22 16:07:47 +02:00
Tomas Heinrich
ebaf66ded8 Don't assign unused value
Error: CLANG_WARNING:
rsyslog-7.4.10/plugins/omelasticsearch/omelasticsearch.c:208:13: warning: Value stored to 'r' is never read
2014-07-22 15:37:12 +02:00
Tomas Heinrich
866ef901d0 bugfix: plug a memleak in mmsnmptrapd
Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/plugins/mmsnmptrapd/mmsnmptrapd.c:292: alloc_fn: Storage is returned from allocation function "malloc(size_t)".
rsyslog-7.4.10/plugins/mmsnmptrapd/mmsnmptrapd.c:292: var_assign: Assigning: "node" = storage returned from "malloc(24UL)".
rsyslog-7.4.10/plugins/mmsnmptrapd/mmsnmptrapd.c:303: leaked_storage: Variable "node" going out of scope leaks the storage it points to.
2014-07-22 15:36:31 +02:00
Tomas Heinrich
c4c2e26bbe bugfix: correct array boundaries check
Error: OVERRUN (CWE-119):
rsyslog-7.4.10/plugins/mmcount/mmcount.c:264: cond_at_most: Checking "pMsg->iSeverity <= 8" implies that the value of "pMsg->iSeverity" may be up to 8 on the true branch.
rsyslog-7.4.10/plugins/mmcount/mmcount.c:265: overrun-local: Overrunning array "pData->severity" of 8 4-byte elements at element index 8 (byte offset 32) using index "pMsg->iSeverity" (which evaluates to 8).
2014-07-22 15:35:50 +02:00
Tomas Heinrich
7c3af2c243 Remove redundant return 2014-07-22 15:32:16 +02:00
Tomas Heinrich
314d44f985 bugfix: check return value of malloc()
Error: NULL_RETURNS (CWE-476):
rsyslog-7.4.10/plugins/imuxsock/imuxsock.c:1336: returned_null: Function "malloc(size_t)" returns null (checked 140 out of 168 times).
rsyslog-7.4.10/action.c:1197: example_checked: Example 1: "malloc(batchNumMsgs(pBatch) * 1UL)" has its value checked in "(active = malloc(batchNumMsgs(pBatch) * 1UL)) == NULL".
rsyslog-7.4.10/grammar/lexer.l:302: example_checked: Example 2: "malloc(40UL)" has its value checked in "(bs = malloc(40UL)) == NULL".
rsyslog-7.4.10/grammar/rainerscript.c:2483: example_checked: Example 3: "malloc(8UL)" has its value checked in "(ar->arr = malloc(8UL)) == NULL".
rsyslog-7.4.10/plugins/imklog/bsd.c:221: example_checked: Example 4: "malloc(1UL * (iMaxLine + 1))" has its value checked in "(pRcv = (uchar *)malloc(1UL * (iMaxLine + 1))) == NULL".
rsyslog-7.4.10/plugins/imuxsock/imuxsock.c:968: example_checked: Example 5: "malloc(1UL * (iMaxLine + 1))" has its value checked in "(pRcv = (uchar *)malloc(1UL * (iMaxLine + 1))) == NULL".
rsyslog-7.4.10/plugins/imuxsock/imuxsock.c:1336: var_assigned: Assigning: "pReadfds" = null return value from "malloc(size_t)".
rsyslog-7.4.10/plugins/imuxsock/imuxsock.c:1355: dereference: Dereferencing a pointer that might be null "pReadfds" when calling "memset(void *, int, size_t)".
2014-07-22 15:31:05 +02:00