Lutz Justen | 70496c1 | 2019-07-24 11:11:55 +0200 | [diff] [blame] | 1 | // Copyright 2019 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Felipe Andrade | a0cbde7 | 2020-04-01 15:40:10 +0200 | [diff] [blame] | 5 | #include "kerberos/config_parser.h" |
Manoj Gupta | fc4482c | 2019-09-20 13:43:02 -0700 | [diff] [blame] | 6 | #include "kerberos/krb5_interface_impl.h" |
Lutz Justen | 70496c1 | 2019-07-24 11:11:55 +0200 | [diff] [blame] | 7 | |
| 8 | #include <stddef.h> |
| 9 | #include <stdint.h> |
Manoj Gupta | fc4482c | 2019-09-20 13:43:02 -0700 | [diff] [blame] | 10 | #include <fuzzer/FuzzedDataProvider.h> |
Lutz Justen | 70496c1 | 2019-07-24 11:11:55 +0200 | [diff] [blame] | 11 | |
| 12 | #include "base/logging.h" |
Lutz Justen | 70496c1 | 2019-07-24 11:11:55 +0200 | [diff] [blame] | 13 | |
| 14 | struct Environment { |
hscham | e671130 | 2020-11-20 17:08:14 +0900 | [diff] [blame^] | 15 | Environment() { logging::SetMinLogLevel(logging::LOGGING_FATAL); } |
Lutz Justen | 70496c1 | 2019-07-24 11:11:55 +0200 | [diff] [blame] | 16 | }; |
| 17 | |
| 18 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| 19 | static Environment env; |
| 20 | const std::string krb5conf(reinterpret_cast<const char*>(data), size); |
| 21 | |
Felipe Andrade | a0cbde7 | 2020-04-01 15:40:10 +0200 | [diff] [blame] | 22 | // Note: Krb5InterfaceImpl owns and calls a ConfigParser, but it also runs |
Lutz Justen | 70496c1 | 2019-07-24 11:11:55 +0200 | [diff] [blame] | 23 | // the MIT krb5 parsing code, so we use that. |
| 24 | kerberos::Krb5InterfaceImpl krb5; |
| 25 | |
| 26 | kerberos::ConfigErrorInfo error_info; |
| 27 | krb5.ValidateConfig(krb5conf, &error_info); |
| 28 | |
| 29 | return 0; |
| 30 | } |