1*2d543d20SAndroid Build Coastguard Worker /****************************************************************************** 2*2d543d20SAndroid Build Coastguard Worker * 3*2d543d20SAndroid Build Coastguard Worker * Copyright (C) 2020 The Android Open Source Project 4*2d543d20SAndroid Build Coastguard Worker * 5*2d543d20SAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 6*2d543d20SAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 7*2d543d20SAndroid Build Coastguard Worker * You may obtain a copy of the License at: 8*2d543d20SAndroid Build Coastguard Worker * 9*2d543d20SAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 10*2d543d20SAndroid Build Coastguard Worker * 11*2d543d20SAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 12*2d543d20SAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 13*2d543d20SAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14*2d543d20SAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 15*2d543d20SAndroid Build Coastguard Worker * limitations under the License. 16*2d543d20SAndroid Build Coastguard Worker * 17*2d543d20SAndroid Build Coastguard Worker ***************************************************************************** 18*2d543d20SAndroid Build Coastguard Worker */ 19*2d543d20SAndroid Build Coastguard Worker 20*2d543d20SAndroid Build Coastguard Worker #include <fuzzer/FuzzedDataProvider.h> 21*2d543d20SAndroid Build Coastguard Worker #include <selinux/selinux.h> 22*2d543d20SAndroid Build Coastguard Worker #include <string> 23*2d543d20SAndroid Build Coastguard Worker LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)24*2d543d20SAndroid Build Coastguard Workerextern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { 25*2d543d20SAndroid Build Coastguard Worker FuzzedDataProvider fdp(data, size); 26*2d543d20SAndroid Build Coastguard Worker 27*2d543d20SAndroid Build Coastguard Worker std::string path = fdp.ConsumeRandomLengthString(); 28*2d543d20SAndroid Build Coastguard Worker std::string con = fdp.ConsumeRemainingBytesAsString(); 29*2d543d20SAndroid Build Coastguard Worker 30*2d543d20SAndroid Build Coastguard Worker setfilecon(path.c_str(), con.c_str()); 31*2d543d20SAndroid Build Coastguard Worker 32*2d543d20SAndroid Build Coastguard Worker return 0; 33*2d543d20SAndroid Build Coastguard Worker } 34