LDRA Testbed Code Review Report

LDRA Testbed ® Code Review Report

# System : Dovecot-src-dns

Overall Result: FAIL

Report Production | Report Configuration | Analysis phases
--- | --- | ---
C/C++ LDRA Testbed Version: 8.3.0 Config. File: C:\Testbed\CCPP_830_Release\C\sate_creport.dat Produced On: Mon Aug 09 2010 at 17:10:13 Penalty File: C:\Testbed\CCPP_830_Release\c\cpen.dat | Report Level: Summary Report Procedures Reported: Fails Only Programming Standards Model: SATE 2010 L1 Plus Line Numbers refer to: Original Source File Violation Details: Violations Only Reporting Scope: Full analysis scope | Static: Yes Complexity: Yes Static Data Flow: Yes Information Flow: Yes Cross Reference: Yes

#### Contents

Overall Quality Summary

- Totals of Violations for each Standard
- Table of Procedure Results
- Table of Source Files in System
- Table of Global Basic Information

Report on Program Components

- Quality Results Global Program and Selected Procedures

## Overall Quality Summary

#### Totals for Violated Quality Standards

Number of Violations | LDRA Code | (M) Mandatory Standards | CERT Code
--- | --- | --- | ---
42 | 77 S | Macro replacement list needs parentheses. | CERT PRE02-C
27 | 78 S | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
1 | 577 S | Sizeof argument is a pointer. | CERT EXP01-C
2 | 5 D | Procedure contains UR data flow anomalies. | CERT EXP33-C
11 | 45 D | Pointer not checked for null before use | CERT EXP08-C,EXP34-C
3 | 69 D | Procedure contains UR data flow anomalies. | CERT EXP33-C
1 | 77 D | Local structure returned in function result |

Number of Violations | LDRA Code | (C) Checking (Mandatory) Standards | CERT Code
--- | --- | --- | ---
6 | 76 D | Procedure not called in code analysed |

Number of Violations | LDRA Code | (O) Optional Standards | CERT Code
--- | --- | --- | ---

No Optional Standards Violated

Number of Mandatory Standards checked | 27
Number of Checking Standards checked | 1
Number of Optional Standards checked | 3
Total Standards checked | 31

### OVERALL RESULT: FAIL

Out of 16 program components, 5 (31.25 %) pass ( of which 0 conditionally pass ) and 11 fail ( of which 0 fail only because of insufficient comments )

#### Procedure Results

`Quality Result` |  | `Procedure` |  | `Source File` |  | `Unique Violations` |  | `Failure Density` |
`` |  |  |  |  | `(Viols/R.Line %)` |
FAIL |  | Global Program |
Pass |  | buffer_get_data |  | buffer.h analysed in dns-client-settings.c |  | 0 |  | 0 |
Pass |  | buffer_get_used_size |  | buffer.h analysed in dns-client-settings.c |  | 0 |  | 0 |
FAIL |  | dns_client_input_line |  | dns-client.c |  | 14 | - |  | 4 | - |
FAIL |  | dns_client_input |  | dns-client.c |  | 7 | - |  | 3 | - |
FAIL |  | dns_client_timeout |  | dns-client.c |  | 7 | - |  | 20 | - |
FAIL |  | dns_client_create |  | dns-client.c |  | 14 | - |  | 17 | - |
Pass |  | dns_client_destroy |  | dns-client.c |  | 0 |  | 0 |
FAIL |  | client_connected |  | dns-client.c |  | 7 | - |  | 7 | - |
Pass |  | main |  | dns-client.c |  | 0 |  | 0 |
Pass |  | dns_lookup_input_line |  | dns-lookup.c |  | 0 |  | 0 |
FAIL |  | dns_lookup_save_msecs |  | dns-lookup.c |  | 14 | - |  | 12 | - |
FAIL |  | dns_lookup_input |  | dns-lookup.c |  | 7 | - |  | 1 | - |
FAIL |  | dns_lookup_timeout |  | dns-lookup.c |  | 7 | - |  | 14 | - |
FAIL |  | dns_lookup |  | dns-lookup.c |  | 14 | - |  | 12 | - |
FAIL |  | dns_lookup_free |  | dns-lookup.c |  | 7 | - |  | 13 | - |

#### Global Information

#### Source Files in System

Name | Last Modification Date
--- | ---
C:\Code\SAMATE\SATE2010\dovecot-2.0.beta6.20100626\dovecot-2.0.beta6\src\lib-dns\dns-lookup.c | Fri Mar 26 07:16:36 2010
C:\Code\SAMATE\SATE2010\dovecot-2.0.beta6.20100626\dovecot-2.0.beta6\src\dns\dns-client.c | Thu May 27 19:00:08 2010
C:\Code\SAMATE\SATE2010\dovecot-2.0.beta6.20100626\dovecot-2.0.beta6\src\dns\dns-client-settings.c | Fri Jun 25 08:22:16 2010

