1 /* Copyright 2021 Google LLC
2 Licensed under the Apache License, Version 2.0 (the "License");
3 you may not use this file except in compliance with the License.
4 You may obtain a copy of the License at
5 http://www.apache.org/licenses/LICENSE-2.0
6 Unless required by applicable law or agreed to in writing, software
7 distributed under the License is distributed on an "AS IS" BASIS,
8 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 See the License for the specific language governing permissions and
10 limitations under the License.
11 */
12 #include <stddef.h>
13 #include <stdint.h>
14 #include <stdlib.h>
15
16 #include "apr_strings.h"
17
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)18 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
19 apr_pool_t *pool;
20 apr_pool_initialize();
21 if (apr_pool_create(&pool, NULL) != APR_SUCCESS) {
22 abort();
23 }
24
25 char *arg_str = strndup((const char *)data, size);
26 char **argv_out;
27 apr_tokenize_to_argv(arg_str, &argv_out, pool);
28
29 free(arg_str);
30 apr_pool_destroy(pool);
31 apr_terminate();
32
33 return 0;
34 }
35