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

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