Blame SOURCES/autofs-5.0.7-add-mapent-null-check-in-lookup-nisplus-lookup_mount.patch

4d476f
autofs-5.0.7 - add mapent null check in lookup_nisplus.c:lookup_mount()
4d476f
4d476f
From: Ian Kent <raven@themaw.net>
4d476f
4d476f
malloc(3) could return null under low memory conditions, add a null check
4d476f
for this case.
4d476f
---
4d476f
 modules/lookup_nisplus.c |    3 ++-
4d476f
 1 file changed, 2 insertions(+), 1 deletion(-)
4d476f
4d476f
diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c
4d476f
index 8237a1e..ef942a7 100644
4d476f
--- a/modules/lookup_nisplus.c
4d476f
+++ b/modules/lookup_nisplus.c
4d476f
@@ -584,7 +584,8 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
4d476f
 		if (me && (me->source == source || *me->key == '/')) {
4d476f
 			mapent_len = strlen(me->mapent);
4d476f
 			mapent = malloc(mapent_len + 1);
4d476f
-			strcpy(mapent, me->mapent);
4d476f
+			if (mapent)
4d476f
+				strcpy(mapent, me->mapent);
4d476f
 		}
4d476f
 	}
4d476f
 	cache_unlock(mc);