#### Global Basic Information

Number of procedures: | 15
Number of locally uncalled procedures: | 0
Maximum loop depth: | 1
Total Cyclomatic Complexity: | 41
Number of reformatted executable lines: | 432
Number of lines of comments: | 2072

## Summary Report on all Program Components which FAIL

Globals / code outside procedures - FAIL

#### Standards Violation Summary - All files

Code | File: Src Line | Violation | Standard
--- | --- | --- | ---
M | compat.h: 214 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 215 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 216 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 217 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 218 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 219 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 220 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 221 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 222 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 223 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 224 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 225 | Macro replacement list needs parentheses. | CERT PRE02-C
M | compat.h: 226 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 196 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 197 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 204 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | macros.h: 204 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 205 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | macros.h: 205 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 223 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | macros.h: 223 | Macro replacement list needs parentheses. | CERT PRE02-C
M | macros.h: 232 | Macro replacement list needs parentheses. | CERT PRE02-C
M | data-stack.h: 49 | Macro replacement list needs parentheses. | CERT PRE02-C
M | data-stack.h: 51 | Macro replacement list needs parentheses. | CERT PRE02-C
M | data-stack.h: 75 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | data-stack.h: 85 | Macro replacement list needs parentheses. | CERT PRE02-C
M | data-stack.h: 90 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | data-stack.h: 90 | Macro replacement list needs parentheses. | CERT PRE02-C
M | data-stack.h: 97 | Macro replacement list needs parentheses. | CERT PRE02-C
M | mempool.h: 84 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | mempool.h: 87 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | mempool.h: 88 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | mempool.h: 99 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | mempool.h: 99 | Macro replacement list needs parentheses. | CERT PRE02-C
M | mempool.h: 102 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | mempool.h: 102 | Macro replacement list needs parentheses. | CERT PRE02-C
M | imem.h: 8 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | imem.h: 8 | Macro replacement list needs parentheses. | CERT PRE02-C
M | imem.h: 14 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | imem.h: 14 | Macro replacement list needs parentheses. | CERT PRE02-C
M | imem.h: 15 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | imem.h: 15 | Macro replacement list needs parentheses. | CERT PRE02-C
M | array-decl.h: 4 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | array-decl.h: 4 | Macro replacement list needs parentheses. | CERT PRE02-C
M | array-decl.h: 7 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | array-decl.h: 7 | Macro replacement list needs parentheses. | CERT PRE02-C
M | array-decl.h: 9 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | array-decl.h: 9 | Macro replacement list needs parentheses. | CERT PRE02-C
M | settings-parser.h: 46 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | settings-parser.h: 46 | Macro replacement list needs parentheses. | CERT PRE02-C

Code | File: Src Line | Violation | Standard
--- | --- | --- | ---
M | settings-parser.h: 50 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | settings-parser.h: 50 | Macro replacement list needs parentheses. | CERT PRE02-C
M | settings-parser.h: 54 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | settings-parser.h: 54 | Macro replacement list needs parentheses. | CERT PRE02-C
M | settings-parser.h: 58 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | settings-parser.h: 58 | Macro replacement list needs parentheses. | CERT PRE02-C
M | settings-parser.h: 62 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | settings-parser.h: 62 | Macro replacement list needs parentheses. | CERT PRE02-C
M | dns-client-settings.c: 19 | Sizeof argument is a pointer. | CERT EXP01-C
M | ioloop.h: 50 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | ioloop.h: 50 | Macro replacement list needs parentheses. | CERT PRE02-C
M | ioloop.h: 56 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | ioloop.h: 75 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | ioloop.h: 75 | Macro replacement list needs parentheses. | CERT PRE02-C
M | istream.h: 53 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | istream.h: 53 | Macro replacement list needs parentheses. | CERT PRE02-C
M | ostream.h: 61 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | ostream.h: 61 | Macro replacement list needs parentheses. | CERT PRE02-C
M | dns-lookup.h: 27 | Macro parameter not in brackets. | CERT PRE01-C,PRE02-C
M | dns-lookup.h: 27 | Macro replacement list needs parentheses. | CERT PRE02-C

[ | Top of Report | | | Procedure Table | | | Contents | ]

dns_client_input_line (28 to 60 dns-client.c) - FAIL

#### Standards Violation Summary

Code | Violation | Standard
--- | --- | ---
M | Procedure contains UR data flow anomalies. | CERT EXP33-C

Code | Line | Violation | Standard
--- | --- | --- | ---
M | 30 | Procedure contains UR data flow anomalies. : ips | CERT EXP33-C
| 35 |  |
M | 31 | Procedure contains UR data flow anomalies. : ips_count | CERT EXP33-C
| 35 |  |

