Skip to content

Commit

Permalink
strchr and friends
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-schwarz committed Oct 1, 2023
1 parent f41d294 commit 7db9d70
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/analyses/libraryFunctions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ let c_descs_list: (string * LibraryDesc.t) list = LibraryDsl.[
("strtok", unknown ~attrs:[ThreadUnsafe] [drop "str" [r; w]; drop "delim" [r]]);
("__builtin_strcmp", special [__ "s1" [r]; __ "s2" [r]] @@ fun s1 s2 -> Strcmp { s1; s2; n = None; });
("strncmp", special [__ "s1" [r]; __ "s2" [r]; __ "n" []] @@ fun s1 s2 n -> Strcmp { s1; s2; n = Some n; });
("strchr", unknown [drop "s" [r]; drop "c" []]);
("strrchr", unknown [drop "s" [r]; drop "c" []]);
("malloc", special [__ "size" []] @@ fun size -> Malloc size);
("calloc", special [__ "n" []; __ "size" []] @@ fun n size -> Calloc {count = n; size});
("realloc", special [__ "ptr" [r; f]; __ "size" []] @@ fun ptr size -> Realloc { ptr; size });
Expand Down Expand Up @@ -497,6 +499,7 @@ let glibc_desc_list: (string * LibraryDesc.t) list = LibraryDsl.[
("getifaddrs", unknown [drop "ifap" [w]]);
("freeifaddrs", unknown [drop "ifa" [f_deep]]);
("atoq", unknown [drop "nptr" [r]]);
("strchrnul", unknown [drop "s" [r]; drop "c" []]);
]

let linux_userspace_descs_list: (string * LibraryDesc.t) list = LibraryDsl.[
Expand Down Expand Up @@ -1115,7 +1118,6 @@ let invalidate_actions = [
"__builtin___vsnprintf", writesAllButFirst 3 readsAll; (*drop 3*)
"__builtin___vsnprintf_chk", writesAllButFirst 3 readsAll; (*drop 3*)
"strcasecmp", readsAll; (*safe*)
"strchr", readsAll; (*safe*)
"__error", readsAll; (*safe*)
"__maskrune", writesAll; (*unsafe*)
"inet_addr", readsAll; (*safe*)
Expand Down

0 comments on commit 7db9d70

Please sign in to comment.