Skip to content

Commit af87627

Browse files
committed
accommodate for NULL key in oauth2_cache_get and oauth2_cache_set
release 1.4.3.2 Signed-off-by: Hans Zandbelt <hans.zandbelt@zmartzone.eu>
1 parent 65f51dc commit af87627

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ reporting bugs, providing fixes, suggesting useful features or other:
99
Phil Brown <https://github.com/brownp2k>
1010
Alexander Bokovoy <https://github.com/abbra>
1111
Niebardzo <https://github.com/niebardzo>
12+
Mikael Broadfoot <https://github.com/broadfootmi>

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
10/12/2021
22
- make outgoing_proxy an endpoint property
3+
- accommodate for NULL key in oauth2_cache_get and oauth2_cache_set
4+
- release 1.4.3.2
35

46
10/11/2021
57
- add outgoing_proxy option to verify context

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
AC_INIT([liboauth2],[1.4.3.2-dev],[hans.zandbelt@zmartzone.eu])
1+
AC_INIT([liboauth2],[1.4.3.2],[hans.zandbelt@zmartzone.eu])
22

33
AM_INIT_AUTOMAKE([foreign no-define subdir-objects])
44
AC_CONFIG_MACRO_DIR([m4])

src/cache.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ bool oauth2_cache_get(oauth2_log_t *log, oauth2_cache_t *cache, const char *key,
316316
char *hashed_key = NULL;
317317
char *encrypted_value = NULL;
318318

319-
oauth2_debug(log, "enter: key=%s, type=%s, decrypt=%d", key,
319+
oauth2_debug(log, "enter: key=%s, type=%s, decrypt=%d",
320+
key ? key : "<null>",
320321
cache && cache->type ? cache->type->name : "<n/a>",
321322
cache ? cache->encrypt : -1);
322323

@@ -350,7 +351,8 @@ bool oauth2_cache_get(oauth2_log_t *log, oauth2_cache_t *cache, const char *key,
350351
oauth2_mem_free(hashed_key);
351352

352353
oauth2_debug(log, "leave: cache %s for key: %s return: %lu bytes",
353-
rc ? (*value ? "hit" : "miss") : "error", key,
354+
rc ? (*value ? "hit" : "miss") : "error",
355+
key ? key : "<null>",
354356
*value ? (unsigned long)strlen(*value) : 0);
355357

356358
return rc;
@@ -388,7 +390,8 @@ bool oauth2_cache_set(oauth2_log_t *log, oauth2_cache_t *cache, const char *key,
388390
oauth2_debug(log,
389391
"enter: key=%s, len=%lu, ttl(s)=" OAUTH2_TIME_T_FORMAT
390392
", type=%s, encrypt=%d",
391-
key, value ? (unsigned long)strlen(value) : 0, ttl_s,
393+
key ? key : "<null>",
394+
value ? (unsigned long)strlen(value) : 0, ttl_s,
392395
(cache && cache->type) ? cache->type->name : "<n/a>",
393396
cache ? cache->encrypt : -1);
394397

@@ -419,9 +422,11 @@ bool oauth2_cache_set(oauth2_log_t *log, oauth2_cache_t *cache, const char *key,
419422
oauth2_mem_free(encrypted);
420423

421424
if (rc)
422-
oauth2_debug(log, "leave: successfully stored: %s", key);
425+
oauth2_debug(log, "leave: successfully stored: %s",
426+
key ? key : "<null>");
423427
else
424-
oauth2_error(log, "leave: could NOT store: %s", key);
428+
oauth2_error(log, "leave: could NOT store: %s",
429+
key ? key : "<null>");
425430

426431
return rc;
427432
}

0 commit comments

Comments
 (0)