From 3244fe96e7c3cd3390810d5cb3b2a23f432d7524 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 10 May 2012 23:33:44 +0200 Subject: [PATCH] * grub-core/fs/ufs.c (grub_ufs_find_file): Fix handling of double slash. * grub-core/fs/minix.c (grub_minix_find_file): Likewise. --- ChangeLog | 7 ++++++- grub-core/fs/minix.c | 14 ++++++++------ grub-core/fs/ufs.c | 14 ++++++++------ 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d21557b1..aee8654db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,13 @@ +2012-05-10 Vladimir Serbinenko + + * grub-core/fs/ufs.c (grub_ufs_find_file): Fix handling of double slash. + * grub-core/fs/minix.c (grub_minix_find_file): Likewise. + 2012-05-10 Vladimir Serbinenko * util/grub-menulst2cfg.c (main): Check return value of fwrite. * util/grub-mklayout.c (write_file): Likewise. New argument fname. - Allusers updated. + All users updated. 2012-05-10 Vladimir Serbinenko diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c index af04f11a4..a1b91addb 100644 --- a/grub-core/fs/minix.c +++ b/grub-core/fs/minix.c @@ -386,12 +386,10 @@ grub_minix_find_file (struct grub_minix_data *data, const char *path) grub_strcpy (fpath, path); /* Skip the first slash. */ - if (name[0] == '/') - { - name++; - if (!*name) - return 0; - } + while (*name == '/') + name++; + if (!*name) + return 0; /* Extract the actual part from the pathname. */ next = grub_strchr (name, '/'); @@ -399,6 +397,8 @@ grub_minix_find_file (struct grub_minix_data *data, const char *path) { next[0] = '\0'; next++; + while (*next == '/') + next++; } do @@ -445,6 +445,8 @@ grub_minix_find_file (struct grub_minix_data *data, const char *path) { next[0] = '\0'; next++; + while (*next == '/') + next++; } if ((GRUB_MINIX_INODE_MODE (data) diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c index 05a0d2d42..bd0cd1f49 100644 --- a/grub-core/fs/ufs.c +++ b/grub-core/fs/ufs.c @@ -471,12 +471,10 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path) grub_strcpy (fpath, path); /* Skip the first slash. */ - if (name[0] == '/') - { - name++; - if (!*name) - return 0; - } + while (*name == '/') + name++; + if (!*name) + return 0; /* Extract the actual part from the pathname. */ next = grub_strchr (name, '/'); @@ -484,6 +482,8 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path) { next[0] = '\0'; next++; + while (*next == '/') + next++; } do @@ -536,6 +536,8 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path) { next[0] = '\0'; next++; + while (*next == '/') + next++; } if ((INODE_MODE(data) & GRUB_UFS_ATTR_TYPE) != GRUB_UFS_ATTR_DIR)