a25d9104ef
Function cil_add_file() copies its input into a newly-allocated buffer, and does not modify "name". State these properties in the types of parameters by adding "const" qualifiers. This enables using LibFuzzer directly on cil_add_file(), without a warning about discarding "const" qualifier: fuzz-secilc.c: In function ‘LLVMFuzzerTestOneInput’: fuzz-secilc.c:57:31: warning: passing argument 3 of ‘cil_add_file’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 57 | if (cil_add_file(db, "fuzz", data, size) != SEPOL_OK) | ^~~~ In file included from fuzz-secilc.c:26: /usr/include/sepol/cil/cil.h:45:57: note: expected ‘char *’ but argument is of type ‘const uint8_t *’ {aka ‘const unsigned char *’} 45 | extern int cil_add_file(cil_db_t *db, char *name, char *data, size_t size); | ~~~~~~^~~~ Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org> |
||
---|---|---|
.. | ||
cil.h |