Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/x509/x509_obj.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) | - | ||||||||||||||||||||||||
3 | { | - | ||||||||||||||||||||||||
4 | const X509_NAME_ENTRY *ne; | - | ||||||||||||||||||||||||
5 | int i; | - | ||||||||||||||||||||||||
6 | int n, lold, l, l1, l2, num, j, type; | - | ||||||||||||||||||||||||
7 | const char *s; | - | ||||||||||||||||||||||||
8 | char *p; | - | ||||||||||||||||||||||||
9 | unsigned char *q; | - | ||||||||||||||||||||||||
10 | BUF_MEM *b = | - | ||||||||||||||||||||||||
11 | ((void *)0) | - | ||||||||||||||||||||||||
12 | ; | - | ||||||||||||||||||||||||
13 | static const char hex[17] = "0123456789ABCDEF"; | - | ||||||||||||||||||||||||
14 | int gs_doit[4]; | - | ||||||||||||||||||||||||
15 | char tmp_buf[80]; | - | ||||||||||||||||||||||||
16 | - | |||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||
18 | - | |||||||||||||||||||||||||
19 | - | |||||||||||||||||||||||||
20 | if (buf ==
| 471-5798 | ||||||||||||||||||||||||
21 | ((void *)0)
| 471-5798 | ||||||||||||||||||||||||
22 | ) { | - | ||||||||||||||||||||||||
23 | if ((
| 0-5798 | ||||||||||||||||||||||||
24 | ((void *)0)
| 0-5798 | ||||||||||||||||||||||||
25 | ) | - | ||||||||||||||||||||||||
26 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
27 | if (!BUF_MEM_grow(b, 200)
| 0-5798 | ||||||||||||||||||||||||
28 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
29 | b->data[0] = '\0'; | - | ||||||||||||||||||||||||
30 | len = 200; | - | ||||||||||||||||||||||||
31 | } executed 5798 times by 1 test: else if (len == 0end of block Executed by:
| 0-5798 | ||||||||||||||||||||||||
32 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
33 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
34 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
35 | } | - | ||||||||||||||||||||||||
36 | if (a ==
| 0-6269 | ||||||||||||||||||||||||
37 | ((void *)0)
| 0-6269 | ||||||||||||||||||||||||
38 | ) { | - | ||||||||||||||||||||||||
39 | if (b
| 0 | ||||||||||||||||||||||||
40 | buf = b->data; | - | ||||||||||||||||||||||||
41 | CRYPTO_free(b, __FILE__, 53); | - | ||||||||||||||||||||||||
42 | } never executed: end of block | 0 | ||||||||||||||||||||||||
43 | - | |||||||||||||||||||||||||
44 | __builtin_strncpy ( | - | ||||||||||||||||||||||||
45 | buf | - | ||||||||||||||||||||||||
46 | , | - | ||||||||||||||||||||||||
47 | "NO X509_NAME" | - | ||||||||||||||||||||||||
48 | , | - | ||||||||||||||||||||||||
49 | len | - | ||||||||||||||||||||||||
50 | ) | - | ||||||||||||||||||||||||
51 | ; | - | ||||||||||||||||||||||||
52 | buf[len - 1] = '\0'; | - | ||||||||||||||||||||||||
53 | return never executed: buf;return buf; never executed: return buf; | 0 | ||||||||||||||||||||||||
54 | } | - | ||||||||||||||||||||||||
55 | - | |||||||||||||||||||||||||
56 | len--; | - | ||||||||||||||||||||||||
57 | l = 0; | - | ||||||||||||||||||||||||
58 | for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries)
| 6266-13855 | ||||||||||||||||||||||||
59 | ne = sk_X509_NAME_ENTRY_value(a->entries, i); | - | ||||||||||||||||||||||||
60 | n = OBJ_obj2nid(ne->object); | - | ||||||||||||||||||||||||
61 | if ((
| 0-8779 | ||||||||||||||||||||||||
62 | ((void *)0)
| 0-5076 | ||||||||||||||||||||||||
63 | )
| 0-5076 | ||||||||||||||||||||||||
64 | i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); | - | ||||||||||||||||||||||||
65 | s = tmp_buf; | - | ||||||||||||||||||||||||
66 | } executed 8779 times by 1 test: end of block Executed by:
| 8779 | ||||||||||||||||||||||||
67 | l1 = strlen(s); | - | ||||||||||||||||||||||||
68 | - | |||||||||||||||||||||||||
69 | type = ne->value->type; | - | ||||||||||||||||||||||||
70 | num = ne->value->length; | - | ||||||||||||||||||||||||
71 | if (num > (1024 * 1024)
| 0-13855 | ||||||||||||||||||||||||
72 | ERR_put_error(11,(116),(134),__FILE__,74); | - | ||||||||||||||||||||||||
73 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
74 | } | - | ||||||||||||||||||||||||
75 | q = ne->value->data; | - | ||||||||||||||||||||||||
76 | if ((
| 0-13855 | ||||||||||||||||||||||||
77 | gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; | - | ||||||||||||||||||||||||
78 | for (j = 0; j < num
| 0 | ||||||||||||||||||||||||
79 | if (q[j] != 0
| 0 | ||||||||||||||||||||||||
80 | gs_doit[j & 3] = 1; never executed: gs_doit[j & 3] = 1; | 0 | ||||||||||||||||||||||||
81 | - | |||||||||||||||||||||||||
82 | if (gs_doit[0] | gs_doit[1] | gs_doit[2]
| 0 | ||||||||||||||||||||||||
83 | gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; never executed: gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; | 0 | ||||||||||||||||||||||||
84 | else { | - | ||||||||||||||||||||||||
85 | gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; | - | ||||||||||||||||||||||||
86 | gs_doit[3] = 1; | - | ||||||||||||||||||||||||
87 | } never executed: end of block | 0 | ||||||||||||||||||||||||
88 | } else | - | ||||||||||||||||||||||||
89 | gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; executed 13855 times by 1 test: gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; Executed by:
| 13855 | ||||||||||||||||||||||||
90 | - | |||||||||||||||||||||||||
91 | for (l2 = j = 0; j < num
| 13855-81218 | ||||||||||||||||||||||||
92 | if (!gs_doit[j & 3]
| 0-81218 | ||||||||||||||||||||||||
93 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
94 | l2++; | - | ||||||||||||||||||||||||
95 | - | |||||||||||||||||||||||||
96 | if ((
| 8900-72318 | ||||||||||||||||||||||||
97 | l2 += 3; executed 22185 times by 1 test: l2 += 3; Executed by:
| 22185 | ||||||||||||||||||||||||
98 | - | |||||||||||||||||||||||||
99 | - | |||||||||||||||||||||||||
100 | - | |||||||||||||||||||||||||
101 | - | |||||||||||||||||||||||||
102 | - | |||||||||||||||||||||||||
103 | } executed 81218 times by 1 test: end of block Executed by:
| 81218 | ||||||||||||||||||||||||
104 | - | |||||||||||||||||||||||||
105 | lold = l; | - | ||||||||||||||||||||||||
106 | l += 1 + l1 + 1 + l2; | - | ||||||||||||||||||||||||
107 | if (l > (1024 * 1024)
| 0-13855 | ||||||||||||||||||||||||
108 | ERR_put_error(11,(116),(134),__FILE__,123); | - | ||||||||||||||||||||||||
109 | goto never executed: end;goto end; never executed: goto end; | 0 | ||||||||||||||||||||||||
110 | } | - | ||||||||||||||||||||||||
111 | if (b !=
| 478-13377 | ||||||||||||||||||||||||
112 | ((void *)0)
| 478-13377 | ||||||||||||||||||||||||
113 | ) { | - | ||||||||||||||||||||||||
114 | if (!BUF_MEM_grow(b, l + 1)
| 0-13377 | ||||||||||||||||||||||||
115 | goto never executed: err;goto err; never executed: goto err; | 0 | ||||||||||||||||||||||||
116 | p = &(b->data[lold]); | - | ||||||||||||||||||||||||
117 | } executed 13377 times by 1 test: else if (l > lenend of block Executed by:
| 3-13377 | ||||||||||||||||||||||||
118 | break; executed 3 times by 1 test: break; Executed by:
| 3 | ||||||||||||||||||||||||
119 | } else | - | ||||||||||||||||||||||||
120 | p = &(buf[lold]); executed 475 times by 1 test: p = &(buf[lold]); Executed by:
| 475 | ||||||||||||||||||||||||
121 | *(p++) = '/'; | - | ||||||||||||||||||||||||
122 | memcpy(p, s, (unsigned int)l1); | - | ||||||||||||||||||||||||
123 | p += l1; | - | ||||||||||||||||||||||||
124 | *(p++) = '='; | - | ||||||||||||||||||||||||
125 | - | |||||||||||||||||||||||||
126 | - | |||||||||||||||||||||||||
127 | q = ne->value->data; | - | ||||||||||||||||||||||||
128 | - | |||||||||||||||||||||||||
129 | - | |||||||||||||||||||||||||
130 | for (j = 0; j < num
| 13852-81106 | ||||||||||||||||||||||||
131 | if (!gs_doit[j & 3]
| 0-81106 | ||||||||||||||||||||||||
132 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
133 | - | |||||||||||||||||||||||||
134 | n = q[j]; | - | ||||||||||||||||||||||||
135 | if ((
| 8855-72251 | ||||||||||||||||||||||||
136 | *(p++) = '\\'; | - | ||||||||||||||||||||||||
137 | *(p++) = 'x'; | - | ||||||||||||||||||||||||
138 | *(p++) = hex[(n >> 4) & 0x0f]; | - | ||||||||||||||||||||||||
139 | *(p++) = hex[n & 0x0f]; | - | ||||||||||||||||||||||||
140 | } executed 22129 times by 1 test: elseend of block Executed by:
| 22129 | ||||||||||||||||||||||||
141 | *( executed 58977 times by 1 test: p++) = n;*(p++) = n; Executed by:
executed 58977 times by 1 test: *(p++) = n; Executed by:
| 58977 | ||||||||||||||||||||||||
142 | } | - | ||||||||||||||||||||||||
143 | *p = '\0'; | - | ||||||||||||||||||||||||
144 | } executed 13852 times by 1 test: end of block Executed by:
| 13852 | ||||||||||||||||||||||||
145 | if (b !=
| 471-5798 | ||||||||||||||||||||||||
146 | ((void *)0)
| 471-5798 | ||||||||||||||||||||||||
147 | ) { | - | ||||||||||||||||||||||||
148 | p = b->data; | - | ||||||||||||||||||||||||
149 | CRYPTO_free(b, __FILE__, 170); | - | ||||||||||||||||||||||||
150 | } executed 5798 times by 1 test: elseend of block Executed by:
| 5798 | ||||||||||||||||||||||||
151 | p = buf; executed 471 times by 1 test: p = buf; Executed by:
| 471 | ||||||||||||||||||||||||
152 | if (i == 0
| 2027-4242 | ||||||||||||||||||||||||
153 | * executed 4242 times by 1 test: p = '\0';*p = '\0'; Executed by:
executed 4242 times by 1 test: *p = '\0'; Executed by:
| 4242 | ||||||||||||||||||||||||
154 | return executed 6269 times by 1 test: p;return p; Executed by:
executed 6269 times by 1 test: return p; Executed by:
| 6269 | ||||||||||||||||||||||||
155 | err: | - | ||||||||||||||||||||||||
156 | ERR_put_error(11,(116),((1|64)),__FILE__,177); | - | ||||||||||||||||||||||||
157 | end: code before this statement never executed: end: | 0 | ||||||||||||||||||||||||
158 | BUF_MEM_free(b); | - | ||||||||||||||||||||||||
159 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
160 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
161 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
162 | } | - | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |