102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
core.c
Go to the documentation of this file.
1
#include <
dttr_path.h
>
2
#include <
dttr_test_support.h
>
3
4
static
void
safe_relative_rejects_absolute_and_traversal_paths
(
void
**
state
) {
5
assert_true(
DTTR_Path_IsSafeRelative
(
"data/save.dat"
));
6
assert_true(
DTTR_Path_IsSafeRelative
(
"data\\save.dat"
));
7
assert_false(
DTTR_Path_IsSafeRelative
(
NULL
));
8
assert_false(
DTTR_Path_IsSafeRelative
(
""
));
9
assert_false(
DTTR_Path_IsSafeRelative
(
"/data/save.dat"
));
10
assert_false(
DTTR_Path_IsSafeRelative
(
"\\data\\save.dat"
));
11
assert_false(
DTTR_Path_IsSafeRelative
(
"C:\\data\\save.dat"
));
12
assert_false(
DTTR_Path_IsSafeRelative
(
"C:data\\save.dat"
));
13
assert_false(
DTTR_Path_IsSafeRelative
(
"data/../save.dat"
));
14
assert_false(
DTTR_Path_IsSafeRelative
(
"./save.dat"
));
15
}
16
17
static
const
DTTR_TestCase
TEST_CASES
[] = {
18
{
"safe-relative-rejects-absolute-and-traversal-paths"
,
19
safe_relative_rejects_absolute_and_traversal_paths
},
20
};
21
22
DTTR_TEST_MAIN
(
TEST_CASES
)
state
const DTTR_BackendState * state
Definition
com_direct3ddevice7.c:749
NULL
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void NULL
Definition
com_directdrawsurface7.c:1315
safe_relative_rejects_absolute_and_traversal_paths
static void safe_relative_rejects_absolute_and_traversal_paths(void **state)
Definition
core.c:4
TEST_CASES
static const DTTR_TestCase TEST_CASES[]
Definition
core.c:17
dttr_path.h
DTTR_Path_IsSafeRelative
bool DTTR_Path_IsSafeRelative(const char *path)
Definition
path.c:107
dttr_test_support.h
DTTR_TEST_MAIN
#define DTTR_TEST_MAIN(TESTS)
Definition
dttr_test_support.h:21
DTTR_TestCase
Definition
dttr_test_support.h:15
modules
common
tests
src
core.c
Generated by
1.16.1