Skip to content

Commit 2ce5bbc

Browse files
authored
Merge pull request #427 from dgarske/zd20237
Fix possible buffer overrun issues
2 parents e35465f + b3cdff3 commit 2ce5bbc

File tree

6 files changed

+459
-209
lines changed

6 files changed

+459
-209
lines changed

.github/workflows/make-test-swtpm.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,16 @@ jobs:
139139
- name: make debug io
140140
run: make
141141

142+
# build with clang address sanitizer
143+
- name: configure clang asan
144+
run: ./configure --enable-swtpm CC=clang CFLAGS="-fsanitize=address -fno-omit-frame-pointer -g"
145+
- name: make clang asan
146+
run: make
147+
- name: make check clang asan
148+
run: |
149+
make check
150+
ASAN_OPTIONS=detect_leaks=1:abort_on_error=1 WOLFSSL_PATH=./wolfssl ./examples/run_examples.sh
151+
142152
# build pedantic
143153
- name: configure pedantic
144154
run: ./configure CFLAGS="-Wpedantic"
@@ -230,6 +240,16 @@ jobs:
230240
make check
231241
WOLFSSL_PATH=./wolfssl NO_PUBASPRIV=1 ./examples/run_examples.sh
232242
243+
# test with symmetric encryption
244+
- name: configure symmetric
245+
run: ./configure --enable-swtpm CFLAGS="-DWOLFTPM_USE_SYMMETRIC"
246+
- name: make symmetric
247+
run: make
248+
- name: make check symmetric
249+
run: |
250+
make check
251+
WOLFSSL_PATH=./wolfssl ./examples/run_examples.sh
252+
233253
# capture logs on failure
234254
- name: Upload failure logs
235255
if: failure()

src/tpm2.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6328,6 +6328,9 @@ int TPM2_GetWolfRng(WC_RNG** rng)
63286328
printf("wc_InitRng_ex failed %d: %s\n",
63296329
(int)rc, wc_GetErrorString(rc));
63306330
#endif
6331+
if (rng) {
6332+
*rng = NULL;
6333+
}
63316334
return rc;
63326335
}
63336336
ctx->rngInit = 1;

0 commit comments

Comments
 (0)