autofs/SOURCES/autofs-5.1.8-avoid-calling-pthread_getspecific-with-NULL-key_thread_attempt_id.patch
2022-02-16 04:20:14 +00:00

36 lines
1.1 KiB
Diff

autofs-5.1.8 - avoid calling pthread_getspecific() with NULL key_thread_attempt_id
From: Ian Kent <raven@themaw.net>
Don't call pthread_getspecific() if key_thread_attempt_id is NULL in
case the pthread_getspecific() implementation doesn't check for this.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
lib/log.c | 3 +++
2 files changed, 4 insertions(+)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -90,6 +90,7 @@
- simplify cache_add() a little.
- fix use after free in tree_mapent_delete_offset_tree().
- fix memory leak in xdr_exports().
+- avoid calling pthread_getspecific() with NULL key_thread_attempt_id.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/lib/log.c
+++ autofs-5.1.4/lib/log.c
@@ -38,6 +38,9 @@ static char *prepare_attempt_prefix(cons
char buffer[ATTEMPT_ID_SIZE + 1];
char *prefixed_msg = NULL;
+ if (!key_thread_attempt_id)
+ return NULL;
+
attempt_id = pthread_getspecific(key_thread_attempt_id);
if (attempt_id) {
int len = sizeof(buffer) + 1 + strlen(msg) + 1;