#### Possible UR Anomalies

The following variables may be referenced before being given a value

File | Undefine | File | Reference | Variable
--- | --- | --- | --- | ---
dns-client.c | 30 | dns-client.c | 35 | ips
dns-client.c | 31 | dns-client.c | 35 | ips_count

[ | Top of Report | | | Procedure Table | | | Contents | ]

dns_client_input (62 to 79 dns-client.c) - FAIL

#### Standards Violation Summary

Code | Line | Violation | Standard
--- | --- | --- | ---
C | 62 | Procedure not called in code analysed : dns_client_input |

[ | Top of Report | | | Procedure Table | | | Contents | ]

dns_client_timeout (81 to 84 dns-client.c) - FAIL

#### Standards Violation Summary

Code | Line | Violation | Standard
--- | --- | --- | ---
C | 81 | Procedure not called in code analysed : dns_client_timeout |

[ | Top of Report | | | Procedure Table | | | Contents | ]

dns_client_create (86 to 98 dns-client.c) - FAIL

#### Standards Violation Summary

Code | Line | Violation | Standard
--- | --- | --- | ---
M | 97 | Local structure returned in function result : client |
M | 91 | Pointer not checked for null before use : client | CERT EXP08-C,EXP34-C
| 90 |  |

[ | Top of Report | | | Procedure Table | | | Contents | ]

client_connected (118 to 127 dns-client.c) - FAIL

#### Standards Violation Summary

Code | Line | Violation | Standard
--- | --- | --- | ---
C | 118 | Procedure not called in code analysed : client_connected |

[ | Top of Report | | | Procedure Table | | | Contents | ]

dns_lookup_save_msecs (66 to 77 dns-lookup.c) - FAIL

#### Standards Violation Summary

Code | Violation | Standard
--- | --- | ---
M | Procedure contains UR data flow anomalies. | CERT EXP33-C

Code | Line | Violation | Standard
--- | --- | --- | ---
M | 68 | Procedure contains UR data flow anomalies. : now | CERT EXP33-C
| 71 |  |

#### Possible UR Anomalies

The following variables may be referenced before being given a value

File | Undefine | File | Reference | Variable
--- | --- | --- | --- | ---
dns-lookup.c | 68 | dns-lookup.c | 71 | now

[ | Top of Report | | | Procedure Table | | | Contents | ]

dns_lookup_input (79 to 112 dns-lookup.c) - FAIL

#### Standards Violation Summary

Code | Line | Violation | Standard
--- | --- | --- | ---
C | 79 | Procedure not called in code analysed : dns_lookup_input |

[ | Top of Report | | | Procedure Table | | | Contents | ]

dns_lookup_timeout (114 to 120 dns-lookup.c) - FAIL

#### Standards Violation Summary

Code | Line | Violation | Standard
--- | --- | --- | ---
C | 114 | Procedure not called in code analysed : dns_lookup_timeout |

[ | Top of Report | | | Procedure Table | | | Contents | ]

dns_lookup (123 to 166 dns-lookup.c) - FAIL

#### Standards Violation Summary

Code | Line | Violation | Standard
--- | --- | --- | ---
M | 138 | Pointer not checked for null before use : result.error | CERT EXP08-C,EXP34-C
| 136 |  |
M | 143 | Pointer not checked for null before use : cmd | CERT EXP08-C,EXP34-C
| 142 |  |
M | 147 | Pointer not checked for null before use : result.error | CERT EXP08-C,EXP34-C
| 144 |  |
M | 152 | Pointer not checked for null before use : lookup | CERT EXP08-C,EXP34-C
| 151 |  |
M | 138 | Pointer not checked for null before use : result.ips | CERT EXP08-C,EXP34-C
| 131 |  |
M | 147 | Pointer not checked for null before use : result.ips | CERT EXP08-C,EXP34-C
| 131 |  |
C | 123 | Procedure not called in code analysed : dns_lookup |

[ | Top of Report | | | Procedure Table | | | Contents | ]

dns_lookup_free (168 to 184 dns-lookup.c) - FAIL

#### Standards Violation Summary

Code | Line | Violation | Standard
--- | --- | --- | ---
M | 182 | Pointer not checked for null before use : default_pool | CERT EXP08-C,EXP34-C
| 181 |  |
M | 183 | Pointer not checked for null before use : default_pool | CERT EXP08-C,EXP34-C
| 182 |  |
M | 183 | Pointer not checked for null before use : (lookup)->path | CERT EXP08-C,EXP34-C
| 182 |  |
M | 183 | Pointer not checked for null before use : (lookup)->ips | CERT EXP08-C,EXP34-C
| 181 |  |

[ | Top of Report | | | Procedure Table | | | Contents | ]

### End of Code Review Report

###

### Copyright © 2010 Liverpool Data Research Associates