OpenCoverage

txt_db.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/txt_db/txt_db.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.-
3 *-
4 * Licensed under the OpenSSL license (the "License"). You may not use-
5 * this file except in compliance with the License. You can obtain a copy-
6 * in the file LICENSE in the source distribution or at-
7 * https://www.openssl.org/source/license.html-
8 */-
9-
10#include <stdio.h>-
11#include <stdlib.h>-
12#include <string.h>-
13#include "internal/cryptlib.h"-
14#include <openssl/buffer.h>-
15#include <openssl/txt_db.h>-
16-
17#undef BUFSIZE-
18#define BUFSIZE 512-
19-
20TXT_DB *TXT_DB_read(BIO *in, int num)-
21{-
22 TXT_DB *ret = NULL;-
23 int esc = 0;-
24 long ln = 0;-
25 int i, add, n;-
26 int size = BUFSIZE;-
27 int offset = 0;-
28 char *p, *f;-
29 OPENSSL_STRING *pp;-
30 BUF_MEM *buf = NULL;-
31-
32 if ((buf = BUF_MEM_new()) == NULL)
(buf = BUF_MEM...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
33 goto err;
never executed: goto err;
0
34 if (!BUF_MEM_grow(buf, size))
!BUF_MEM_grow(buf, size)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
35 goto err;
never executed: goto err;
0
36-
37 if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
(ret = CRYPTO_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
38 goto err;
never executed: goto err;
0
39 ret->num_fields = num;-
40 ret->index = NULL;-
41 ret->qual = NULL;-
42 if ((ret->data = sk_OPENSSL_PSTRING_new_null()) == NULL)
(ret->data = s...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
43 goto err;
never executed: goto err;
0
44 if ((ret->index = OPENSSL_malloc(sizeof(*ret->index) * num)) == NULL)
(ret->index = ...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
45 goto err;
never executed: goto err;
0
46 if ((ret->qual = OPENSSL_malloc(sizeof(*(ret->qual)) * num)) == NULL)
(ret->qual = C...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
47 goto err;
never executed: goto err;
0
48 for (i = 0; i < num; i++) {
i < numDescription
TRUEevaluated 48 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
8-48
49 ret->index[i] = NULL;-
50 ret->qual[i] = NULL;-
51 }
executed 48 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
48
52-
53 add = (num + 1) * sizeof(char *);-
54 buf->data[size - 1] = '\0';-
55 offset = 0;-
56 for (;;) {-
57 if (offset != 0) {
offset != 0Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 13 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
8-13
58 size += BUFSIZE;-
59 if (!BUF_MEM_grow_clean(buf, size))
!BUF_MEM_grow_clean(buf, size)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
60 goto err;
never executed: goto err;
0
61 }
executed 8 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8
62 buf->data[offset] = '\0';-
63 BIO_gets(in, &(buf->data[offset]), size - offset);-
64 ln++;-
65 if (buf->data[offset] == '\0')
buf->data[offset] == '\0'Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 13 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
8-13
66 break;
executed 8 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
8
67 if ((offset == 0) && (buf->data[0] == '#'))
(offset == 0)Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(buf->data[0] == '#')Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
68 continue;
never executed: continue;
0
69 i = strlen(&(buf->data[offset]));-
70 offset += i;-
71 if (buf->data[offset - 1] != '\n')
buf->data[offset - 1] != '\n'Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5-8
72 continue;
executed 8 times by 1 test: continue;
Executed by:
  • libcrypto.so.1.1
8
73 else {-
74 buf->data[offset - 1] = '\0'; /* blat the '\n' */-
75 if ((p = OPENSSL_malloc(add + offset)) == NULL)
(p = CRYPTO_ma...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-5
76 goto err;
never executed: goto err;
0
77 offset = 0;-
78 }
executed 5 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
5
79 pp = (char **)p;-
80 p += add;-
81 n = 0;-
82 pp[n++] = p;-
83 i = 0;-
84 f = buf->data;-
85-
86 esc = 0;-
87 for (;;) {-
88 if (*f == '\0')
*f == '\0'Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5750 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5-5750
89 break;
executed 5 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
5
90 if (*f == '\t') {
*f == '\t'Description
TRUEevaluated 25 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5725 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
25-5725
91 if (esc)
escDescription
TRUEnever evaluated
FALSEevaluated 25 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-25
92 p--;
never executed: p--;
0
93 else {-
94 *(p++) = '\0';-
95 f++;-
96 if (n >= num)
n >= numDescription
TRUEnever evaluated
FALSEevaluated 25 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-25
97 break;
never executed: break;
0
98 pp[n++] = p;-
99 continue;
executed 25 times by 1 test: continue;
Executed by:
  • libcrypto.so.1.1
25
100 }-
101 }-
102 esc = (*f == '\\');-
103 *(p++) = *(f++);-
104 }
executed 5725 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
5725
105 *(p++) = '\0';-
106 if ((n != num) || (*f != '\0')) {
(n != num)Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(*f != '\0')Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-5
107 OPENSSL_free(pp);-
108 ret->error = DB_ERROR_WRONG_NUM_FIELDS;-
109 goto err;
never executed: goto err;
0
110 }-
111 pp[n] = p;-
112 if (!sk_OPENSSL_PSTRING_push(ret->data, pp)) {
!sk_OPENSSL_PS...ret->data, pp)Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-5
113 OPENSSL_free(pp);-
114 goto err;
never executed: goto err;
0
115 }-
116 }
executed 5 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
5
117 BUF_MEM_free(buf);-
118 return ret;
executed 8 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
8
119 err:-
120 BUF_MEM_free(buf);-
121 if (ret != NULL) {
ret != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
122 sk_OPENSSL_PSTRING_free(ret->data);-
123 OPENSSL_free(ret->index);-
124 OPENSSL_free(ret->qual);-
125 OPENSSL_free(ret);-
126 }
never executed: end of block
0
127 return NULL;
never executed: return ((void *)0) ;
0
128}-
129-
130OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx,-
131 OPENSSL_STRING *value)-
132{-
133 OPENSSL_STRING *ret;-
134 LHASH_OF(OPENSSL_STRING) *lh;-
135-
136 if (idx >= db->num_fields) {
idx >= db->num_fieldsDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
137 db->error = DB_ERROR_INDEX_OUT_OF_RANGE;-
138 return NULL;
never executed: return ((void *)0) ;
0
139 }-
140 lh = db->index[idx];-
141 if (lh == NULL) {
lh == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
142 db->error = DB_ERROR_NO_INDEX;-
143 return NULL;
never executed: return ((void *)0) ;
0
144 }-
145 ret = lh_OPENSSL_STRING_retrieve(lh, value);-
146 db->error = DB_ERROR_OK;-
147 return ret;
executed 4 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
4
148}-
149-
150int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *),-
151 OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC cmp)-
152{-
153 LHASH_OF(OPENSSL_STRING) *idx;-
154 OPENSSL_STRING *r, *k;-
155 int i, n;-
156-
157 if (field >= db->num_fields) {
field >= db->num_fieldsDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
158 db->error = DB_ERROR_INDEX_OUT_OF_RANGE;-
159 return 0;
never executed: return 0;
0
160 }-
161 /* FIXME: we lose type checking at this point */-
162 if ((idx = (LHASH_OF(OPENSSL_STRING) *)OPENSSL_LH_new(hash, cmp)) == NULL) {
(idx = (struct...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
163 db->error = DB_ERROR_MALLOC;-
164 return 0;
never executed: return 0;
0
165 }-
166 n = sk_OPENSSL_PSTRING_num(db->data);-
167 for (i = 0; i < n; i++) {
i < nDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2-4
168 r = sk_OPENSSL_PSTRING_value(db->data, i);-
169 if ((qual != NULL) && (qual(r) == 0))
(qual != ((void *)0) )Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
(qual(r) == 0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1
170 continue;
never executed: continue;
0
171 if ((k = lh_OPENSSL_STRING_insert(idx, r)) != NULL) {
(k = lh_OPENSS...!= ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
172 db->error = DB_ERROR_INDEX_CLASH;-
173 db->arg1 = sk_OPENSSL_PSTRING_find(db->data, k);-
174 db->arg2 = i;-
175 lh_OPENSSL_STRING_free(idx);-
176 return 0;
never executed: return 0;
0
177 }-
178 if (lh_OPENSSL_STRING_retrieve(idx, r) == NULL) {
lh_OPENSSL_STR...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
179 db->error = DB_ERROR_MALLOC;-
180 lh_OPENSSL_STRING_free(idx);-
181 return 0;
never executed: return 0;
0
182 }-
183 }
executed 2 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
2
184 lh_OPENSSL_STRING_free(db->index[field]);-
185 db->index[field] = idx;-
186 db->qual[field] = qual;-
187 return 1;
executed 4 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
4
188}-
189-
190long TXT_DB_write(BIO *out, TXT_DB *db)-
191{-
192 long i, j, n, nn, l, tot = 0;-
193 char *p, **pp, *f;-
194 BUF_MEM *buf = NULL;-
195 long ret = -1;-
196-
197 if ((buf = BUF_MEM_new()) == NULL)
(buf = BUF_MEM...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
198 goto err;
never executed: goto err;
0
199 n = sk_OPENSSL_PSTRING_num(db->data);-
200 nn = db->num_fields;-
201 for (i = 0; i < n; i++) {
i < nDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4-5
202 pp = sk_OPENSSL_PSTRING_value(db->data, i);-
203-
204 l = 0;-
205 for (j = 0; j < nn; j++) {
j < nnDescription
TRUEevaluated 30 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5-30
206 if (pp[j] != NULL)
pp[j] != ((void *)0)Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4-26
207 l += strlen(pp[j]);
executed 26 times by 1 test: l += strlen(pp[j]);
Executed by:
  • libcrypto.so.1.1
26
208 }
executed 30 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
30
209 if (!BUF_MEM_grow_clean(buf, (int)(l * 2 + nn)))
!BUF_MEM_grow_...)(l * 2 + nn))Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-5
210 goto err;
never executed: goto err;
0
211-
212 p = buf->data;-
213 for (j = 0; j < nn; j++) {
j < nnDescription
TRUEevaluated 30 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5-30
214 f = pp[j];-
215 if (f != NULL)
f != ((void *)0)Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4-26
216 for (;;) {-
217 if (*f == '\0')
*f == '\0'Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3103 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
26-3103
218 break;
executed 26 times by 1 test: break;
Executed by:
  • libcrypto.so.1.1
26
219 if (*f == '\t')
*f == '\t'Description
TRUEnever evaluated
FALSEevaluated 3103 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-3103
220 *(p++) = '\\';
never executed: *(p++) = '\\';
0
221 *(p++) = *(f++);-
222 }
executed 3103 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
3103
223 *(p++) = '\t';-
224 }
executed 30 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
30
225 p[-1] = '\n';-
226 j = p - buf->data;-
227 if (BIO_write(out, buf->data, (int)j) != j)
BIO_write(out,..., (int)j) != jDescription
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-5
228 goto err;
never executed: goto err;
0
229 tot += j;-
230 }
executed 5 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
5
231 ret = tot;-
232 err:
code before this statement executed 4 times by 1 test: err:
Executed by:
  • libcrypto.so.1.1
4
233 BUF_MEM_free(buf);-
234 return ret;
executed 4 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
4
235}-
236-
237int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *row)-
238{-
239 int i;-
240 OPENSSL_STRING *r;-
241-
242 for (i = 0; i < db->num_fields; i++) {
i < db->num_fieldsDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4-24
243 if (db->index[i] != NULL) {
db->index[i] != ((void *)0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 20 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4-20
244 if ((db->qual[i] != NULL) && (db->qual[i] (row) == 0))
(db->qual[i] != ((void *)0) )Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(db->qual[i] (row) == 0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
245 continue;
never executed: continue;
0
246 r = lh_OPENSSL_STRING_retrieve(db->index[i], row);-
247 if (r != NULL) {
r != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
248 db->error = DB_ERROR_INDEX_CLASH;-
249 db->arg1 = i;-
250 db->arg_row = r;-
251 goto err;
never executed: goto err;
0
252 }-
253 }
executed 4 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
4
254 }
executed 24 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
24
255-
256 for (i = 0; i < db->num_fields; i++) {
i < db->num_fieldsDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4-24
257 if (db->index[i] != NULL) {
db->index[i] != ((void *)0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 20 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4-20
258 if ((db->qual[i] != NULL) && (db->qual[i] (row) == 0))
(db->qual[i] != ((void *)0) )Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(db->qual[i] (row) == 0)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
259 continue;
never executed: continue;
0
260 (void)lh_OPENSSL_STRING_insert(db->index[i], row);-
261 if (lh_OPENSSL_STRING_retrieve(db->index[i], row) == NULL)
lh_OPENSSL_STR...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
262 goto err1;
never executed: goto err1;
0
263 }
executed 4 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
4
264 }
executed 24 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
24
265 if (!sk_OPENSSL_PSTRING_push(db->data, row))
!sk_OPENSSL_PS...db->data, row)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
266 goto err1;
never executed: goto err1;
0
267 return 1;
executed 4 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
4
268-
269 err1:-
270 db->error = DB_ERROR_MALLOC;-
271 while (i-- > 0) {
i-- > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
272 if (db->index[i] != NULL) {
db->index[i] != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
273 if ((db->qual[i] != NULL) && (db->qual[i] (row) == 0))
(db->qual[i] != ((void *)0) )Description
TRUEnever evaluated
FALSEnever evaluated
(db->qual[i] (row) == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
274 continue;
never executed: continue;
0
275 (void)lh_OPENSSL_STRING_delete(db->index[i], row);-
276 }
never executed: end of block
0
277 }
never executed: end of block
0
278 err:
code before this statement never executed: err:
0
279 return 0;
never executed: return 0;
0
280}-
281-
282void TXT_DB_free(TXT_DB *db)-
283{-
284 int i, n;-
285 char **p, *max;-
286-
287 if (db == NULL)
db == ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2-8
288 return;
executed 2 times by 1 test: return;
Executed by:
  • libcrypto.so.1.1
2
289 if (db->index != NULL) {
db->index != ((void *)0)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-8
290 for (i = db->num_fields - 1; i >= 0; i--)
i >= 0Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
8-48
291 lh_OPENSSL_STRING_free(db->index[i]);
executed 48 times by 1 test: lh_OPENSSL_STRING_free(db->index[i]);
Executed by:
  • libcrypto.so.1.1
48
292 OPENSSL_free(db->index);-
293 }
executed 8 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8
294 OPENSSL_free(db->qual);-
295 if (db->data != NULL) {
db->data != ((void *)0)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-8
296 for (i = sk_OPENSSL_PSTRING_num(db->data) - 1; i >= 0; i--) {
i >= 0Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
8-9
297 /*-
298 * check if any 'fields' have been allocated from outside of the-
299 * initial block-
300 */-
301 p = sk_OPENSSL_PSTRING_value(db->data, i);-
302 max = p[db->num_fields]; /* last address */-
303 if (max == NULL) { /* new row */
max == ((void *)0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4-5
304 for (n = 0; n < db->num_fields; n++)
n < db->num_fieldsDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4-24
305 OPENSSL_free(p[n]);
executed 24 times by 1 test: CRYPTO_free(p[n], __FILE__, 305);
Executed by:
  • libcrypto.so.1.1
24
306 } else {
executed 4 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
4
307 for (n = 0; n < db->num_fields; n++) {
n < db->num_fieldsDescription
TRUEevaluated 30 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5-30
308 if (((p[n] < (char *)p) || (p[n] > max)))
(p[n] < (char *)p)Description
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
(p[n] > max)Description
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-30
309 OPENSSL_free(p[n]);
never executed: CRYPTO_free(p[n], __FILE__, 309);
0
310 }
executed 30 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
30
311 }
executed 5 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
5
312 OPENSSL_free(sk_OPENSSL_PSTRING_value(db->data, i));-
313 }
executed 9 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
9
314 sk_OPENSSL_PSTRING_free(db->data);-
315 }
executed 8 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8
316 OPENSSL_free(db);-
317}
executed 8 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
8
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2