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

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