2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-31 06:15:55 +00:00

[master] Corrects medium impact issues reported by Coverity.

Merges in rt36933
This commit is contained in:
Thomas Markwalder
2014-08-28 07:56:20 -04:00
parent 36e2c22493
commit a07d99bbef
13 changed files with 70 additions and 42 deletions

View File

@@ -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;
}