Fix a bug in icondir handling

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-11-21 17:48:05 +01:00
parent aff798d6f4
commit 87efa251d5

View file

@ -137,14 +137,21 @@ static struct grub_video_bitmap *
try_loading_icon (grub_gfxmenu_icon_manager_t mgr, try_loading_icon (grub_gfxmenu_icon_manager_t mgr,
const char *dir, const char *class_name) const char *dir, const char *class_name)
{ {
char *path = grub_malloc (grub_strlen (dir) char *path;
+ grub_strlen (class_name) int l;
+ grub_strlen (icon_extension)
+ 1); path = grub_malloc (grub_strlen (dir) + grub_strlen (class_name)
+ grub_strlen (icon_extension) + 3);
if (! path) if (! path)
return 0; return 0;
grub_strcpy (path, dir); grub_strcpy (path, dir);
l = grub_strlen (path);
if (path[l-1] != '/')
{
path[l] = '/';
path[l+1] = 0;
}
grub_strcat (path, class_name); grub_strcat (path, class_name);
grub_strcat (path, icon_extension); grub_strcat (path, icon_extension);