Skip to content

Commit bfd3f7a

Browse files
authored
Merge pull request #145 from LinuxJedi/fix-tests3
Fix a couple of failing tests
2 parents 2178eaf + 31f61e7 commit bfd3f7a

File tree

3 files changed

+18
-32
lines changed

3 files changed

+18
-32
lines changed

.github/workflows/debian-package-test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ jobs:
4444
- name: wolfssl install
4545
working-directory: ./wolfssl
4646
run: |
47-
sudo dpkg -i libwolfssl_*.deb libwolfssl-dev_*.deb
47+
# Install wolfSSL packages staged in parent directory by dpkg-buildpackage
48+
sudo dpkg -i ../libwolfssl_*.deb ../libwolfssl-dev_*.deb
49+
sudo apt-get -f install -y
4850
4951
# Setup wolfPKCS11
5052
- name: wolfpkcs11 autogen
@@ -62,6 +64,7 @@ jobs:
6264
- name: Test debian package installation
6365
run: |
6466
sudo dpkg -i libwolfpkcs11_*.deb libwolfpkcs11-dev_*.deb
67+
sudo apt-get -f install -y
6568
6669
# Verify installation
6770
- name: Verify package installation

.github/workflows/nss-ssltap-test.yml

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ jobs:
9292
run: |
9393
mkdir -p /tmp/src
9494
cd /tmp/src
95+
# Defensive cleanup to avoid 'destination ... is not empty' errors
96+
rm -rf nss osp
9597
9698
# Clone official Mozilla NSS with specific tag
9799
hg clone https://hg.mozilla.org/projects/nss -r ${{ env.NSS_VERSION }}
@@ -125,36 +127,7 @@ jobs:
125127
path: /tmp/src/dist
126128
key: nss-build-${{ env.NSS_VERSION }}-latest
127129

128-
- name: Clone NSS and apply wolfSSL patches
129-
if: steps.cache-nss-source.outputs.cache-hit != 'true'
130-
run: |
131-
mkdir -p /tmp/src
132-
cd /tmp/src
133-
134-
# Clone official Mozilla NSS with specific tag
135-
hg clone https://hg.mozilla.org/projects/nss -r ${{ env.NSS_VERSION }}
136-
137-
# Clone wolfSSL OSP repository for patches
138-
git clone https://github.com/wolfSSL/osp.git
139130

140-
cd nss
141-
142-
# Apply patches from wolfSSL/osp/nss directory
143-
echo "Applying wolfSSL NSS patches..."
144-
if [ -d "../osp/nss" ]; then
145-
for patch in ../osp/nss/*.patch; do
146-
if [ -f "$patch" ]; then
147-
echo "Applying patch: $(basename $patch)"
148-
patch -p1 < "$patch" || {
149-
echo "Warning: Patch $(basename $patch) failed to apply cleanly"
150-
echo "Attempting to apply with --reject-file option..."
151-
patch -p1 --reject-file=/tmp/$(basename $patch).rej < "$patch" || true
152-
}
153-
fi
154-
done
155-
else
156-
echo "No patches found in wolfSSL/osp/nss directory"
157-
fi
158131

159132
- name: Build NSS
160133
if: steps.cache-nss-build.outputs.cache-hit != 'true'

src/internal.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,11 @@ static int wolfPKCS11_Store_Name(int type, CK_ULONG id1, CK_ULONG id2, char* nam
10641064
#ifndef WOLFPKCS11_NO_ENV
10651065
const char* str = NULL;
10661066
#endif
1067-
char homePath[47]; /* Must fit within name buffer size limit */
1067+
/* Reserve enough space in the final filename for suffixes such as
1068+
* "/wp11_rsakey_priv_%016lx_%016lx" (47 chars worst-case).
1069+
*/
1070+
enum { WP11_STORE_SUFFIX_RESERVE = 48 };
1071+
char homePath[256];
10681072

10691073
/* Path order:
10701074
* 1. Environment variable WOLFPKCS11_TOKEN_PATH
@@ -1125,7 +1129,13 @@ static int wolfPKCS11_Store_Name(int type, CK_ULONG id1, CK_ULONG id2, char* nam
11251129
#endif
11261130

11271131
/* 47 is maximum number of character to a filename and path separator. */
1128-
if (str == NULL || (XSTRLEN(str) > nameLen - sizeof(homePath))) {
1132+
if (str == NULL) {
1133+
return -1;
1134+
}
1135+
if (nameLen <= WP11_STORE_SUFFIX_RESERVE) {
1136+
return -1;
1137+
}
1138+
if (XSTRLEN(str) > (size_t)(nameLen - WP11_STORE_SUFFIX_RESERVE - 1)) {
11291139
return -1;
11301140
}
11311141

0 commit comments

Comments
 (0)