]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/fs/sfs.c (grub_sfs_read_symlink): Convert latin1 into
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 7 May 2012 19:57:51 +0000 (21:57 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 7 May 2012 19:57:51 +0000 (21:57 +0200)
UTF-8.

ChangeLog
grub-core/fs/sfs.c

index 96d4df610ec86e10420f7410f51152cbd5e47c85..e65f6da640cfa51e3cdabbc7b36c3f5785a414ab 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-07  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/fs/sfs.c (grub_sfs_read_symlink): Convert latin1 into
+       UTF-8.
+
 2012-05-07  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/fs/affs.c (grub_affs_iterate_dir): Mark as case insensitive.
index a8bc00a065619d93cd264910faa05ff3b9099227..798a70afaf294a96868d5cdf2218b1809e20d7e5 100644 (file)
@@ -447,12 +447,16 @@ grub_sfs_read_symlink (grub_fshelp_node_t node)
 
   /* This is just a wild guess, but it always worked for me.  How the
      SLNK block looks like is not documented in the SFS docs.  */
-  symlink = grub_strndup (&block[24],
-                         (GRUB_DISK_SECTOR_SIZE << data->log_blocksize) - 24);
-  grub_free (block);
+  symlink = grub_malloc (((GRUB_DISK_SECTOR_SIZE << data->log_blocksize)
+                         - 24) * GRUB_MAX_UTF8_PER_LATIN1 + 1);
   if (!symlink)
-    return 0;
-
+    {
+      grub_free (block);
+      return 0;
+    }
+  *grub_latin1_to_utf8 ((grub_uint8_t *) symlink, (grub_uint8_t *) &block[24],
+                       (GRUB_DISK_SECTOR_SIZE << data->log_blocksize) - 24) = '\0';
+  grub_free (block);
   return symlink;
 }