]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/fuzz/fuzz-udev-rule-parse-value.c
f1d36669c45564db65e4c9b187a20103b327a407
1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 #include "alloc-util.h"
9 int LLVMFuzzerTestOneInput(const uint8_t *data
, size_t size
) {
10 _cleanup_free_
char *str
= NULL
;
12 char *value
= UINT_TO_PTR(0x12345678U
);
13 char *endpos
= UINT_TO_PTR(0x87654321U
);
15 assert_se(str
= malloc(size
+ 1));
16 memcpy(str
, data
, size
);
19 r
= udev_rule_parse_value(str
, &value
, &endpos
);
22 /* not modified on failure */
23 assert_se(value
== UINT_TO_PTR(0x12345678U
));
24 assert_se(endpos
== UINT_TO_PTR(0x87654321U
));
26 assert_se(endpos
<= str
+ size
);
27 assert_se(endpos
> str
+ 1);