Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
radsecproxy
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
0
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security
Insights
Files
964038e
packaging
tests
Makefile.am
t_fticks.c
t_resizeattr.c
t_rewrite.c
t_rewrite_config.c
tools
.gitignore
AUTHORS
ChangeLog
INSTALL
LICENSE
Makefile.am
NEWS
README
THANKS
acinclude.m4
autogen.sh
catgconf.c
configure.ac
debug.c
debug.h
develdoc.txt
dtls.c
dtls.h
fticks.c
fticks.h
fticks_hashmac.c
fticks_hashmac.h
gconfig.c
gconfig.h
hash.c
hash.h
hostport.c
hostport.h
list.c
list.h
main.c
radmsg.c
radmsg.h
radsecproxy-hash.1
radsecproxy-hash.c
radsecproxy.1
radsecproxy.c
radsecproxy.conf-example
radsecproxy.conf.5
radsecproxy.h
rewrite.c
rewrite.h
tcp.c
tcp.h
tls.c
tls.h
tlscommon.c
tlscommon.h
tlv11.c
tlv11.h
udp.c
udp.h
util.c
util.h
Breadcrumbs
radsecproxy
/
tests
/
t_resizeattr.c
Blame
Blame
Latest commit
History
History
60 lines (47 loc) · 1.43 KB
Breadcrumbs
radsecproxy
/
tests
/
t_resizeattr.c
Top
File metadata and controls
Code
Blame
60 lines (47 loc) · 1.43 KB
Raw
/* Copyright (C) 2019, SWITCH */ /* See LICENSE for licensing information. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "../rewrite.h" int test_resize(int start_size, int target_size, uint8_t shouldfail) { uint8_t *value = malloc(start_size); struct tlv *attr; int result = 1; memset(value, 42, start_size); attr = maketlv(1,start_size,value); if (!resizeattr(attr, target_size)) result = shouldfail; else if (shouldfail) result = 0; else if (attr->l != target_size) result = 0; else if (memcmp(attr->v, value, target_size <= start_size ? target_size : start_size)) result = 0; freetlv(attr); free(value); return result; } int main (int argc, char *argv[]) { int testcount = 4; printf("1..%d\n", testcount); testcount = 1; /* test resizeattr normal */ if (!test_resize(4, 8, 0)) printf("not "); printf("ok %d - resizeattr\n", testcount++); /* test resizeattr to 0 */ if (!test_resize(4, 0, 0)) printf ("not "); printf("ok %d - resizeattr to zero\n", testcount++); /* test resizeattr to max size */ if (!test_resize(128, 253, 0)) printf ("not "); printf("ok %d - resizeattr to max size\n", testcount++); /* test resizeattr to oversize */ if (!test_resize(128, 254, 1)) printf ("not "); printf("ok %d - resizeattr to oversize\n", testcount++); return 0; }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
You can’t perform that action at this time.