Skip to content

Commit 8edb466

Browse files
committed
parse_enrollment_jwt should not change input
1 parent 76f8e22 commit 8edb466

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

library/ziti_enroll.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
// Copyright (c) 2023-2024. NetFoundry Inc.
1+
// Copyright (c) 2023-2026. NetFoundry Inc
22
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
56
//
6-
// You may obtain a copy of the License at
7-
// https://www.apache.org/licenses/LICENSE-2.0
7+
// https://www.apache.org/licenses/LICENSE-2.0
88
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
1414

1515
#include <assert.h>
1616
#include <stdlib.h>
@@ -470,10 +470,8 @@ int parse_enrollment_jwt(const char *token, ziti_enrollment_jwt_header *zejh, zi
470470
}
471471
free(body);
472472

473-
*dot2 = 0;
474473
ZITI_LOG(DEBUG, "jwt signature is: %s", dot2 + 1);
475474
tlsuv_base64url_decode(dot2 + 1, sig, sig_len);
476475

477-
478476
return ZITI_OK;
479477
}

tests/test_jwt.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static char* url64to64(const char* in, size_t ilen, size_t *olen) {
4242
return out;
4343
}
4444

45-
static char jwt[] =
45+
static const char jwt[] =
4646
"eyJhbGciOiJSUzI1NiIsImtpZCI6ImUwYzZhZTkxYzE0YzljOTViOGMwYTUyMzY4NmEzNzF"
4747
"jOGY1MGUxNDAiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2ZkMjAwZmQzLWEyZDk"
4848
"tNDU3Zi1iYzBiLWY5YjhlZTdkMjg5OC5wcm9kdWN0aW9uLm5ldGZvdW5kcnkuaW86NDQzIi"
@@ -95,7 +95,6 @@ TEST_CASE("zt_jwt_parse","[model]") {
9595
}
9696

9797
TEST_CASE("jwt cred", "[model]") {
98-
ziti_log_init(uv_default_loop(), TRACE, NULL);
9998
ziti_credential_t *cred = nullptr;
10099
int rc = ziti_credential_from_jwt(jwt, &cred);
101100
CHECK(rc == 0);

0 commit comments

Comments
 (0)