summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorThomas Markwalder <tmark@isc.org>2014-08-28 07:56:20 -0400
committerThomas Markwalder <tmark@isc.org>2014-08-28 08:12:30 -0400
commita07d99bbefd67a238b66341f84c6c63f7f35540e (patch)
tree07bb7bcc8187364b785423822ddcd8dde667319c /common
parent36e2c22493c0f2357aec2ccf4ed37c2eb676bc56 (diff)
downloadisc-dhcp-a07d99bbefd67a238b66341f84c6c63f7f35540e.tar.gz
[master] Corrects medium impact issues reported by Coverity.
Merges in rt36933
Diffstat (limited to 'common')
-rw-r--r--common/options.c18
-rw-r--r--common/parse.c8
2 files changed, 18 insertions, 8 deletions
diff --git a/common/options.c b/common/options.c
index 374cb573..dc96d827 100644
--- a/common/options.c
+++ b/common/options.c
@@ -1849,6 +1849,15 @@ const char *pretty_print_option (option, data, len, emit_commas, emit_quotes)
* of the last format type and we add 1 to
* cover the entire first record.
*/
+
+ /* If format string had no valid entries prior to
+ * 'a' hunkinc will be 0. Ex: "a", "oa", "aA" */
+ if (hunkinc == 0) {
+ log_error ("%s: invalid 'a' format: %s",
+ option->name, option->format);
+ return ("<error>");
+ }
+
numhunk = ((len - hunksize) / hunkinc) + 1;
len_used = hunksize + ((numhunk - 1) * hunkinc);
} else {
@@ -1856,6 +1865,15 @@ const char *pretty_print_option (option, data, len, emit_commas, emit_quotes)
* It is an 'A' type array - we repeat the
* entire record
*/
+
+ /* If format string had no valid entries prior to
+ * 'A' hunksize will be 0. Ex: "A", "oA", "foA" */
+ if (hunksize == 0) {
+ log_error ("%s: invalid 'A' format: %s",
+ option->name, option->format);
+ return ("<error>");
+ }
+
numhunk = len / hunksize;
len_used = numhunk * hunksize;
}
diff --git a/common/parse.c b/common/parse.c
index 2e363c2c..65e0b314 100644
--- a/common/parse.c
+++ b/common/parse.c
@@ -4732,14 +4732,6 @@ int parse_expression (expr, cfile, lose, context, plhs, binop)
tmp = (struct expression *)0;
rhs = (struct expression *)0;
- /* Recursions don't return until we have parsed the end of the
- expression, so if we recursed earlier, we can now return what
- we got. */
- if (next_op == expr_none) {
- *expr = lhs;
- return 1;
- }
-
binop = next_op;
goto new_rhs;
}