From d9b9596c8d973d619d58fc2b7cb84f7f4268a4b0 Mon Sep 17 00:00:00 2001 From: nathanw Date: Wed, 9 Oct 2002 15:43:34 +0000 Subject: [PATCH] Pass _rtld_map_object a heap-allocated path, since it will free the path on failure. Prevents calling free() on a stack address if you run ldd on an unrecognized file format. --- usr.bin/ldd/ldd_elf/ldd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/ldd/ldd_elf/ldd.c b/usr.bin/ldd/ldd_elf/ldd.c index 97ca3605dce0..2f2d532fae1c 100644 --- a/usr.bin/ldd/ldd_elf/ldd.c +++ b/usr.bin/ldd/ldd_elf/ldd.c @@ -1,4 +1,4 @@ -/* $NetBSD: ldd.c,v 1.13 2002/09/24 09:58:03 junyoung Exp $ */ +/* $NetBSD: ldd.c,v 1.14 2002/10/09 15:43:34 nathanw Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -128,7 +128,7 @@ main( warn("%s", *argv); continue; } - _rtld_objmain = _rtld_map_object(*argv, fd, NULL); + _rtld_objmain = _rtld_map_object(xstrdup(*argv), fd, NULL); if (_rtld_objmain == NULL) { if (ldd_aout(*argv, fd) < 0) warnx("%s", _rtld_error_message);