From eec893ae499bdb4340cc790fc3ff155c2b96d397 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Fri, 29 Nov 2013 05:52:20 +0100 Subject: [PATCH] * grub-core/kern/emu/hostfs.c (is_dir): Remove variable length arrays. --- ChangeLog | 4 ++++ grub-core/kern/emu/hostfs.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 472e74b59..3af11fffb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-11-29 Vladimir Serbinenko + + * grub-core/kern/emu/hostfs.c (is_dir): Remove variable length arrays. + 2013-11-29 Vladimir Serbinenko * util/grub-fstest.c: Remove variable length arrays. diff --git a/grub-core/kern/emu/hostfs.c b/grub-core/kern/emu/hostfs.c index b51462641..7e725f65f 100644 --- a/grub-core/kern/emu/hostfs.c +++ b/grub-core/kern/emu/hostfs.c @@ -39,8 +39,9 @@ is_dir (const char *path, const char *name) { int len1 = strlen(path); int len2 = strlen(name); + int ret; - char pathname[len1 + 1 + len2 + 1 + 13]; + char *pathname = xmalloc (len1 + 1 + len2 + 1 + 13); strcpy (pathname, path); /* Avoid UNC-path "//name" on Cygwin. */ @@ -49,7 +50,9 @@ is_dir (const char *path, const char *name) strcat (pathname, name); - return grub_util_is_directory (pathname); + ret = grub_util_is_directory (pathname); + free (pathname); + return ret; } struct grub_hostfs_data