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

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