Blame SOURCES/autofs-5.1.8-avoid-calling-pthread_getspecific-with-NULL-key_thread_attempt_id.patch

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