/src/httrack/fuzz/fuzz-url.c
Line | Count | Source |
1 | | /* ------------------------------------------------------------ */ |
2 | | /* |
3 | | HTTrack Website Copier, Offline Browser for Windows and Unix |
4 | | Copyright (C) 1998 Xavier Roche and other contributors |
5 | | |
6 | | SPDX-License-Identifier: GPL-3.0-or-later |
7 | | |
8 | | This program is free software: you can redistribute it and/or modify |
9 | | it under the terms of the GNU General Public License as published by |
10 | | the Free Software Foundation, either version 3 of the License, or |
11 | | (at your option) any later version. |
12 | | |
13 | | This program is distributed in the hope that it will be useful, |
14 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | | GNU General Public License for more details. |
17 | | |
18 | | You should have received a copy of the GNU General Public License |
19 | | along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | | |
21 | | Ethical use: we kindly ask that you NOT use this software to harvest email |
22 | | addresses or to collect any other private information about people. Doing so |
23 | | would dishonor our work and waste the many hours we have spent on it. |
24 | | |
25 | | Please visit our Website: http://www.httrack.com |
26 | | */ |
27 | | |
28 | | /* Fuzz the URL splitter and path normalizer (htslib.c): ident_url_absolute |
29 | | is the first parser to touch a raw URL; fil_simplifie collapses ./ and ../ |
30 | | in place. */ |
31 | | #include "fuzz.h" |
32 | | #include "htscore.h" |
33 | | #include "htslib.h" |
34 | | |
35 | 2.57k | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { |
36 | 2.57k | char *s = fuzz_strdup(data, size); |
37 | 2.57k | lien_adrfil *af = calloct(1, sizeof(*af)); |
38 | | /* fil_simplifie rewrites in place and may grow an empty path to "./" */ |
39 | 2.57k | char *path = malloct(size + 3); |
40 | | |
41 | 2.57k | (void) ident_url_absolute(s, af); |
42 | 2.57k | memcpy(path, s, size + 1); |
43 | 2.57k | fil_simplifie(path); |
44 | | |
45 | 2.57k | freet(path); |
46 | 2.57k | freet(af); |
47 | | freet(s); |
48 | 2.57k | return 0; |
49 | 2.57k | } |